Convert Excel XLSX to Word DOCX in Java

XLSX to DOCX Java

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

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.

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.

OptionDescription
CachedFileFolderThe cache folder to store some large data.
ClearDataMake the workbook empty after saving the file.
CreateDirectoryIf true and the directory does not exist, the directory will be automatically created before saving the file.
MergeAreasIndicates whether to merge the areas of conditional formatting and validation before saving the file.
RefreshChartCacheIndicates whether refreshing chart cache data.
SortNamesIndicates whether to sort defined names before saving files.
UpdateSmartArtIndicates whether to update the smart art setting.
ValidateMergedAreasIndicates whether validate merged cells before saving the file.
WarningCallbackGets 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.

See Also