Examples of CTComments


Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

        XSSFWorkbook workbook = new XSSFWorkbook();
        CTSheet ctSheet = CTSheet.Factory.newInstance();
        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook);
        Cell cell = sheet.createRow(0).createCell((short)0);
        CTComments ctComments = CTComments.Factory.newInstance();
        CommentsTable comments = new CommentsTable(ctComments);
        XSSFComment comment = comments.addComment();
       
        sheet.setCellComment("A1", comment);
        assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef());
        comment.setAuthor("test A1 author");
        assertEquals("test A1 author", comments.getAuthor(ctComments.getCommentList().getCommentArray(0).getAuthorId()));
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

   
    public void testGetCellComment() {
        XSSFWorkbook workbook = new XSSFWorkbook();
        CTSheet ctSheet = CTSheet.Factory.newInstance();
        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
        CTComments ctComments = CTComments.Factory.newInstance();
        CommentsTable sheetComments = new CommentsTable(ctComments);
        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook, sheetComments);
        assertNotNull(sheet);
       
        // Create C10 cell
        Row row = sheet.createRow(9);
        Cell cell = row.createCell((short)2);
        Cell cell3 = row.createCell((short)3);
       
       
        // Set a comment for C10 cell
        CTComment ctComment = ctComments.addNewCommentList().insertNewComment(0);
        ctComment.setRef("C10");
        ctComment.setAuthorId(sheetComments.findAuthor(TEST_C10_AUTHOR));
       
        assertNotNull(sheet.getRow(9).getCell((short)2));
        assertNotNull(sheet.getRow(9).getCell((short)2).getCellComment());
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

   
    public void testSetCellComment() {
        XSSFWorkbook workbook = new XSSFWorkbook();
        CTSheet ctSheet = CTSheet.Factory.newInstance();
        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
        CTComments ctComments = CTComments.Factory.newInstance();
        CommentsTable comments = new CommentsTable(ctComments);
        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook, comments);
        assertNotNull(sheet);
       
        // Create C10 cell
        Row row = sheet.createRow(9);
        Cell cell = row.createCell((short)2);
        Cell cell3 = row.createCell((short)3);
       
        // Create a comment
        Comment comment = comments.addComment();
        comment.setAuthor(TEST_C10_AUTHOR);
       
        // Set a comment for C10 cell
        cell.setCellComment(comment);
       
        CTCell ctCell = ctWorksheet.getSheetData().getRowArray(0).getCArray(0);
    assertNotNull(ctCell);
    assertEquals("C10", ctCell.getR());
    long authorId = ctComments.getCommentList().getCommentArray(0).getAuthorId();
    assertEquals(TEST_C10_AUTHOR, comments.getAuthor(authorId));
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

  private static final String TEST_A2_TEXT = "test A2 text";
  private static final String TEST_A1_TEXT = "test A1 text";
  private static final String TEST_AUTHOR = "test author";

  public void testfindAuthor() {
    CTComments comments = CTComments.Factory.newInstance();
    CommentsTable sheetComments = new CommentsTable(comments);

    assertEquals(0, sheetComments.findAuthor(TEST_AUTHOR));
    assertEquals(1, sheetComments.findAuthor("another author"));
    assertEquals(0, sheetComments.findAuthor(TEST_AUTHOR));
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

    assertEquals(2, sheetComments.findAuthor("YAA"));
    assertEquals(1, sheetComments.findAuthor("another author"));
  }
 
  public void testGetCellComment() {
    CTComments comments = CTComments.Factory.newInstance();
    CommentsTable sheetComments = new CommentsTable(comments);
    CTCommentList commentList = comments.addNewCommentList();
   
    // Create 2 comments for A1 and A" cells
    CTComment comment0 = commentList.insertNewComment(0);
    comment0.setRef("A1");
    CTRst ctrst0 = CTRst.Factory.newInstance();
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

    assertNull(sheetComments.findCellComment("A3"));
    assertNull(sheetComments.findCellComment(2, 0));
  }
 
  public void testAddCellComment() {
    CTComments comments = CTComments.Factory.newInstance();
    CommentsTable sheetComments = new CommentsTable(comments);
    CTCommentList commentList = comments.addNewCommentList();
    assertEquals(0, commentList.sizeOfCommentArray());
   
    XSSFComment comment = sheetComments.addComment();
    comment.setAuthor("test A1 author");
    comment.setRow(0);
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

    ctComment.setRef("C10");
    assertEquals(9, comment.getRow());
  }
 
  public void testGetAuthor() {
    CTComments ctComments = CTComments.Factory.newInstance();
    CTComment ctComment = ctComments.addNewCommentList().addNewComment();
    CTAuthors ctAuthors = ctComments.addNewAuthors();
    ctAuthors.insertAuthor(0, TEST_AUTHOR);
    ctComment.setAuthorId(0);

    CommentsTable sheetComments = new CommentsTable(ctComments);
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

  }

  public void testGetCellComment() throws Exception {
    CommentsTable sheetComments = new CommentsTable();

    CTComments comments = sheetComments.getCTComments();
    CTCommentList commentList = comments.getCommentList();

    // Create 2 comments for A1 and A" cells
    CTComment comment0 = commentList.insertNewComment(0);
    comment0.setRef("A1");
    CTRst ctrst0 = CTRst.Factory.newInstance();
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

  }

  public void testGetCellComment() throws Exception {
    CommentsTable sheetComments = new CommentsTable();

    CTComments comments = sheetComments.getCTComments();
    CTCommentList commentList = comments.getCommentList();

    // Create 2 comments for A1 and A" cells
    CTComment comment0 = commentList.insertNewComment(0);
    comment0.setRef("A1");
    CTRst ctrst0 = CTRst.Factory.newInstance();
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments

        XSSFDrawing dg = sheet.createDrawingPatriarch();
        XSSFComment comment = dg.createCellComment(new XSSFClientAnchor());

        Cell cell = sheet.createRow(0).createCell(0);
        CommentsTable comments = sheet.getCommentsTable(false);
        CTComments ctComments = comments.getCTComments();

        cell.setCellComment(comment);
        assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef());
        comment.setAuthor("test A1 author");
        assertEquals("test A1 author", comments.getAuthor((int) ctComments.getCommentList().getCommentArray(0).getAuthorId()));
    }
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.