This short guide explains the conversion from Word to Excel using C#. It has all the details to set the IDE, a list of steps, and a sample code to transform Word to Excel using C. You will perform this task using a couple of API calls only and also save the output file to other formats if required.
Steps to Convert DOC to XLSX using C#
- Set the environment to use Aspose.Words for .NET to create an Excel file
- Load the license for Aspose.Words to avoid watermarks and other limitations
- Load the source Word file into the Document object for conversion to the Excel format
- Define the output format as XLSX
- Save the output file as an Excel file using the above-defined format
These steps have explained the development of a Word to Excel converter using C#. Load the source Word file into the Document class object and save it on the disk in the defined format. If you do not use the SaveFormat class object, the output file extension XLSX will direct the API to create an Excel file.
Code for Word Document to Excel Converter using C#
This code has demonstrated the process of developing a Word DOC to Excel converter using C#. You can load files supported by the Document object, such as MsWorks, DocPreWord60, Docm, FlatOpc, WordML, Azw3, etc, by using the LoadFormat enumerator in the LoadOptions class object. Similarly, the output file can be saved as EPS, PNG, Epub, Markdown etc., using the SaveFormat enumerator in the Save method.
This article has taught us the process of changing a Word document to an Excel file. If you want to exercise the Mail Merge feature in a Word file, refer to the article Mail Merge in MS Word using C#.