We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Excel to PDF column width issue using java api

I am facing an issue where the column in the excel are not fully expanded, so the data in the cell of those columns is not fully visible. So when it is converted to PDF even data printed in PDF columns is not visible fully. So what i see in excel is as it is printed in PDF. Is there any setting where i can call an api to resize all the columns in excel according to the data.Screen Shot 11-15-21 at 12.40 PM.PNG (2.1 KB)


You need to extend the columns’ width or call autoFitColumns method of Worksheet, so the columns should show data completely. See the following sample code segment (it should be pasted before rendering/saving to PDF) for your reference.
Sample code:

//Get the first worksheet in the workbook
Worksheet worksheet = workbook.getWorksheets().get(0);
// Autofit all the columns.

Hope, this helps a bit.