Examples of HSSFRichTextString


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

    /**
     * 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

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

            break;
        case HSSFCell.CELL_TYPE_FORMULA:
            switch ( cell.getCachedFormulaResultType() )
            {
            case HSSFCell.CELL_TYPE_STRING:
                HSSFRichTextString str = cell.getRichStringCellValue();
                if ( str != null && str.length() > 0 )
                {
                    value = ( str.toString() );
                }
                else
                {
                    value = ExcelToHtmlUtils.EMPTY;
                }
View Full Code Here

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

            break;
        case HSSFCell.CELL_TYPE_FORMULA:
            switch ( cell.getCachedFormulaResultType() )
            {
            case HSSFCell.CELL_TYPE_STRING:
                HSSFRichTextString str = cell.getRichStringCellValue();
                if ( str != null && str.length() > 0 )
                {
                    value = ( str.toString() );
                }
                else
                {
                    value = ExcelToHtmlUtils.EMPTY;
                }
View Full Code Here

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

    if (path == null && titles != null) {
      sheet.createRow(rowIndex);
      HSSFRow row = sheet.createRow(rowIndex);
      for (String title : titles) {
        row.createCell((short) columnIndex).setCellValue(
            new HSSFRichTextString(title));
        columnIndex++;
      }
      rowIndex++;
      columnIndex = left;
    }

    for (int i = 0; i < size; i++) {
      // 填充每一行
      List<?> list = rows.get(i);
      int rowSize = list.size();
      for (int j = 0; j < rowSize; j++) {
        // 填充每一列
        Object value = list.get(j);
        if (value != null) {
          // 等于空时跳过这一次存储
          sheet.createRow(rowIndex).createCell((short) columnIndex)
              .setCellValue(new HSSFRichTextString(value.toString()));
        }
        // 如果定义了填充格式, 则需要计算新的单元格位置
        if (format != null) {
          rowIndex += format[j][0];
          columnIndex += format[j][1];
View Full Code Here

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

                    cellList.add(HSSFDateUtil.getJavaDate(d));
                  } else {
                    cellList.add(d);
                  }
                } else {
                  HSSFRichTextString o = cell.getRichStringCellValue();
                  cellList.add(o != null ? o.getString() : null);
                }
              }
            }
          }
          value = data;
View Full Code Here

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

            case HSSFCell.CELL_TYPE_FORMULA:
              if(formulasNotResults) {
                text.append(cell.getCellFormula());
              } else {
                // Try it as a string, if not as a number
                HSSFRichTextString str =
                  cell.getRichStringCellValue();
                if(str != null && str.length() > 0) {
                  text.append(str.toString());
                } else {
                  // Try and treat it as a number
                  double val = cell.getNumericCellValue();
                  text.append(val);
                }
View Full Code Here

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

    public TextObjectRecord( RecordInputStream in )
    {
        super( in );
        if (str == null)
          str = new HSSFRichTextString("");
    }
View Full Code Here

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

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

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

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

    }

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

        TextObjectRecord record = new TextObjectRecord();
        int frLength = ( str.numFormattingRuns() + 1 ) * 8;
        record.setFormattingRunLength( (short) frLength );
        record.setTextLength( (short) str.length() );
        record.setStr( str );
        record.setHorizontalTextAlignment( TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_LEFT_ALIGNED );
        record.setVerticalTextAlignment( TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_TOP );
        record.setTextLocked( true );
        record.setTextOrientation( TextObjectRecord.TEXT_ORIENTATION_NONE );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.