Examples of RichTextString


Examples of org.apache.poi.ss.usermodel.RichTextString

              {
                tableModel.addColumn(Messages.getString("TableDataSourceEditor.Column",
                    String.valueOf(tableModel.getColumnCount())), Object.class);
              }

              final RichTextString string = cell.getRichStringCellValue();
              if (string != null)
              {
                tableModel.addColumn(string.getString(), Object.class);
              }
              else
              {
                tableModel.addColumn(Messages.getString("TableDataSourceEditor.Column", String.valueOf(colIdx)), Object.class);
              }
            }
          }
        }
      }

      Object[] rowData = null;
      while (rowIterator.hasNext())
      {
        final Row row = (Row) rowIterator.next();
        final short cellCount = row.getLastCellNum();
        if (cellCount == -1)
        {
          continue;
        }
        if (rowData == null || rowData.length != cellCount)
        {
          rowData = new Object[cellCount];
        }

        for (short colIdx = 0; colIdx < cellCount; colIdx++)
        {
          final Cell cell = row.getCell(colIdx);

          final Object value;
          if (cell != null)
          {
            if (cell.getCellType() == Cell.CELL_TYPE_STRING)
            {
              final RichTextString string = cell.getRichStringCellValue();
              if (string != null)
              {
                value = string.getString();
              }
              else
              {
                value = null;
              }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

    public void testSetString() {
        CommentsTable sheetComments = new CommentsTable();
        CTComment ctComment = CTComment.Factory.newInstance();
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        RichTextString richTextString = new HSSFRichTextString(TEST_RICHTEXTSTRING);
        comment.setString(richTextString);
        assertEquals(TEST_RICHTEXTSTRING, ctComment.getText().getT());
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

    CTRst text = comment.addNewText();
    RichTextStringHelper.convertToRst(string, text);
  }
 
  public void setString(String string) {
    RichTextString richTextString = new XSSFRichTextString(string);
    setString(richTextString);
  }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

        XSSFRow row = sheet.createRow(0);
        XSSFCell cell = row.createCell(0);

        XSSFFont font = wb.createFont();
        RichTextString rts = factory.createRichTextString("");
        rts.applyFont(font);
        cell.setCellValue(rts);

        sheet.autoSizeColumn(0);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

    CTRst text = comment.addNewText();
    RichTextStringHelper.convertToRst(string, text);
  }
 
  public void setString(String string) {
    RichTextString richTextString = new XSSFRichTextString(string);
    setString(richTextString);
  }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

        XSSFWorkbook workbook = new XSSFWorkbook();
        Sheet sheet1 = workbook.createSheet("sheet1");
        Sheet sheet2 = workbook.createSheet("sheet2");
        Sheet sheet3 = workbook.createSheet("sheet3");
       
        RichTextString rts = workbook.getCreationHelper().createRichTextString("hello world");
       
        sheet1.createRow(0).createCell((short)0).setCellValue(1.2);
        sheet1.createRow(1).createCell((short)0).setCellValue(rts);
        sheet2.createRow(0);
       
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

 
  public void testSetString() {
    CommentsTable sheetComments = new CommentsTable();
    CTComment ctComment = CTComment.Factory.newInstance();
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
    RichTextString richTextString = new HSSFRichTextString(TEST_RICHTEXTSTRING);
    comment.setString(richTextString);
    assertEquals(TEST_RICHTEXTSTRING, ctComment.getText().getT());
  }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

        anchor.setRow2(row.getRowNum()+3);
       
        Drawing drawing = sheet.createDrawingPatriarch();
        Comment comment1 = drawing.createCellComment(anchor);
       
        RichTextString commentRtf = creationHelper.createRichTextString(commentText);
       
        comment1.setString(commentRtf);
        Comment comment = comment1;
        cell.setCellComment(comment);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

    private Object getCellComment(final Cell cell, final Class<?> requiredType) {
        final Comment comment = cell.getCellComment();
        if(comment == null) {
            return null;
        }
        final RichTextString commentRts = comment.getString();
        if(commentRts == null) {
            return null;
        }
        final String bookmarkStr = commentRts.getString();
        final Bookmark bookmark = new Bookmark(bookmarkStr);
        return bookmarkService.lookup(bookmark, requiredType);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.RichTextString

      Iterator itData =  dataSet.iterator();
      //遍历标题行
      for(Map titleM : titleList){
        String titleContent = (String) titleM.get("field_txt");
        Cell cell = row.createCell(cindex);
        RichTextString text = new HSSFRichTextString(titleContent);
        cell.setCellValue(text);
        cell.setCellStyle(titleStyle);
        cindex++;
      }
      HSSFCellStyle bodyStyle = getOneStyle(workbook);
      //遍历内容
      while (itData.hasNext()) {
        cindex = 0;
        rindex++;
        row = sheet.createRow(rindex);
        Map dataM = (Map) itData.next();//获取每一行的内容
        for(Map titleM : titleList){
          String field = (String) titleM.get("field_name");
          String content = dataM.get(field)==null?"":dataM.get(field).toString();
          Cell cell = row.createCell(cindex);
          RichTextString text = new HSSFRichTextString(content);
          cell.setCellStyle(bodyStyle);
          cell.setCellValue(text);
          cindex++;
        }
      }
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.