Free Support Forum -

Add a text with 15000 characters into a cell using Aspose Cells Java


We have a requirement to Fit a comment with 15000 characters into a cell in excel and pdf.
Also we need to display the entire comment when excel is opened.

I am unable to find a way to do so using Aspose Cells.
Tried to merge the cells and setHeight by size of comment.But still am unable to show the and fit the entire comment.

Could you please help with the above mentioned problem ?


Hi Bhakti,

Thank you for contacting Aspose support.

Please check the following piece of code which tries to render the comments to PDF format. Please note, if you wish to save the resultant Workbook in spreadsheet format, the Excel will remove the comments because it does not allow such a long string in comment shape.

Note: The code has been provided for demonstration purposes only, and may not reflect your actual requirements. You should be able to amend the code as per application requirements.


String text = “”;
for(int i = 0 ; i < 15000; i++)
text = text + String.valueOf(i);
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
int commentIndex = worksheet.getComments().add(“A1”);
Comment comment = worksheet.getComments().get(commentIndex);
SheetRender render = new SheetRender(worksheet, new ImageOrPrintOptions());
int pageCount = render.getPageCount();
comment.setHeightInch(worksheet.getPageSetup().getPaperHeight() * pageCount);
PdfSaveOptions options = new PdfSaveOptions(); + “output.pdf”, options);