Package org.apache.poi.ss.usermodel

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


            }

          }

          // Output the comment in the same cell as the content
          Comment comment = cell.getCellComment();
          if (comment != null) {
            buffy.append(comment.getString().getString()).append(' ');
          }
        }
      }

      // Finally footer(s), if present
View Full Code Here


                        }

                    }

                    // Output the comment in the same cell as the content
                    Comment comment = cell.getCellComment();
                    if (comment != null) {
                        xhtml.characters(comment.getString().getString());
                    }

                    xhtml.endElement("td");
                }
                xhtml.endElement("tr");
View Full Code Here

            XSSFCell xc = (XSSFCell)cell;
            text.append(xc.getRawValue());
          }
         
          // Output the comment, if requested and exists
            Comment comment = cell.getCellComment();
          if(includeCellComments && comment != null) {
              // Replace any newlines with spaces, otherwise it
              //  breaks the output
              String commentText = comment.getString().getString().replace('\n', ' ');
              text.append(" Comment by "+comment.getAuthor()+": "+commentText);
          }
         
          if(ri.hasNext())
            text.append("\t");
        }
View Full Code Here

    assertNotNull( r5.getCell(2).getCellComment() );
    assertNotNull( r7.getCell(2).getCellComment() );
   
    // Check they have what we expect
    // TODO: Rich text formatting
    Comment cc5 = r5.getCell(2).getCellComment();
    Comment cc7 = r7.getCell(2).getCellComment();
   
    assertEquals("Nick Burch", cc5.getAuthor());
    assertEquals("Nick Burch:\nThis is a comment", cc5.getString().getString());
    assertEquals(4, cc5.getRow());
    assertEquals(2, cc5.getColumn());
   
    assertEquals("Nick Burch", cc7.getAuthor());
    assertEquals("Nick Burch:\nComment #1\n", cc7.getString().getString());
    assertEquals(6, cc7.getRow());
    assertEquals(2, cc7.getColumn());
  }
View Full Code Here

    assertFalse( ((XSSFSheet)sheet2).hasComments() );
   
    // 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

                        }

                    }

                    // Output the comment in the same cell as the content
                    Comment comment = cell.getCellComment();
                    if (comment != null) {
                        xhtml.characters(comment.getString().getString());
                    }

                    xhtml.endElement("td");
                }
                xhtml.endElement("tr");
View Full Code Here

  public void process(Cell in, final HTMLBuilder out) {
    if (in == null) {
      return;
    }
   
    Comment comment = in.getCellComment();
    if (comment != null) {
      String commentString =comment.getString().toString();
     
      parseCommentString(commentString, new DefaultCommentConverter.Callback() {
     
        public void addAttribute(String name, String value) {
          setHtmlAttribute(name, value, out);
View Full Code Here

                        }

                    }

                    // Output the comment in the same cell as the content
                    Comment comment = cell.getCellComment();
                    if (comment != null) {
                        xhtml.characters(comment.getString().getString());
                    }

                    xhtml.endElement("td");
                }
                xhtml.endElement("tr");
View Full Code Here

       anchor.setCol1(0);
       anchor.setCol2(4);
       anchor.setRow1(0);
       anchor.setRow2(1);

       Comment comment1 = drawing.createCellComment(anchor);
       comment1.setString(
             factory.createRichTextString("I like this cell. It's my favourite."));
       comment1.setAuthor("Bob T. Fish");
      
       Comment comment2 = drawing.createCellComment(anchor);
       comment2.setString(
             factory.createRichTextString("This is much less fun..."));
       comment2.setAuthor("Bob T. Fish");

       Cell c1 = sh1.getRow(0).createCell(4);
       c1.setCellValue(2.3);
       c1.setCellComment(comment1);
      
View Full Code Here

       anchor.setCol1(0);
       anchor.setCol2(4);
       anchor.setRow1(0);
       anchor.setRow2(1);

       Comment comment1 = drawing.createCellComment(anchor);
       comment1.setString(
             factory.createRichTextString("I like this cell. It's my favourite."));
       comment1.setAuthor("Bob T. Fish");
      
       Comment comment2 = drawing.createCellComment(anchor);
       comment2.setString(
             factory.createRichTextString("This is much less fun..."));
       comment2.setAuthor("Bob T. Fish");

       Cell c1 = sh1.getRow(0).createCell(4);
       c1.setCellValue(2.3);
       c1.setCellComment(comment1);
      
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Comment

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.