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

Free Support Forum - aspose.com

Text getting cut off

Team,
PFA the input xls file and output pdf file.

In the output file, the text ix getting trimmed off. Can you please have a look and advise.

Thanks,

Hi,


Well, if you could take the print preview of the sheet in MS Excel manually, you will also see that it does not show the full contents in the cell, so does Aspose.Cells by default. I think if you need to display full contents in the rendered PDF, you may auto-fit row and set the merged cells options on, see the sample code that works fine with v8.2.0.
e.g
Sample code:

Workbook wb = new Workbook(strFileName);

AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = false };

wb.Worksheets[0].AutoFitRow(0, 0, 0, oAutoFitterOptions);
wb.Save(“e:\test2\out1.pdf”);

Hope, this helps a bit.

Thank you.

Team,
We are still getting the same error.
PFA the input and output files. Do let us know for any questions.

Hi Nicole,


We are sorry for the inconvenience caused to you.

As discussed earlier, Aspose.Cells APIs render the given spreadsheet to PDF format as the spreadsheet is displayed in the MS Excel Preview mode. If you check your provided spreadsheet in MS Excel application, you will notice that the cells A8 & A9 have the text that cannot fit on a single PDF page. Please check the attached snapshot for your reference.

In order to avoid this situation, you have to force the API to print the complete worksheet on single page of the PDF. Please check the below code snippet & attached resultant PDF.

C#

var book = new Workbook(“D:/temp/input (1).xlsx”);

AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = true };
book.Worksheets[0].AutoFitRows(oAutoFitterOptions);

PdfSaveOptions options = new PdfSaveOptions();
options.OnePagePerSheet = true;

book.Save(“D:/temp/out1.pdf”, options);

Please feel free to write back.