Examples of CTComment


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

    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

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

        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

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

        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

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

    }

    public void testGetAuthor() throws Exception {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        CTComments ctComments = CTComments.Factory.newInstance();
        CTComment ctComment = ctComments.addNewCommentList().addNewComment();
        CTAuthors ctAuthors = ctComments.addNewAuthors();
        ctAuthors.insertAuthor(0, TEST_AUTHOR);
        ctComment.setAuthorId(0);
        doc.setComments(ctComments);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
View Full Code Here

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

        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

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

        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

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

        assertEquals(19, comment.getRow());
    }

    public void testSetAuthor() {
        CommentsTable sheetComments = new CommentsTable();
        CTComment ctComment = CTComment.Factory.newInstance();
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        comment.setAuthor(TEST_AUTHOR);
        assertEquals(TEST_AUTHOR, comment.getAuthor());
    }
View Full Code Here

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

        assertEquals(TEST_AUTHOR, comment.getAuthor());
    }

    public void testSetString() {
        CommentsTable sheetComments = new CommentsTable();
        CTComment ctComment = CTComment.Factory.newInstance();
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        RichTextString richTextString = new HSSFRichTextString(TEST_RICHTEXTSTRING);
        comment.setString(richTextString);
        assertEquals(TEST_RICHTEXTSTRING, ctComment.getText().getT());
    }
View Full Code Here

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

    CTComments comments = sheetComments.getCTComments();
    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

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

        assertNotNull(sheetComments.getCTComments().getCommentList());
        assertNotNull(sheetComments.getCTComments().getAuthors());
        assertEquals(1, sheetComments.getCTComments().getAuthors().sizeOfAuthorArray());
        assertEquals(1, sheetComments.getNumberOfAuthors());

        CTComment ctComment = sheetComments.newComment();
        CTShape vmlShape = CTShape.Factory.newInstance();

        XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape);
        assertEquals(null, comment.getString());
        assertEquals(0, comment.getRow());
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.