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

Free Support Forum - aspose.com

I cannot excel file to pdf using aspose.cell java

I cannot convert a excel file to pdf using aspose.cell java.
I append the excel file.
https://drive.google.com/file/d/0BzEc51fOoK5kSzFKSlppX1VTREU/view?usp=sharing
the excel file has many formula cells in it.
the code is as bellow.

	Workbook workbook = new Workbook("Report_1.10.xlsx");

	// Save the document in PDF format
	workbook.save("E2PDFC-out.pdf", SaveFormat.PDF);

	// Print message
	System.out.println("Excel to PDF conversion performed successfully.");

The converted pdf file is
https://drive.google.com/file/d/0BzEc51fOoK5kSDZlS1QtU29ISzA/view?usp=sharing
pls help me.

@arnoldbenda

Thanks for your posting and considering Aspose APIs.

Please call Workbook.calculateFormula() method before saving to Pdf and it will fix your issue. This method is important when your workbook has some formulas inside it.

Please see the following sample code and read its comments.

Java

Workbook workbook = new Workbook("Report_1.10.xlsx");

//This line is important-------------------
workbook.calculateFormula();

// Save the document in PDF format
workbook.save("E2PDFC-out.pdf", SaveFormat.PDF);

// Print message
System.out.println("Excel to PDF conversion performed successfully.");

Thank you for reply.desc.png (110.1 KB)
The one sheet excel file is spilt several pdf sheets.
https://drive.google.com/file/d/0BzEc51fOoK5kSDZlS1QtU29ISzA/view?usp=sharing
How can I convert excel one sheet to one pdf file?
And Can I convert excel file to word ?

@arnoldbenda

Please use OnePagePerSheet property as shown in this code. It will fit your needs.

Java

Workbook workbook = new Workbook("Report_1.10.xlsx");

//This line is important-------------------
workbook.calculateFormula();

PdfSaveOptions opts = new PdfSaveOptions();
opts.setOnePagePerSheet(true);

// Save the document in PDF format
workbook.save("E2PDFC-out.pdf", opts);

It is not supported by Aspose.Cells. Please post any such query in Aspose.Total forum. But Excel to Word conversion is not supported by Aspose.Cells.

Very Very Thanks.
I resolved.
I am very happy for your answer.
Thanks.

@arnoldbenda,

Good to know that your issues are sorted out by the suggested code segments. Feel free contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.