Excel (XLS) to PDF convertion issue

Hello Team,

I am always grateful for your support!

I have been trying to convert an Excel file, which is in the .xls format, into a PDF. Although the conversion was successful, the resulting PDF file contains only one blank page. This is despite the fact that the original .xls file has 10 pages. Unfortunately, I am only able to see a single blank page in the converted PDF.

Could you please prioritize fixing this issue? I have attached a screenshot for your reference.

Thank you for your attention to this matter.

image.png (14.5 KB)

@Manish7320
Hello! Could you please provide the .xls file?
We created an xls file with multiple pages (6 pages) using the following method in Excel.

  • Click the “Page Layout” tab.
  • In the “Page Setup” group, click “Print Area” and select “Set Print Area.” You can select enough cell areas to cover 6 pages.

When we converted this file to PDF using Aspose.cells, the result was also 6 pages.
Please see the result .
multi-pages.zip (26.0 KB)

Hello @xinya.zhu

Thank you for your quick response,
I attatched the tested file as per your request so kindly check this and confirm.

TestFile.zip (172.1 KB)

@Manish7320
pagesetup.png (43.0 KB)

The print area of your file is A1, so we only export A1 to pdf.
If you print the file in MS Excel, you will get the same blank page. Aspose.Cells works as MS Excel.
Please remove print area setting in MS Excel , or with setting Worksheet.PageSetup.PrintArea as null.

worksheet.PageSetup.PrintArea = null

@simon.zhao ,

Thank you!
you mean our file has A3 of print area right? so if we ignore the print area the issue will not occur.

@Manish7320,

Yes, you need to remove the printable area set for the sheet in your Excel spreadsheet. Please note that if a printable area is set for the worksheet, only the print area will be rendered into the output PDF. So, you have to either remove the printable area (e.g., using the suggested line of code) or set a valid printable area for the whole data range in the sheet.

@amjad.sahi

Thank you very much for you information,
Now, we can see the result with content after ignoring the print area from the Excel spreadsheet. However, one more issue has occurred; half of the words have disappeared in the resultant file.

i attatched the screenshot for your reference,

image.png (15.9 KB)

@Manish7320
pdf.zip (458.9 KB)

Please check the attached pdf file which is generated by 24.6. It looks fine.

@Manish7320,

Thanks for the screenshot.

I assume you are using Java version. It works absolutely fine using Aspose.Cells for Java on my end. Even it works fine with both .NET and Java versions of Aspose.Cells. I am using latest version of Aspose.Cells for v24.6 (please try it if you are not already using it). I used the following sample code with your provided file.
e.g.,
Sample code:

Workbook workbook = new Workbook("e:\\test2\\JP_KD1-21004_11.0_d_IP3 (1).xls");
//Get the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
//Remove the print area
worksheet.getPageSetup().setPrintArea("");

workbook.save("e:\\test2\\out1.pdf", SaveFormat.PDF);

Please find attached the output PDF which is fine tuned for your reference.
out1.pdf (582.2 KB)

Could you please provide your sample (runnable) code and output PDF file for our reference. We will look into your issue soon.