java.lang.Object
com.aspose.cells.Comment
public class Comment
Example:
Workbook workbook = new Workbook();
CommentCollection comments = workbook.getWorksheets().get(0).getComments();
//Add comment to cell A1
int commentIndex1 = comments.add(0, 0);
Comment comment1 = comments.get(commentIndex1);
comment1.setNote("First note.");
comment1.getFont().setName("Times New Roman");
//Add comment to cell B2
comments.add("B2");
Comment comment2 = comments.get("B2");
comment2.setNote("Second note.");
//do your business
//Save the excel file.
workbook.save("exmaple.xlsx");
| Property Getters/Setters Summary | ||
|---|---|---|
java.lang.String | getAuthor() | |
void | setAuthor(java.lang.String) | |
| Gets and sets Name of the original comment author | ||
boolean | getAutoSize() | |
void | setAutoSize(boolean) | |
| Indicates if size of comment is adjusted automatically according to its content. | ||
int | getColumn() | |
| Gets the column index of the comment. | ||
CommentShape | getCommentShape() | |
| Get a Shape object that represents the shape attached to the specified comment. | ||
Font | getFont() | |
| Gets the font of comment. | ||
int | getHeight() | |
void | setHeight(int) | |
| Represents the Height of the comment, in unit of pixels. | ||
double | getHeightCM() | |
void | setHeightCM(double) | |
| Represents the height of the comment, in unit of centimeters. | ||
double | getHeightInch() | |
void | setHeightInch(double) | |
| Represents the height of the comment, in unit of inches. | ||
java.lang.String | getHtmlNote() | |
void | setHtmlNote(java.lang.String) | |
| Gets and sets the html string which contains data and some formats in this comment. | ||
boolean | isThreadedComment() | |
| Indicates whether this comment is a threaded comment. | ||
boolean | isVisible() | |
void | setVisible(boolean) | |
| Represents if the comment is visible or not. | ||
java.lang.String | getNote() | |
void | setNote(java.lang.String) | |
| Represents the content of comment. | ||
int | getRow() | |
| Gets the row index of the comment. | ||
int | getTextHorizontalAlignment() | |
void | setTextHorizontalAlignment(int) | |
| Gets and sets the text horizontal alignment type of the comment. The value of the property is TextAlignmentType integer constant. | ||
int | getTextOrientationType() | |
void | setTextOrientationType(int) | |
| Gets and sets the text orientation type of the comment. The value of the property is TextOrientationType integer constant. | ||
int | getTextVerticalAlignment() | |
void | setTextVerticalAlignment(int) | |
| Gets and sets the text vertical alignment type of the comment. The value of the property is TextAlignmentType integer constant. | ||
ThreadedCommentCollection | getThreadedComments() | |
| Gets the list of threaded comments; | ||
int | getWidth() | |
void | setWidth(int) | |
| Represents the width of the comment, in unit of pixels. | ||
double | getWidthCM() | |
void | setWidthCM(double) | |
| Represents the width of the comment, in unit of centimeters. | ||
double | getWidthInch() | |
void | setWidthInch(double) | |
| Represents the width of the comment, in unit of inches. | ||
| Method Summary | ||
|---|---|---|
FontSetting | characters(int startIndex, int length) | |
| Returns a Characters object that represents a range of characters within the comment text. | ||
void | formatCharacters(int startIndex, int length, Font font, StyleFlag flag) | |
| Format some characters with the font setting. | ||
java.util.ArrayList | getCharacters() | |
| Returns all Characters objects that represents a range of characters within the comment text. | ||
| Property Getters/Setters Detail |
|---|
getAuthor/setAuthor | |
public java.lang.String getAuthor() / public void setAuthor(java.lang.String value) | |
Example:
comment1.setAuthor("Carl.Yang");getCommentShape | |
public CommentShape getCommentShape() | |
Example:
CommentShape shape = comment1.getCommentShape(); int w = shape.getWidth(); int h = shape.getHeight();
getRow | |
public int getRow() | |
Example:
int row = comment1.getRow();
getColumn | |
public int getColumn() | |
Example:
int column = comment1.getColumn();
isThreadedComment | |
public boolean isThreadedComment() | |
Example:
if(comment1.isThreadedComment())
{
//This comment is a threaded comment.
}getThreadedComments | |
public ThreadedCommentCollection getThreadedComments() | |
Example:
ThreadedCommentCollection threadedComments = comment1.getThreadedComments();
for (int i = 0; i < threadedComments.getCount(); ++i)
{
ThreadedComment tc = threadedComments.get(i);
String note = tc.getNotes();
}getNote/setNote | |
public java.lang.String getNote() / public void setNote(java.lang.String value) | |
Example:
comment1.setNote("First note.");getHtmlNote/setHtmlNote | |
public java.lang.String getHtmlNote() / public void setHtmlNote(java.lang.String value) | |
Example:
comment1.setHtmlNote("<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>This is a <b>test</b>.</Font>");getFont | |
public Font getFont() | |
Example:
Font font = comment1.getFont(); font.setSize(12);
isVisible/setVisible | |
public boolean isVisible() / public void setVisible(boolean value) | |
Example:
if(comment1.isVisible())
{
//The comment is visible
}getTextOrientationType/setTextOrientationType | |
public int getTextOrientationType() / public void setTextOrientationType(int value) | |
Example:
if(comment1.getTextOrientationType() == TextOrientationType.NO_ROTATION)
{
comment1.setTextOrientationType(TextOrientationType.TOP_TO_BOTTOM);
}getTextHorizontalAlignment/setTextHorizontalAlignment | |
public int getTextHorizontalAlignment() / public void setTextHorizontalAlignment(int value) | |
Example:
if (comment1.getTextHorizontalAlignment() == TextAlignmentType.FILL)
{
comment1.setTextHorizontalAlignment(TextAlignmentType.CENTER);
}getTextVerticalAlignment/setTextVerticalAlignment | |
public int getTextVerticalAlignment() / public void setTextVerticalAlignment(int value) | |
Example:
if (comment1.getTextVerticalAlignment() == TextAlignmentType.FILL)
{
comment1.setTextVerticalAlignment(TextAlignmentType.CENTER);
}getAutoSize/setAutoSize | |
public boolean getAutoSize() / public void setAutoSize(boolean value) | |
Example:
if(!comment1.getAutoSize())
{
//The size of the comment varies with the content
comment1.setAutoSize(true);
}getHeightCM/setHeightCM | |
public double getHeightCM() / public void setHeightCM(double value) | |
Example:
comment1.setHeightCM(1.0);
getWidthCM/setWidthCM | |
public double getWidthCM() / public void setWidthCM(double value) | |
Example:
comment1.setWidthCM(1.0);
getWidth/setWidth | |
public int getWidth() / public void setWidth(int value) | |
Example:
comment1.setWidth(10);
getHeight/setHeight | |
public int getHeight() / public void setHeight(int value) | |
Example:
comment1.setHeight(10);
getWidthInch/setWidthInch | |
public double getWidthInch() / public void setWidthInch(double value) | |
Example:
comment1.setWidthInch(1.0);
getHeightInch/setHeightInch | |
public double getHeightInch() / public void setHeightInch(double value) | |
Example:
comment1.setHeightInch(1.0);
| Method Detail |
|---|
formatCharacters | |
public void formatCharacters(int startIndex, int length, Font font, StyleFlag flag) throws java.lang.Exception | |
startIndex - The start index.length - The length.font - The font setting.flag - The flag of the font setting.characters | |
public FontSetting characters(int startIndex, int length) | |
startIndex - The index of the start of the character.length - The number of characters.Example:
FontSetting fontSetting = comment1.characters(0, 4);
getCharacters | |
public java.util.ArrayList getCharacters()
throws java.lang.Exception | |
Example:
ArrayList list = comment1.getCharacters();