Created
July 22, 2022 11:09
How to Convert DOC to DOCX using Java. For more information, please follow link: https://kb.conholdate.com/total/java/how-to-convert-doc-to-docx-using-java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.groupdocs.conversion.Converter; | |
import com.groupdocs.conversion.licensing.License; | |
import com.groupdocs.conversion.options.convert.WordProcessingConvertOptions; | |
public class ConvertDocToDocxUsingJava { | |
public static void main(String[] args) { // Main function to convert DOC to DOCX in Java | |
// Remove the watermark in output DOCX document by adding license | |
License lic = new License(); | |
lic.setLicense("/path/to/GroupDocs.Conversion.lic"); | |
// Load the source DOC file for conversion to DOCX | |
Converter converter = new Converter("/path/to/sample.docx"); | |
// Set the convert options for DOCX format | |
WordProcessingConvertOptions options = new WordProcessingConvertOptions(); | |
// Convert and save the DOC in DOCX format | |
converter.convert("/path/to/converted.doc", options); | |
System.out.println("Done"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment