We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to resize comment box using C#,VB.NET?

Platform: WinForms |
Control: XlsIO

This article explains how to resize comments in WinForms XlsIO using C#/VB.NET.

How to resize comments in XlsIO?

Comments are used as notes for a cell in worksheet. The comment shape size can be resized by changing the height and width. XlsIO provides support for changing the width and height of the comments.

To resize the comment, please set height and width of the comment like following code snippet.

//Add comment in cell 'A1'
ICommentShape comment = worksheet["A1"].AddComment();
 
comment.Text = "Resized comment";
 
// Height and Width measured in points
comment.Height = 100;
comment.Width = 100;
comment.IsVisible = true;
 

 

To know more about comments in XlsIO, please refer the documentation.

Download complete sample

The following C#/VB.NET complete code snippet shows how to resize comments in XlsIO.

using Syncfusion.XlsIO;
using Syncfusion.XlsIO.Implementation.Shapes;
using System.Drawing;
using System.IO;
using System.Reflection;
 
namespace XlsIO_Sample
{
    class Program
    {
        public static void Main(string[] args)
        {
            //Instantiate the spreadsheet creation engine
            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                IApplication application = excelEngine.Excel;
 
                //Create workbook
                IWorkbook workbook = application.Workbooks.Create(1);
                IWorksheet worksheet = workbook.Worksheets[0];
 
                //Add comment in cell 'A1'
                ICommentShape comment = worksheet["A1"].AddComment();
 
                comment.Text = "Resized comment";
 
                // Height and Width measured in points
                comment.Height = 100;
                comment.Width = 100;
                comment.IsVisible = true;
 
                //Save and close the workbook
                Stream stream = File.Create("Output.xlsx");
                workbook.SaveAs(stream);
            }
        }
    }
}
 

 

Imports Syncfusion.XlsIO
Imports Syncfusion.XlsIO.Implementation
Imports System.Drawing
Imports System.IO
Imports System.Reflection
 
Namespace XlsIO_Sample
 
    Class Program
 
        Public Shared Sub Main(ByVal args As String())
            'Instantiate spreadsheet creation engine
            Using excelEngine As ExcelEngine = New ExcelEngine()
 
                Dim application As IApplication = excelEngine.Excel
 
                'Create a workbook
                Dim workbook As IWorkbook = application.Workbooks.Create(1)
                Dim worksheet As IWorksheet = workbook.Worksheets(0)
 
                'Add comment in cell 'A1'
                Dim comment As ICommentShape = worksheet("A1").AddComment()
 
                comment.Text = "Resized comment"
 
                ' Height And Width measured in points
                comment.Height = 100
                comment.Width = 100
                comment.IsVisible = True
 
                'Save and close the workbook
                Dim stream As Stream = File.Create("Output.xlsx")
                workbook.SaveAs(stream)
            End Using
        End Sub
    End Class
End Namespace
 

 

The following screenshot shows how to resize comment in XlsIO.

Resizing comment in Excel Library

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile