Free Support Forum - aspose.com

Issues converting from excel to pdf

We are considering using Aspose.cells for converting excel documents to pdf. I’m currently using Aspose.cells on an evaluation basis and I’m having some questions/issues with this process. The main problem I seem to be having is that some of the content is getting cut off and not appearing in the pdf. It seems that content on the first worksheet that is far enough to the right will end up on the second page of the pdf, which is fine, however it is also partially cut off. Is this a known problem? Is there anything I can do to prevent this?

Hi,

Thank you for considering Aspose.

Please download and try the latest version of Aspose.Cells and check if it fits your needs.

http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry207989.aspx

Also, it is to be noted that the PDF generated from XLS will be as per your PageSetup options of Excel File (as per the Print Preview of Excel file). So you can use Worksheet.PageSetup options to set the page size and orientation as per your requirement. Also, if you still face any problem with the latest version, please share your template and resultant file here and we will check it soon.

Thank You & Best Regards,

Thanks for the response. I have downloaded the dll for the latest version of aspose.cells and I still seem to be having a problem. below is the code I am using and I am attaching the two files, the excel file and the resulting pdf file. You will notice in the third page of the pdf the text gets cut off.

I will note I ame using a stream as to avoid having to save the file to disk.

Thanks for your help.

Workbook workbook = new Workbook();

workbook.Open(docImageStream);

foreach (Worksheet ws in workbook.Worksheets)

{

ws.PageSetup.Orientation = PageOrientationType.Landscape;

}

MemoryStream pdfDocument = new MemoryStream();

workbook.Save(pdfDocument, FileFormatType.Pdf);

File.WriteAllBytes("C:\\Temp\\aspose.pdf", pdfDocument.toArray());

Hi,

Yes, i can see in the third page “Ranges” is cut off. I think as a workaround you may try to auto-fit columns for the first sheet.

e.g

foreach (Worksheet ws in workbook.Worksheets)

{

ws.PageSetup.Orientation = PageOrientationType.Landscape;

//Auto-fit for first sheet.

if (ws.Index == 0)
{
ws.AutoFitColumns();

}

}


And, we will continue to enhance it (Excel-to-PDF feature) more.


Thank you.