GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ExcelComment Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents a comment object used by Comment in the worksheet.

    • C#
    • VB.NET
    public class ExcelComment
    Public Class ExcelComment
    Inheritance:
    System.Object
    ExcelComment

    Properties

    Author

    Gets or sets comment author.

    • C#
    • VB.NET
    public string Author { get; set; }
    Public Property Author As String
    Property Value
    System.String

    Comment author.

    BottomRightCell

    Gets or sets the bottom right anchor cell for the comment shape.

    • C#
    • VB.NET
    public AnchorCell BottomRightCell { get; set; }
    Public Property BottomRightCell As AnchorCell
    Property Value
    AnchorCell

    Exists

    If comment exists returns true, otherwise returns false.

    • C#
    • VB.NET
    public bool Exists { get; }
    Public ReadOnly Property Exists As Boolean
    Property Value
    System.Boolean

    IsVisible

    Gets or sets a value indicating whether this instance is visible.

    • C#
    • VB.NET
    public bool IsVisible { get; set; }
    Public Property IsVisible As Boolean
    Property Value
    System.Boolean

    true if this instance is visible; otherwise, false.

    ParentCell

    Gets the comment parent cell.

    • C#
    • VB.NET
    public ExcelCell ParentCell { get; }
    Public ReadOnly Property ParentCell As ExcelCell
    Property Value
    ExcelCell

    Text

    Gets the comment text assigned to excel cell

    • C#
    • VB.NET
    public string Text { get; set; }
    Public Property Text As String
    Property Value
    System.String

    The comment text assigned to excel cell.

    TopLeftCell

    Gets or sets the top left anchor cell for the comment shape.

    • C#
    • VB.NET
    public AnchorCell TopLeftCell { get; set; }
    Public Property TopLeftCell As AnchorCell
    Property Value
    AnchorCell

    Methods

    AutoFit()

    Automatically fits the comment width and height to the minimum size required for all data in the comment to be visible.

    • C#
    • VB.NET
    public void AutoFit()
    Public Sub AutoFit
    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.

    • C#
    • VB.NET
    public void AutoFit(double scaling)
    Public Sub AutoFit(scaling As Double)
    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.

    • C#
    • VB.NET
    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
    System.Object.Equals(System.Object)

    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.

    • C#
    • VB.NET
    public FormattedCharacterRange GetCharacters(int startIndex)
    Public Function GetCharacters(startIndex As Integer) As FormattedCharacterRange
    Parameters
    startIndex
    System.Int32

    The zero-based starting character position.

    Returns
    FormattedCharacterRange

    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.

    • C#
    • VB.NET
    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
    FormattedCharacterRange

    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.

    • C#
    • VB.NET
    public override int GetHashCode()
    Public Overrides Function GetHashCode As Integer
    Returns
    System.Int32

    An integer value that specifies a hash value for this ExcelComment instance.

    Overrides
    System.Object.GetHashCode()

    Operators

    Equality(ExcelComment, ExcelComment)

    Determines whether first and second ExcelComments are equal.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    Examples

    ExcelCell Comments example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.