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

Free Support Forum - aspose.com

Save word document as Word2007+ and converting into Pdf

Hi team,


Facing issue while saving a word document as word2007 and above as I m using the below code and getting the exception.

code :

doc.save(“D://Test//OutputWord-aspose.docx”, SaveFormat.DocX);

Exception :
Exception in thread “main” java.lang.IllegalArgumentException: Invalid save format requested.
at com.aspose.words.SaveOptions.createSaveOptions(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
*
code :
doc.save(“D://Test//OutputWord-aspose.docx”, com.aspose.words.SaveFormat.DOCX);

Exception :
Exception in thread “main” java.lang.IllegalArgumentException: Invalid save format requested.
at com.aspose.words.SaveOptions.createSaveOptions(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
**************************************************************************
Note ::

If I get the docx file using the below code.
doc.save(“D://Test//OutputWord-aspose.docx” );

This word file when converted into pdf using normal java code vanishes all data.Please assist.

Waiting for soon reply.Thanks

Regards
Sonam


Hi Sonam,


Thanks for your inquiry. What version of Aspose.Words for Java are you currently using? Could you try Aspose.Words for Java 14.4.0 and see how it goes? In case the problem still remains, please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi ,

We are using Aspose.Words 14.2.0
I have upgraded to 14.4.0 as assist by you but still facing the same issue.
Please suggest.

Thanks
Sonam Arora

Hi Sonam,


Thanks for the additional information. Please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi Awais

Attached the Input WordFile.

Thanks
Sonam

Hi Sonam,


Thanks for your inquiry. After an initial test with Aspose.Words for Java 14.4.0, I was unable to reproduce this exception on my side. Could you please try running the following code and see how it goes on your side.

Document doc = new Document(getMyDir() + “MyList.doc”);
doc.save(getMyDir() + “out.docx”, SaveFormat.DOCX);

Document doc2 = new Document(getMyDir() + “out.docx”);
doc2.save(getMyDir() + “out.pdf”, SaveFormat.PDF);

I have attached output DOCX and PDF documents here for your reference. So, please make sure you’re using Aspose.Words for Java 14.4.0:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

Best regards,