Aspose::Cells::Comment class
Contents
[
Hide
]Comment class
Encapsulates the object that represents a cell comment.
class Comment
Methods
| Method | Description |
|---|---|
| Characters(int32_t startIndex, int32_t length) | Returns a Characters object that represents a range of characters within the comment text. |
| Comment(Comment_Impl* impl) | Constructs from an implementation object. |
| Comment(const Comment& src) | Copy constructor. |
| FormatCharacters(int32_t startIndex, int32_t length, const Aspose::Cells::Font& font, const StyleFlag& flag) | Format some characters with the font setting. |
| GetAuthor() | Gets and sets Name of the original comment author. |
| GetAutoSize() | Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize(). |
| GetColumn() | Gets the column index of the comment. |
| GetCommentShape() | Get a Shape object that represents the shape attached to the specified comment. |
| GetFont() | Gets the font of comment. |
| GetHeight() | Represents the Height of the comment, in unit of pixels. |
| GetHeightCM() | Represents the height of the comment, in unit of centimeters. |
| GetHeightInch() | Represents the height of the comment, in unit of inches. |
| GetHtmlNote() | Gets and sets the html string which contains data and some formats in this comment. |
| GetNote() | Represents the content of comment. |
| GetRichFormattings() | Returns all Characters objects that represents a range of characters within the comment text. |
| GetRow() | Gets the row index of the comment. |
| GetTextHorizontalAlignment() | Gets and sets the text horizontal alignment type of the comment. |
| GetTextOrientationType() | Gets and sets the text orientation type of the comment. |
| GetTextVerticalAlignment() | Gets and sets the text vertical alignment type of the comment. |
| GetThreadedComments() | Gets the list of threaded comments;. |
| GetWidth() | Represents the width of the comment, in unit of pixels. |
| GetWidthCM() | Represents the width of the comment, in unit of centimeters. |
| GetWidthInch() | Represents the width of the comment, in unit of inches. |
| IsNull() const | Checks whether the implementation object is nullptr. |
| IsThreadedComment() | Indicates whether this comment is a threaded comment. |
| IsVisible() | Represents if the comment is visible or not. |
| explicit operator bool() const | operator bool() |
| operator=(const Comment& src) | operator= |
| SetAuthor(const U16String& value) | Gets and sets Name of the original comment author. |
| SetAuthor(const char16_t* value) | Gets and sets Name of the original comment author. |
| SetAutoSize(bool value) | Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize(). |
| SetHeight(int32_t value) | Represents the Height of the comment, in unit of pixels. |
| SetHeightCM(double value) | Represents the height of the comment, in unit of centimeters. |
| SetHeightInch(double value) | Represents the height of the comment, in unit of inches. |
| SetHtmlNote(const U16String& value) | Gets and sets the html string which contains data and some formats in this comment. |
| SetHtmlNote(const char16_t* value) | Gets and sets the html string which contains data and some formats in this comment. |
| SetIsVisible(bool value) | Represents if the comment is visible or not. |
| SetNote(const U16String& value) | Represents the content of comment. |
| SetNote(const char16_t* value) | Represents the content of comment. |
| SetTextHorizontalAlignment(TextAlignmentType value) | Gets and sets the text horizontal alignment type of the comment. |
| SetTextOrientationType(TextOrientationType value) | Gets and sets the text orientation type of the comment. |
| SetTextVerticalAlignment(TextAlignmentType value) | Gets and sets the text vertical alignment type of the comment. |
| SetWidth(int32_t value) | Represents the width of the comment, in unit of pixels. |
| SetWidthCM(double value) | Represents the width of the comment, in unit of centimeters. |
| SetWidthInch(double value) | Represents the width of the comment, in unit of inches. |
| ~Comment() | Destructor. |
Fields
| Field | Description |
|---|---|
| _impl | The implementation object. |
Examples
Aspose::Cells::Startup();
Workbook 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(u"First note.");
comment1.GetFont().SetName(u"Times New Roman");
//Add comment to cell B2
comments.Add(u"B2");
Comment comment2 = comments.Get("B2");
comment2.SetNote(u"Second note.");
//Save the excel file.
workbook.Save(u"exmaple.xlsx");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells
- Library Aspose.Cells for C++