Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFRichTextString



    public int serialize( int offset, byte[] data )
    {
        // Temporarily blank out str so that record size is calculated without the continue records.
        HSSFRichTextString temp = str;
        str = new HSSFRichTextString("");
        int bytesWritten1 = super.serialize( offset, data );
        str = temp;

        int pos = offset + bytesWritten1;
        if ( str.getString().equals( "" ) == false )
View Full Code Here


            }
            else
            {
            s = in.readUnicodeLEString(getTextLength());
        }
        str = new HSSFRichTextString( s );
    }
View Full Code Here

    if (field_6_textLength > 0) {
      text = readRawString(in, field_6_textLength);
    } else {
      text = "";
    }
    _text = new HSSFRichTextString(text);

    if (field_7_formattingDataLength > 0) {
      processFontRuns(in, _text, field_7_formattingDataLength);
    }
  }
View Full Code Here

                if(!_shouldEvaluateFormulas) {
                  text.append(cell.getCellFormula());
                } else {
                  switch(cell.getCachedFormulaResultType()) {
                    case HSSFCell.CELL_TYPE_STRING:
                      HSSFRichTextString str = cell.getRichStringCellValue();
                      if(str != null && str.length() > 0) {
                        text.append(str.toString());
                      }
                      break;
                    case HSSFCell.CELL_TYPE_NUMERIC:
                      text.append(cell.getNumericCellValue());
                      break;
View Full Code Here

  /** 0x7ff8000000000000 encoded in little endian order */
  private static final byte[] JAVA_NAN_BYTES = HexRead.readFromString("00 00 00 00 00 00 F8 7F");
 
  private static void writeHeaderCell(HSSFRow row, int i, String text, HSSFCellStyle style) {
    HSSFCell cell = row.createCell(i);
    cell.setCellValue(new HSSFRichTextString(text));
    cell.setCellStyle(style);
  }
View Full Code Here

    // The 'Match' column will contain 'OK' if the metadata (from NumberToTextConversionExamples)
    // matches Excel's rendering.
    String matchExpr = "if(D" + rowNum + "=E" + rowNum + ", \"OK\", \"ERROR\")";
   
    row.createCell(0).setCellValue(d);
    row.createCell(1).setCellValue(new HSSFRichTextString(rawBitsText));
    row.createCell(2).setCellValue(new HSSFRichTextString(Double.toString(d)));
    row.createCell(3).setCellFormula("\"\" & " + cel0ref);
    row.createCell(4).setCellValue(new HSSFRichTextString(expectedExcelRendering));
    row.createCell(5).setCellFormula(matchExpr);
    row.createCell(6).setCellFormula(jmExpr.replaceAll("'", "\""));

    if (false) {
      // for observing arithmetic near numeric range boundaries
View Full Code Here

        assertEquals(TextObjectRecord.TEXT_ORIENTATION_NONE, record.getTextOrientation());
        assertEquals("Hello, World!", record.getStr().getString());
    }

    public void testWrite() {
        HSSFRichTextString str = new HSSFRichTextString("Hello, World!");

        TextObjectRecord record = new TextObjectRecord();
        record.setStr(str);
        record.setHorizontalTextAlignment( TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_LEFT_ALIGNED );
        record.setVerticalTextAlignment( TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_TOP );
View Full Code Here

    /**
     * Zero {@link ContinueRecord}s follow a {@link TextObjectRecord} if the text is empty
     */
    public void testWriteEmpty() {
        HSSFRichTextString str = new HSSFRichTextString("");

        TextObjectRecord record = new TextObjectRecord();
        record.setStr(str);

        byte [] ser = record.serialize();
View Full Code Here

        for (int i = 0; i < length.length; i++) {
            StringBuffer buff = new StringBuffer(length[i]);
            for (int j = 0; j < length[i]; j++) {
                buff.append("x");
            }
            HSSFRichTextString str = new HSSFRichTextString(buff.toString());

            TextObjectRecord obj = new TextObjectRecord();
            obj.setStr(str);

            byte [] data = obj.serialize();
            RecordInputStream is = new RecordInputStream(new ByteArrayInputStream(data));
            is.nextRecord();
            TextObjectRecord record = new TextObjectRecord(is);
            str = record.getStr();

            assertEquals(buff.length(), str.length());
            assertEquals(buff.toString(), str.getString());
        }
    }
View Full Code Here

    /**
     * Test cloning
     */
    public void testClone() {
        String text = "Hello, World";
        HSSFRichTextString str = new HSSFRichTextString(text);

        TextObjectRecord obj = new TextObjectRecord();
        obj.setStr( str );


View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFRichTextString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.