MS Excel’s XLSX files let you keep the tabular data in the form of rows and columns. You can store small, medium, or large-sized data within XLSX worksheets quite easily. However, there could be a case when you need to convert the spreadsheet data to a word processing format. For such cases, in this article, you will learn how to convert Excel XLSX to DOCX using C#. In addition, you will see how to customize the XLSX to DOCX conversion. So let’s begin.
- XLSX to DOCX C# Converter API
- Convert Excel XLSX to DOCX using C#
- Convert XLSX to DOCX with Additional Options in C#
- Try Aspose.Cells for .NET for Free
XLSX to DOCX C# Converter API – Free Download
Aspose.Cells for .NET is a well-known and one of the powerful spreadsheet manipulation APIs that lets you work with XLS, XLSX, and other popular spreadsheet formats. Along with other spreadsheet automation features, the API provides a spreadsheet converter to convert MS Excel’s XLSX or XLS file to DOCX or other file formats. You can download the API’s DLL or get it installed within your .NET application using NuGet.
PM> Install-Package Aspose.Cells
Excel XLSX to DOCX C# Conversion
Conversion of an MS Excel file to DOCX format is as easy as a pie and can be done in a couple of steps. This is how you can convert an XLSX file to DOCX using Aspose.Cells for .NET.
- Load the XLSX file using the Workbook class.
- Save the file as DOCX format using Workbook.Save(string, SaveFormat) method.
The following code sample shows how to convert an XLSX file to DOCX using C#.
Customized XLSX to DOCX C# Conversion
Aspose.Cells for .NET also provides you with some additional options to control and customize the XLSX to DOCX conversion. The DocxSaveOptions class contains all the possible options (listed below) that you can use in the conversion process.
|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.|
|SaveFormat||Gets the save file format.|
|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 additional options while converting an XLSX file to DOCX in C#.
Try Aspose.Cells for .NET for Free
You can get your temporary license to use Aspose.Cells for .NET for free without any trial limitations.
In this article, you have learned how to convert MS Excel’s XLSX or XLS files to DOCX format using C#. Furthermore, you have seen how to customize the conversion process using different options. You can explore more about the .NET Excel API using documentation.