public void GetCellComment() { CommentsTable sheetComments = new CommentsTable(); CT_Comments comments = sheetComments.GetCTComments(); CT_CommentList commentList = comments.commentList; // Create 2 comments for A1 and A" cells CT_Comment comment0 = commentList.InsertNewComment(0); comment0.@ref = "A1"; CT_Rst ctrst0 = new CT_Rst(); ctrst0.t = (TEST_A1_TEXT); comment0.text = (ctrst0); CT_Comment comment1 = commentList.InsertNewComment(0); comment1.@ref = ("A2"); CT_Rst ctrst1 = new CT_Rst(); ctrst1.t = (TEST_A2_TEXT); comment1.text = (ctrst1); // Test Finding the right comment for a cell Assert.AreSame(comment0, sheetComments.GetCTComment("A1")); Assert.AreSame(comment1, sheetComments.GetCTComment("A2")); Assert.IsNull(sheetComments.GetCTComment("A3")); }
/** * Remove the comment at cellRef location, if one exists * * @param cellRef the location of the comment to remove * @return returns true if a comment was removed */ public bool RemoveComment(CellAddress cellRef) { String stringRef = cellRef.FormatAsString(); CT_CommentList lst = comments.commentList; if (lst != null) { CT_Comment[] commentArray = lst.GetCommentArray(); for (int i = 0; i < commentArray.Length; i++) { CT_Comment comment = commentArray[i]; if (stringRef.Equals(comment.@ref)) { lst.RemoveComment(i); if (commentRefs != null) { commentRefs.Remove(cellRef); } return(true); } } } return(false); }
public bool RemoveComment(string cellRef) { CT_CommentList commentList = this.comments.commentList; if (commentList != null) { for (int index = 0; index < commentList.SizeOfCommentArray(); ++index) { CT_Comment commentArray = commentList.GetCommentArray(index); if (cellRef.Equals(commentArray.@ref)) { commentList.RemoveComment(index); if (this.commentRefs != null) { this.commentRefs.Remove(cellRef); } return(true); } } } return(false); }
public bool RemoveComment(String cellRef) { CT_CommentList lst = comments.commentList; if (lst != null) { for (int i = 0; i < lst.SizeOfCommentArray(); i++) { CT_Comment comment = lst.GetCommentArray(i); if (cellRef.Equals(comment.@ref)) { lst.RemoveComment(i); if (commentRefs != null) { commentRefs.Remove(cellRef); } return(true); } } } return(false); }