Package org.apache.poi.xssf.model

Examples of org.apache.poi.xssf.model.CommentsTable


        ctComment.setRef("C10");
        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());
View Full Code Here


        doc.setComments(ctComments);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);

        CommentsTable sheetComments = new CommentsTable();
        sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        assertEquals(TEST_AUTHOR, comment.getAuthor());
    }
View Full Code Here

        XSSFComment comment = new XSSFComment(sheetComments, 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()));
View Full Code Here

        comment.setColumn((short)13);
        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()));
View Full Code Here

        comment.setRow(19);
        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

        comment.setAuthor(TEST_AUTHOR);
        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

        XSSFSheet sheet = workbook.createSheet();

        XSSFComment comment = sheet.createComment();

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

        sheet.setCellComment("A1", 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

    private static final String TEST_RICHTEXTSTRING = "test richtextstring";
    private static final String TEST_AUTHOR = "test_author";

    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

        XSSFComment comment2 = new XSSFComment(sheetComments, 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());
View Full Code Here

        ctComment.setRef("C10");
        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());
View Full Code Here

TOP

Related Classes of org.apache.poi.xssf.model.CommentsTable

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.