Package org.openxmlformats.schemas.spreadsheetml.x2006.main

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


        assertEquals("Tahoma", rPr.getRFontArray(0).getVal());
    }

    public void testAuthor() {
        CommentsTable sheetComments = new CommentsTable();
        CTComment ctComment = sheetComments.newComment("A1");

        assertEquals(1, sheetComments.getNumberOfAuthors());
        XSSFComment comment = new XSSFComment(sheetComments, ctComment, null);
        assertEquals("", comment.getAuthor());
        comment.setAuthor("Apache POI");
View Full Code Here


        CTComments ctComments = CTComments.Factory.newInstance();
        CommentsTable sheetComments = new CommentsTable(ctComments);
        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook, sheetComments);
        assertNotNull(sheet);
       
        CTComment ctComment = ctComments.addNewCommentList().insertNewComment(0);
        ctComment.setRef("C10");
        ctComment.setAuthorId(sheetComments.findAuthor("test C10 author"));
       
        assertNotNull(sheet.getCellComment(9, 2));
        assertEquals("test C10 author", sheet.getCellComment(9, 2).getAuthor());
    }
View Full Code Here

        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());
        assertEquals(TEST_C10_AUTHOR, sheet.getRow(9).getCell((short)2).getCellComment().getAuthor());
        assertNull(sheet.getRow(9).getCell((short)3).getCellComment());
View Full Code Here

    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();
    ctrst0.setT(TEST_A1_TEXT);
    comment0.setText(ctrst0);
    CTComment comment1 = commentList.insertNewComment(0);
    comment1.setRef("A2");
    CTRst ctrst1 = CTRst.Factory.newInstance();
    ctrst1.setT(TEST_A2_TEXT);
    comment1.setText(ctrst1);
   
    // test finding the right comment for a cell
    assertEquals(TEST_A1_TEXT, sheetComments.findCellComment("A1").getString().getString());
    assertEquals(TEST_A1_TEXT, sheetComments.findCellComment(0, 0).getString().getString());
    assertEquals(TEST_A2_TEXT, sheetComments.findCellComment("A2").getString().getString());
View Full Code Here

  public void testConstructors() {
    CommentsTable sheetComments = new CommentsTable();
    XSSFComment comment = sheetComments.addComment();
    assertNotNull(comment);
   
    CTComment ctComment = CTComment.Factory.newInstance();
    XSSFComment comment2 = new XSSFComment(sheetComments, ctComment);
    assertNotNull(comment2);
  }
View Full Code Here

    assertNotNull(comment2);
  }
 
  public void testGetColumn() {
    CommentsTable sheetComments = new CommentsTable();
    CTComment ctComment = CTComment.Factory.newInstance();
    ctComment.setRef("A1");
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
    assertNotNull(comment);
    assertEquals(0, comment.getColumn());
    ctComment.setRef("C10");
    assertEquals(2, comment.getColumn());
  }
View Full Code Here

    assertEquals(2, comment.getColumn());
  }
 
  public void testGetRow() {
    CommentsTable sheetComments = new CommentsTable();
    CTComment ctComment = CTComment.Factory.newInstance();
    ctComment.setRef("A1");
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
    assertNotNull(comment);
    assertEquals(0, comment.getRow());
    ctComment.setRef("C10");
    assertEquals(9, comment.getRow());
  }
View Full Code Here

    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);
    assertNotNull(comment);
    assertEquals(TEST_AUTHOR, comment.getAuthor());
View Full Code Here

    assertEquals(TEST_AUTHOR, comment.getAuthor());
  }
 
  public void testSetColumn() {
    CommentsTable sheetComments = new CommentsTable();
    CTComment ctComment = CTComment.Factory.newInstance();
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
    comment.setColumn((short)3);
    assertEquals(3, comment.getColumn());
    assertEquals(3, (new CellReference(ctComment.getRef()).getCol()));
    assertEquals("D1", ctComment.getRef());

    comment.setColumn((short)13);
    assertEquals(13, comment.getColumn());
  }
View Full Code Here

    assertEquals(13, comment.getColumn());
  }
 
  public void testSetRow() {
    CommentsTable sheetComments = new CommentsTable();
    CTComment ctComment = CTComment.Factory.newInstance();
    XSSFComment comment = new XSSFComment(sheetComments, ctComment);
    comment.setRow(20);
    assertEquals(20, comment.getRow());
    assertEquals(20, (new CellReference(ctComment.getRef()).getRow()));
    assertEquals("A21", ctComment.getRef());

    comment.setRow(19);
    assertEquals(19, comment.getRow());
  }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment

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.