Examples of XSSFComment


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

        sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

    CTCommentList commentList = sheetComments.getCTComments().addNewCommentList();
    assertEquals(0, commentList.sizeOfCommentArray());
   
    XSSFComment comment = sheetComments.addComment();
    comment.setAuthor("test A1 author");
    comment.setRow(0);
    comment.setColumn((short)0);
   
    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("test A1 author", sheetComments.getAuthor(commentList.getCommentArray(0).getAuthorId()));
    assertEquals("test A1 author", comment.getAuthor());
   
    // Change the author, check it updates
    comment.setAuthor("Another Author");
    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("Another Author", comment.getAuthor());
  }
View Full Code Here

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

        }
        assertNotNull(ct);
    assertEquals(2, ct.getNumberOfComments());
    assertEquals(1, ct.getNumberOfAuthors());

    XSSFComment comment = ct.findCellComment("C5");
   
    assertEquals("Nick Burch", comment.getAuthor());
    assertEquals("Nick Burch:\nThis is a comment", comment.getString().getString());

        wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
        rels = wb.getSheetAt(0).getRelations();
        ct = null;
        for(POIXMLDocumentPart p : rels) {
            if(p instanceof CommentsTable){
                ct = (CommentsTable)p;
                break;
            }
        }
        assertNotNull(ct);

    assertEquals(2, ct.getNumberOfComments());
    assertEquals(1, ct.getNumberOfAuthors());
   
    comment = ct.findCellComment("C5");
   
    assertEquals("Nick Burch", comment.getAuthor());
   
    assertEquals("Nick Burch:\nThis is a comment", comment.getString().getString());
  }
View Full Code Here

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

             // Main cell contents
             xhtml.characters(formattedValue);

             // Comments
             if(comments != null) {
                XSSFComment comment = comments.findCellComment(cellRef);
                if(comment != null) {
                   xhtml.startElement("br");
                   xhtml.endElement("br");
                   xhtml.characters(comment.getAuthor());
                   xhtml.characters(": ");
                   xhtml.characters(comment.getString().getString());
                }
             }

             xhtml.endElement("td");
          } catch(SAXException e) {}
View Full Code Here

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

        return addNewAuthor(author);
    }

    public XSSFComment findCellComment(String cellRef) {
        CTComment ct = getCTComment(cellRef);
        return ct == null ? null : new XSSFComment(this, ct, null);
    }
View Full Code Here

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

                   break;
           }
          
           // Do we have a comment for this cell?
           checkForEmptyCellComments(EmptyCellCommentsCheckType.CELL);
           XSSFComment comment = commentsTable != null ? commentsTable.findCellComment(cellRef) : null;
          
           // Output
           output.cell(cellRef, thisStr, comment);
       } else if ("f".equals(name)) {
          fIsOpen = false;
View Full Code Here

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

   /**
    * Output an empty-cell comment.
    */
   private void outputEmptyCellComment(CellReference cellRef) {
       String cellRefString = cellRef.formatAsString();
       XSSFComment comment = commentsTable.findCellComment(cellRefString);
       output.cell(cellRefString, null, comment);
   }
View Full Code Here

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

        return addNewAuthor(author);
    }

    public XSSFComment findCellComment(String cellRef) {
        CTComment ct = getCTComment(cellRef);
        return ct == null ? null : new XSSFComment(this, ct, null);
    }
View Full Code Here

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

        sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

    CTCommentList commentList = sheetComments.getCTComments().addNewCommentList();
    assertEquals(0, commentList.sizeOfCommentArray());
   
    XSSFComment comment = sheetComments.addComment();
    comment.setAuthor("test A1 author");
    comment.setRow(0);
    comment.setColumn((short)0);
   
    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("test A1 author", sheetComments.getAuthor(commentList.getCommentArray(0).getAuthorId()));
    assertEquals("test A1 author", comment.getAuthor());
   
    // Change the author, check it updates
    comment.setAuthor("Another Author");
    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("Another Author", comment.getAuthor());
  }
View Full Code Here

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

        }
        assertNotNull(ct);
    assertEquals(2, ct.getNumberOfComments());
    assertEquals(1, ct.getNumberOfAuthors());

    XSSFComment comment = ct.findCellComment("C5");
   
    assertEquals("Nick Burch", comment.getAuthor());
    assertEquals("Nick Burch:\nThis is a comment", comment.getString().getString());

        wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
        rels = wb.getSheetAt(0).getRelations();
        ct = null;
        for(POIXMLDocumentPart p : rels) {
            if(p instanceof CommentsTable){
                ct = (CommentsTable)p;
                break;
            }
        }
        assertNotNull(ct);

    assertEquals(2, ct.getNumberOfComments());
    assertEquals(1, ct.getNumberOfAuthors());
   
    comment = ct.findCellComment("C5");
   
    assertEquals("Nick Burch", comment.getAuthor());
   
    assertEquals("Nick Burch:\nThis is a comment", comment.getString().getString());
  }
View Full Code Here

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

    sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

    CTCommentList commentList = sheetComments.getCTComments().addNewCommentList();
    assertEquals(0, commentList.sizeOfCommentArray());

    XSSFComment comment = sheetComments.addComment();
    comment.setAuthor("test A1 author");
    comment.setRow(0);
    comment.setColumn((short)0);

    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("test A1 author", sheetComments.getAuthor(commentList.getCommentArray(0).getAuthorId()));
    assertEquals("test A1 author", comment.getAuthor());

    // Change the author, check it updates
    comment.setAuthor("Another Author");
    assertEquals(1, commentList.sizeOfCommentArray());
    assertEquals("Another Author", comment.getAuthor());
  }
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.