Package org.apache.poi.xssf.usermodel

Examples of org.apache.poi.xssf.usermodel.XSSFRichTextString


    // Change on comment on sheet 1, and add another into
    //  sheet 2
    Row r5 = sheet1.getRow(4);
    Comment cc5 = r5.getCell(2).getCellComment();
    cc5.setAuthor("Apache POI");
    cc5.setString(new XSSFRichTextString("Hello!"));
   
    Row r2s2 = sheet2.createRow(2);
    Cell c1r2s2 = r2s2.createCell(1);
    assertNull(c1r2s2.getCellComment());
   
    Comment cc2 = sheet2.createComment();
    cc2.setAuthor("Also POI");
    cc2.setString(new XSSFRichTextString("A new comment"));
    c1r2s2.setCellComment(cc2);
   
   
    // Save, and re-load the file
        workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
View Full Code Here


            final int event = sheetStreamReader.next();
            if (event == XMLStreamConstants.START_ELEMENT && "v".equals(sheetStreamReader.getLocalName())) {
                result = sheetStreamReader.getElementText();
                if ("s".equals(cellType)) {
                    final int idx = Integer.parseInt(result);
                    result = new XSSFRichTextString(sharedStringsTable.getEntryAt(idx)).toString();
                }
            } else if (event == XMLStreamConstants.START_ELEMENT && "t".equals(sheetStreamReader.getLocalName())) {
                result = sheetStreamReader.getElementText();
            } else if (event == XMLStreamConstants.END_ELEMENT && "c".equals(sheetStreamReader.getLocalName())) {
                break;
View Full Code Here

      String[] ss = StringUtils.split(headerList.get(i), "**", 2);
      if (ss.length==2){
        cell.setCellValue(ss[0]);
        Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
            new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
        comment.setString(new XSSFRichTextString(ss[1]));
        cell.setCellComment(comment);
      }else{
        cell.setCellValue(headerList.get(i));
      }
      sheet.autoSizeColumn(i);
View Full Code Here

      String[] rowvalue = datas.get(i);
      XSSFRow nextrow = sheet.createRow(sheet.getLastRowNum() + 1);// 创建一行
      for (int j = 0; j < rowvalue.length; j++) {
        XSSFCell cell = nextrow
            .createCell(j, XSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(new XSSFRichTextString(rowvalue[j]));
        if (rowvalue[j].equals("Fail")) {
          cell.setCellStyle(styleRed);
        } else if (rowvalue[j].equals("Pass")) {
          cell.setCellStyle(styleGreen);
        } else {
View Full Code Here

        assertEquals(7, sst.getCount());
        assertEquals(3, sst.getUniqueCount());

        //ok. the sst table is filled, check the contents
        assertEquals(3, sst.getItems().size());
        assertEquals("Hello, World!", new XSSFRichTextString(sst.getEntryAt(0)).toString());
        assertEquals("Second string", new XSSFRichTextString(sst.getEntryAt(1)).toString());
        assertEquals("Second string", new XSSFRichTextString(sst.getEntryAt(2)).toString());
    }
View Full Code Here

          c.setCellValue("");
        }
        break;
      case TEXT:
        if (cell.getValue() != null) {
          XSSFRichTextString value = new XSSFRichTextString(cell.getValue().toString());
          c.setCellValue(value);
        } else {
          c.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_STRING);
          c.setCellValue("");
        }
View Full Code Here

TOP

Related Classes of org.apache.poi.xssf.usermodel.XSSFRichTextString

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.