Comment class
Comment class
Encapsulates the object that represents a cell comment.
The Comment type exposes the following members:
Properties
| Property | Description |
|---|---|
| author | Gets and sets Name of the original comment author |
| comment_shape | Get a Shape object that represents the shape attached to the specified comment. |
| row | Gets the row index of the comment. |
| column | Gets the column index of the comment. |
| is_threaded_comment | Indicates whether this comment is a threaded comment. |
| threaded_comments | Gets the list of threaded comments; |
| note | Represents the content of comment. |
| html_note | Gets and sets the html string which contains data and some formats in this comment. |
| font | Gets the font of comment. |
| is_visible | Represents if the comment is visible or not. |
| text_orientation_type | Gets and sets the text orientation type of the comment. |
| text_horizontal_alignment | Gets and sets the text horizontal alignment type of the comment. |
| text_vertical_alignment | Gets and sets the text vertical alignment type of the comment. |
| auto_size | 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(). |
| height_cm | Represents the height of the comment, in unit of centimeters. |
| width_cm | Represents the width of the comment, in unit of centimeters. |
| width | Represents the width of the comment, in unit of pixels. |
| height | Represents the Height of the comment, in unit of pixels. |
| width_inch | Represents the width of the comment, in unit of inches. |
| height_inch | Represents the height of the comment, in unit of inches. |
Methods
| Method | Description |
|---|---|
format_characters(self, start_index, length, font, flag) | Format some characters with the font setting. |
characters(self, start_index, length) | Returns a Characters object that represents a range of characters within the comment text. |
get_characters(self) | Returns all Characters objects that represents a range of characters within the comment text. |
get_rich_formattings(self) | Returns all Characters objects that represents a range of characters within the comment text. |
Example
from aspose.cells import Workbook
workbook = Workbook()
comments = workbook.worksheets[0].comments
# Add comment to cell A1
commentIndex1 = comments.add(0, 0)
comment1 = comments[commentIndex1]
comment1.note = "First note."
comment1.font.name = "Times New Roman"
# Add comment to cell B2
comments.add("B2")
comment2 = comments.get("B2")
comment2.note = "Second note."
# do your business
# Save the excel file.
workbook.save("exmaple.xlsx")
See Also
- module
aspose.cells