Excel to Word conversion could be useful when you need to export data from a worksheet to a table in a Word document. In order to automate this conversion, this article covers how to convert Excel XLSX files to Word DOCX format using Java. Furthermore, additional options are also discussed to customize XLSX to DOCX conversion.
- Excel to Word Java Converter API
- Convert XLSX to DOCX in Java
- Customize XLSX to DOCX Conversion in Java
- Get a Free API License
Excel to Word Java Converter API
Aspose.Cells for Java is a spreadsheet manipulation API that lets you generate, process, and manipulate Excel files. In addition, the API provides high-quality conversion of Excel XLSX files to other formats including DOCX, PDF, etc. You can either download the API or install it using the following Maven configuration.
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>21.3</version>
</dependency>
Convert XLSX to DOCX in Java
Conversion of an Excel spreadsheet to a Word document is as easy as pie. It can be done in a couple of steps using Aspose.Cells for Java. The following are the steps to convert an XLSX file to DOCX format.
- First, load the Excel XLSX file using the Workbook class.
- Finally, convert XLSX to DOCX using Workbook.save(String, SaveFormat.DOCX) method.
The following code sample shows how to convert an Excel XLSX file to Word DOCX using Java.
Customize XLSX to DOCX Conversion in Java
You can also customize Excel to Word conversion using different options provided by DocxSaveOptions class. The following is the list of options that you can use.
Option | Description |
---|---|
CachedFileFolder | The cache folder to store some large data. |
ClearData | Make the workbook empty after saving the file. |
CreateDirectory | If true and the directory does not exist, the directory will be automatically created before saving the file. |
MergeAreas | Indicates whether to merge the areas of conditional formatting and validation before saving the file. |
RefreshChartCache | Indicates whether refreshing chart cache data. |
SortNames | Indicates whether to sort defined names before saving files. |
UpdateSmartArt | Indicates whether to update the smart art setting. |
ValidateMergedAreas | Indicates whether validate merged cells before saving the file. |
WarningCallback | Gets or sets warning callback. |
The following code sample shows how to use DocxSaveOptions class while converting Excel XLSX to Word DOCX using Java.
Get a Free API License
You can try Aspose.Cells for Java for free by getting a temporary license.
Conclusion
In this article, you have learned how to convert Excel XLSX files to DOCX format using Java. Furthermore, you have seen how to use different options in order to customize Excel to Word conversion. You can explore more about Aspose.Cells for Java using documentation. Moreover, if you would have any questions or queries, feel free to contact us via our forum.