File Formats

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IComment

    Show / Hide Table of Contents

    Interface IComment

    Represents a cell comment. The Comment object is a member of the Comments collection.

    Inherited Members
    ITextBox.HAlignment
    ITextBox.VAlignment
    ITextBox.TextRotation
    ITextBox.IsTextLocked
    ITextBox.RichText
    ITextBox.Text
    IParentApplication.Application
    IParentApplication.Parent
    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.Base.dll
    Syntax
    public interface IComment : ITextBox, IParentApplication

    Properties

    Author

    Returns or sets the author of the comment. Read-only String.

    Declaration
    string Author { get; }
    Property Value
    Type Description
    System.String
    Examples

    The following code illustrates how to access Author property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add comment
                IComment comment = worksheet["C2"].AddComment();
    
                //Add text
                comment.Text = "Comment";
    
                //Get author
                Console.Write(comment.Author);
    
                //Save and dispose
                workbook.SaveAs("Comments.xlsx");
                workbook.Close();
                Console.ReadKey();
            }
    //Output will be
    //{Your username will be printed}

    AutoSize

    True if the size of the specified object is changed automatically to fit text within its boundaries. Read/write Boolean.

    Declaration
    bool AutoSize { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples

    The following code illustrates how to set AutoSize property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add comment
                IComment comment = worksheet["C2"].AddComment();
    
                //Add text
                comment.Text = "Comment";
    
                //Set auto size
                comment.AutoSize = true;
    
                //Save and dispose
                workbook.SaveAs("Comments.xlsx");
                workbook.Close();
            }

    Column

    Column of the commented cell. Read-only.

    Declaration
    int Column { get; }
    Property Value
    Type Description
    System.Int32
    Examples

    The following code illustrates how to access the Column property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add comment
                IComment comment = worksheet["C2"].AddComment();
    
                //Get column
                Console.Write(comment.Column);
    
                //Save and dispose
                workbook.SaveAs("Comments.xlsx");
                workbook.Close();
                Console.ReadKey();
            }
    //Output will be
    //3

    IsVisible

    Determines whether the object is visible. Read / write Boolean.

    Declaration
    bool IsVisible { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples

    The following code illustrates how to set the visibility of the comment.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add comment
                IComment comment = worksheet["C2"].AddComment();
    
                //Add text
                comment.Text = "Comment";
    
                //Set visibility
                comment.IsVisible = true;
    
                //Save and dispose
                workbook.SaveAs("Comments.xlsx");
                workbook.Close();
            }

    Row

    Row of the commented cell. Read-only.

    Declaration
    int Row { get; }
    Property Value
    Type Description
    System.Int32
    Examples

    The following code illustrates how to access the Row property.

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                //Create worksheet
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
    
                //Add comment
                IComment comment = worksheet["C2"].AddComment();
    
                //Get row
                Console.Write(comment.Row);
    
                //Save and dispose
                workbook.SaveAs("Comments.xlsx");
                workbook.Close();
                Console.ReadKey();
            }
    //Output will be
    //2
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved