ExcelComment Class
Represents a comment object used by Comment in the worksheet.
- Inheritance:
- System.ObjectExcelComment
Properties
Author
Gets or sets comment author.
Property Value
- System.String
Comment author.
BottomRightCell
Gets or sets the bottom right anchor cell for the comment shape.
public AnchorCell BottomRightCell { get; set; }
Public Property BottomRightCell As AnchorCell
Property Value
Exists
If comment exists returns true, otherwise returns false.
Property Value
- System.Boolean
IsVisible
Gets or sets a value indicating whether this instance is visible.
Property Value
- System.Boolean
true if this instance is visible; otherwise, false.
ParentCell
Gets the comment parent cell.
Property Value
Text
Gets the comment text assigned to excel cell
Property Value
- System.String
The comment text assigned to excel cell.
TopLeftCell
Gets or sets the top left anchor cell for the comment shape.
Property Value
Methods
AutoFit()
Automatically fits the comment width and height to the minimum size required for all data in the comment to be visible.
Remarks
When the comment has multiple lines, the width is autofitted to the longest line and the height is autofitted to make all lines visible. If the comment has a single line of text the height and width are autofitted in an approximately 2:1 ratio.
The calculated width and height is stored internally and the BottomRightCell property is set to null.
AutoFit(Double)
Automatically fits the comment width and height to the minimum size required for all data in the comment to be visible.
Parameters
scaling
- System.Double
Scaling factor.
Remarks
Scaling factor is used to adjust the width and height of the comment. The resulting size is equal to CalculatedSize * scaling. The default scaling is 1.
When the comment has multiple lines, the width is autofitted to the longest line and the height is autofitted to make all lines visible. If the comment has a single line of text the height and width are autofitted in an approximately 2:1 ratio.
The calculated width and height is stored internally and the BottomRightCell property is set to null.
Equals(Object)
Determines whether the specified System.Object is equal to this ExcelComment instance.
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this ExcelComment instance.
Returns
- System.Boolean
true if the specified System.Object is a ExcelComment and is equal to this ExcelComment instance; otherwise, false.
Overrides
GetCharacters(Int32)
Returns a FormattedCharacterRange object that represents a range of characters within the comment text. The range starts at a specified character position. Supported in XLSX, XLSB and XLS.
public FormattedCharacterRange GetCharacters(int startIndex)
Public Function GetCharacters(startIndex As Integer) As FormattedCharacterRange
Parameters
startIndex
- System.Int32
The zero-based starting character position.
Returns
New FormattedCharacterRange object.
Exceptions
- System.ArgumentOutOfRangeException
Argument startIndex
is less than zero or is equal to or greater than 32767.
GetCharacters(Int32, Int32)
Returns a FormattedCharacterRange object that represents a range of characters within the comment text. The range starts at a specified character position and has a specified length. Supported in XLSX, XLSB and XLS.
public FormattedCharacterRange GetCharacters(int startIndex, int length)
Public Function GetCharacters(startIndex As Integer, length As Integer) As FormattedCharacterRange
Parameters
startIndex
- System.Int32
The zero-based starting character position.
length
- System.Int32
The number of characters.
Returns
New FormattedCharacterRange object.
Exceptions
- System.ArgumentOutOfRangeException
Argument startIndex
is less than zero or is equal to or greater than 32767.
- System.ArgumentOutOfRangeException
Argument length
is equal to or less than zero or is greater than 32767.
GetHashCode()
Returns a hash code for this ExcelComment instance.
Returns
- System.Int32
An integer value that specifies a hash value for this ExcelComment instance.
Overrides
Operators
Equality(ExcelComment, ExcelComment)
Determines whether first
and second
ExcelComments are equal.
public static bool operator ==(ExcelComment first, ExcelComment second)
Public Shared Operator =(first As ExcelComment, second As ExcelComment) As Boolean
Parameters
first
- ExcelComment
The first ExcelComment.
second
- ExcelComment
The second ExcelComment.
Returns
- System.Boolean
true if first
and second
ExcelComments are equal; otherwise, false.
Inequality(ExcelComment, ExcelComment)
Determines whether first
and second
ExcelComments are not equal.
public static bool operator !=(ExcelComment first, ExcelComment second)
Public Shared Operator <>(first As ExcelComment, second As ExcelComment) As Boolean
Parameters
first
- ExcelComment
The first ExcelComment.
second
- ExcelComment
The second ExcelComment.
Returns
- System.Boolean
true if first
and second
ExcelComments are not equal; otherwise, false.