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

Free Support Forum - aspose.com

Java Word API. Convert from .doc to .docx?

Hi, Is it possible to use Aspose Java api to convert a 2003 Word .doc file to a 2007+ Word .docx file?
If so, do I need to have MS Word installed to complete the conversion?

Hi there,

Thanks for your inquiry. Yes, you can convert Doc to Docx file format by using Aspose.Words. Please use the following code snippet to convert Doc to Docx file format.

// Open a document 
Document doc = new Document(MyDir + "in.doc");
//Save document to Docx file format
doc.save(MyDir + "Out.docx", SaveFormat.DOCX);

Aspose.Words does not require Microsoft Office to be installed on the machine in order to work. All Aspose components are totally independent and are not affiliated with, nor authorized, sponsored, or otherwise approved by Microsoft Corporation. In short, Aspose.Words is a better alternative to automation in terms of security, stability, scalability/speed, price and features. Please read following documentation links for your kind reference.

Moreover, please read Aspose.Words LoadFormat and SaveFormat form following documentation links.

Document doc = new Document("MyDir" + "in.doc");

while using the above code in my java page, it shows "The constructor Document(String) is undefined"
and using this code ------------> doc.save("output.docx"); it shows like “The method save(String) is undefined for the type Document”
Whether i have to import any jar file. If means, please list out the jar file

Thanks for your inquiry. Please remove all Jar files from your project and add reference of latest version of Aspose.Words for Java 17.7 to it. Please read the following article:
Installing Aspose.Words for Java
Moreover, please check following links about adding reference to IntelliJ/Netbeans project.
Add external jars to an IntelliJ IDEA project
Add external jars to Netbeans project