How can I resize comment with API? I have a large number of information in one comment, so I want comment a wider region. It’s important for me.
Hi, thanks for your consideration.
I added two properties to Comment object:Height, Width, in Hotfix 1.5.11.1. Please download it.
You can resize comment as following:
comment.Width = 5;
comment.Height = 4;
@ys.ma,
We have enhanced the library a lot and provided many options to format the comments. You may try the following code sample to set the size and font of the comment.
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Workbook object
int sheetIndex = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
// Adding a comment to "F5" cell
int commentIndex = worksheet.Comments.Add("F5");
// Accessing the newly added comment
Comment comment = worksheet.Comments[commentIndex];
// Setting the comment note
comment.Note = "Hello Aspose!";
// Setting the font size of a comment to 14
comment.Font.Size = 14;
// Setting the font of a comment to bold
comment.Font.IsBold = true;
// Setting the height of the font to 10
comment.HeightCM = 10;
// Setting the width of the font to 2
comment.WidthCM = 2;
// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
Here is a detailed article which describes these features:
Managing Comments
Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)
You can download the latest demos here.