Package org.openxmlformats.schemas.wordprocessingml.x2006.main

Examples of org.openxmlformats.schemas.wordprocessingml.x2006.main.CommentsDocument


        readFrom(part.getInputStream());
    }

    public void readFrom(InputStream is) throws IOException {
        try {
            CommentsDocument doc = CommentsDocument.Factory.parse(is);
            comments = doc.getComments();
        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
View Full Code Here


        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
    public void writeTo(OutputStream out) throws IOException {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        doc.setComments(comments);
        doc.save(out, DEFAULT_XML_OPTIONS);
    }
View Full Code Here

        readFrom(part.getInputStream());
    }

    public void readFrom(InputStream is) throws IOException {
        try {
            CommentsDocument doc = CommentsDocument.Factory.parse(is);
            comments = doc.getComments();
        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
View Full Code Here

        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
    public void writeTo(OutputStream out) throws IOException {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        doc.setComments(comments);
        doc.save(out, DEFAULT_XML_OPTIONS);
    }
View Full Code Here

        ctComment.setRef("C10");
        assertEquals(9, comment.getRow());
    }

    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);

        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

        ctComment.setRef("C10");
        assertEquals(9, comment.getRow());
    }

    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);

        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

  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() throws Exception {
    CommentsDocument doc = CommentsDocument.Factory.newInstance();
    doc.setComments(CTComments.Factory.newInstance());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
    CommentsTable sheetComments = new CommentsTable();
    sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

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

    assertEquals(2, sheetComments.findAuthor("YAA"));
    assertEquals(1, sheetComments.findAuthor("another author"));
  }

  public void testGetCellComment() throws Exception {
    CommentsDocument doc = CommentsDocument.Factory.newInstance();
    doc.setComments(CTComments.Factory.newInstance());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
    CommentsTable sheetComments = new CommentsTable();
    sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));


    CTComments comments = sheetComments.getCTComments();
View Full Code Here

    assertNull(sheetComments.findCellComment("A3"));
    assertNull(sheetComments.findCellComment(2, 0));
  }

  public void testAddCellComment() throws Exception {
    CommentsDocument doc = CommentsDocument.Factory.newInstance();
    doc.setComments(CTComments.Factory.newInstance());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
    CommentsTable sheetComments = new CommentsTable();
    sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

    CTCommentList commentList = sheetComments.getCTComments().addNewCommentList();
    assertEquals(0, commentList.sizeOfCommentArray());
View Full Code Here

        readFrom(part.getInputStream());
    }

    public void readFrom(InputStream is) throws IOException {
        try {
            CommentsDocument doc = CommentsDocument.Factory.parse(is);
            comments = doc.getComments();
        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.wordprocessingml.x2006.main.CommentsDocument

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.