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

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


    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

        }
        return addNewAuthor(author);
    }

    public XSSFComment findCellComment(String cellRef) {
        CTComment ct = getCTComment(cellRef);
        return ct == null ? null : new XSSFComment(this, ct, null);
    }
View Full Code Here

        // Return the comment, or null if not known
        return commentRefs.get(cellRef);
    }

    public CTComment newComment() {
        CTComment ct = comments.getCommentList().addNewComment();
        ct.setRef("A1");
        ct.setAuthorId(0);
       
        if(commentRefs != null) {
           commentRefs.put(ct.getRef(), ct);
        }
        return ct;
    }
View Full Code Here

    }

    public boolean removeComment(String cellRef) {
        CTCommentList lst = comments.getCommentList();
        if(lst != null) for(int i=0; i < lst.sizeOfCommentArray(); i++) {
            CTComment comment = lst.getCommentArray(i);
            if (cellRef.equals(comment.getRef())) {
                lst.removeComment(i);
               
                if(commentRefs != null) {
                   commentRefs.remove(cellRef);
                }
View Full Code Here

        if (sheetComments == null) {
            return null;
        }

        String ref = new CellReference(row, column).formatAsString();
        CTComment ctComment = sheetComments.getCTComment(ref);
        if(ctComment == null) return null;

        XSSFVMLDrawing vml = getVMLDrawing(false);
        return new XSSFComment(sheetComments, ctComment,
                vml == null ? null : vml.findCommentShape(row, column));
View Full Code Here

        }
        return addNewAuthor(author);
    }

    public XSSFComment findCellComment(String cellRef) {
        CTComment ct = getCTComment(cellRef);
        return ct == null ? null : new XSSFComment(this, ct, null);
    }
View Full Code Here

        // Return the comment, or null if not known
        return commentRefs.get(cellRef);
    }

    public CTComment newComment() {
        CTComment ct = comments.getCommentList().addNewComment();
        ct.setRef("A1");
        ct.setAuthorId(0);
       
        if(commentRefs != null) {
           commentRefs.put(ct.getRef(), ct);
        }
        return ct;
    }
View Full Code Here

    }

    public boolean removeComment(String cellRef) {
        CTCommentList lst = comments.getCommentList();
        if(lst != null) for(int i=0; i < lst.sizeOfCommentArray(); i++) {
            CTComment comment = lst.getCommentArray(i);
            if (cellRef.equals(comment.getRef())) {
                lst.removeComment(i);
               
                if(commentRefs != null) {
                   commentRefs.remove(cellRef);
                }
View Full Code Here

    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();
    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
    assertSame(comment0, sheetComments.getCTComment("A1"));
    assertSame(comment1, sheetComments.getCTComment("A2"));
    assertNull(sheetComments.getCTComment("A3"));
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.