Free Support Forum - aspose.com

Convert excel file to pdf (data cut-off)

Hi,


I’m now using the Aspose.Cells version of 4.8.0.0.
After I used the following code, the pdf file is generated but the data in pdf are cut-off. Also, the chart is not shown completely. Would you please help me?

this.WorkbookDesigner.Workbook.Open(“C:\TestingCells.xlsx”, FileFormatType.Excel2007Xlsx);
this.WorkbookDesigner.Workbook.Save(filePath, FileFormatType.Pdf);

Hi,

Thank you for considering Aspose.

Please download the latest version of Aspose.Cells and try it as I checked your template file and the result is much better (as per the print preview of MS Excel). You may use the following link to download the latest Aspose.Cells for .NET version.

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

Also, for the chart issue, please use Worksheet.PageSetup options to fit the chart on one page. Please see the following sample code in this regard:

Workbook workbook = new Workbook();

workbook.Open("C:\\TestingCells.xlsx", FileFormatType.Excel2007Xlsx);

workbook.Worksheets[1].PageSetup.FitToPagesTall = 1;

workbook.Worksheets[1].PageSetup.FitToPagesWide = 1;

workbook.Save("C:\\TestingCells.pdf", FileFormatType.Pdf);

Please do let us know if you still face any problem.

Thank You & Best Regards,

Hi,


Thanks for your help.

I have updated the version to Version 4.8.1.0 and use the codes you suggested.
However, the problem of data cut-off is still existing. As you can see from the pdf attached, some data cannot be fully shown even after I have use the method “AutoFitColumns()” to generate the excel file. Since pdf cannot be altered after generation, the data hided cannot be got.

Is there any methods I have to use to solve the problem of failure of showing all data?

Best regards,
Suyi

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Please make sure to un-install the previous version and then install the latest version. As I checked with the latest version and attached is my output with below sample code:

Workbook workbook = new Workbook();

workbook.Open("C:\\TestingCells2.xlsx", FileFormatType.Excel2007Xlsx);

workbook.Worksheets[0].AutoFitColumns();

workbook.Worksheets[1].PageSetup.FitToPagesTall = 1;

workbook.Worksheets[1].PageSetup.FitToPagesWide = 1;

workbook.Save("C:\\TestingCells.pdf", FileFormatType.Pdf);

If you still face any problem, please mark the issues in the generated PDF file and send to us. We will check it soon.

Thank You & Best Regards,

Hi,


Following what you stated, the problem is still there.
Attached is the generated pdf file (“TestingCell.pdf”) and the image file I marked. Please read it.

Alternatively, I tried to use the following code to do this task. The data in the file generated is not cut-off. However, one of the border of the chart is cut-off. It seems that quality of file generated is poorer than the one generated by Aspose.Cell. Attached is the “TestingCells2.pdf” generated as well.

Workbook workbook = new Workbook();
workbook.Open(“C:\TestingCells2.xlsx”, FileFormatType.Excel2007Xlsx);

workbook.Worksheets[0].AutoFitColumns();
workbook.Worksheets[1].PageSetup.FitToPagesTall = 1;
workbook.Worksheets[1].PageSetup.FitToPagesWide = 1;

//workbook.Save(“C:\TestingCells.pdf”, FileFormatType.Pdf);

workbook.Save(“C:\TestingCells2.xml”, FileFormatType.AsposePdf);

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.BindXML(“C:\TestingCells2.xml”, null);

pdf.Save(“C:\TestingCells2.pdf”);


Thanks.
Best Regards,
Suyi

Hi,

Thank you for considering Aspose.

Well, we have further tested your issue and we are still unable to reproduce the issue in direct conversion of XLS2PDF using Aspose.Cells. We think maybe the reference to the latest version is not added properly in you application. Please remove the previous reference from your project and add the reference to the latest version. If you still find any issue, please create a sample application to reproduce the issue and post it here and we will check it soon.

Thank You & Best Regards,

Hi,


After creating a new sample application, the problem is still there.
Attached is the newly created project.
Thanks.

Best Regards,
Suyi

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

I checked your sample application and please find the attached resultant file which does not have any truncation of data. Please provide some further details regarding your system environment so we can track the issue (like OS, Adobe Version etc).

Thank You & Best Regards,

Hi,


Using my computer to view your resultant file, there is no truncation of data.

Here is my system environment:

OS: Windows Vista Business Service Pack 1
Excel: Microsoft Office Excel 2007
Adobe: Adobe Reader 9.0
Visual Studio: Microsoft Visual Studio 2008

Please let me know if any more information is needed.
Thanks.

Best Regards,
Suyi

Hi Suyi,

We found your excel file has MingLiu&PMingLiu as default font , so if your machine do not install such font , this issue will occur. So, you may create template file using installed font as default font, or install the MingLiu&PMingLiu(mingliu0.ttc).

Thank you

Hi,


Except using the uninstalled font, data including Traditional Chinese Characters can now be successfully converted to pdf file.
Thank you very much for your kindly help! You really help me a lot!

Best Regards,
Suyi