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

Free Support Forum - aspose.com

Formatting incorrect when saving Excel file to .pdf after using Cell.PutValue()


I have an excel file with a named range that contains a small amount of text. The column is set to wrap. If I use Cell.PutValue() to put a longer string into the cell, and convert to .pdf, the long text gets cut off in the .pdf version.

I have attached a solution that reproduces this error. The file I am using to reproduce can be found in the solution at:


In short, the program takes the files from the bin\Debug\Docs directory, processes them, then places them into the Output directory. If you need any more information, please let me know.

I have reproduced this issue with the latest cells .NET dll (

Thank you for your help,
Alan R.

Hi Alan,

Thank you for contacting Aspose support.

Please call the Worksheet.AutoFitRows method before rendering the spreadsheet to PDF format. It should fix the problem of trimmed text in resultant PDF. I have also attached the PDF generated on my side.


Workbook workbook = new Workbook(destPath);
Aspose.Cells.Range[] ranges = workbook.Worksheets.GetNamedRanges();
foreach (Aspose.Cells.Range currentRange in ranges)
currentRange[0, 0].PutValue(“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum”);
workbook.Settings.ReCalculateOnOpen = true;

Please also note that OoxmlSaveOptions is to be used for Office Open XML Spreadsheet format whereas PdfSaveOptions is specialized class for rendering the spreadsheets to PDF format.

Thank you, this will satisfy our needs for now. This ticket can be closed.

- Alan R.

Hi Alan,

Thank you for the confirmation on provided solution. Please feel free to contact us back in case you need our further assistance with Aspose APIs.