Pdf to Excel with java

I’m trying to convert and a Pdf to excel and when I try to open the excel I getting the next error:
“Excel cannot open the file because the format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.”


Thanks for contacting support.

In order to avoid the error dialog, which you are facing, please save Excel file with the .XML extension like I did in the following code snippet, and in case if you still face any issue, please share your sample PDF document. We will test the scenario in our environment and address it accordingly.

Document doc = new Document(dataDir + "Test test test test tes print as pdf.pdf");
com.aspose.pdf.ExcelSaveOptions saveopts = new ExcelSaveOptions();
doc.save(dataDir + "ExcelOutput.xml", saveopts);

Hello Asad,
Thanks for your quick answer.
I tried your suggestion and I got the same result.dw_EX.pdf (41.1 KB)


Thanks for sharing the document.

I have tested the scenario with latest version Aspose.Pdf for Java 17.7 and was unable to notice the error dialog while opening resultant file in MS Excel. I have used the same code snippet, which I have shared earlier and for your reference, I am attaching the output Excel file as well.

ExcelOutput.zip (4.1 KB)

Please try using latest version of the API and in case you still face an issue, please share your environment details i.e OS Version, JDK Version, etc. so that we can test the scenario again in our environment and address it accordingly.

Hello Asad,
I having this error when I try to download the file:
“Sorry, this file is private. Only visible to topic owner and staff members.”


We are sorry for the inconvenience, that you have faced.

Please try log out and login again and in case if you still unable to download the file please download it form here.

Hello Asad,
Thank you for your support.
I fixed the issue. I forgot to copy the License.

Best regards,