Convert xlsx to docx

How can I convert a file from Microsoft Excel (xlsx) format to Microsoft Word (docx) format directly (with as few lines of codes as possible)?

Hi,


I would like to address your requirements from Aspose.Cells perspective. I am afraid, there is no such built-in feature existed in Aspose.Cells to convert Excel files (XLSX) to render a Word document file. Aspose.Cells is actually a spreadsheet management library used to create, convert, render, manipulate etc. Excel file formats. As a workaround, you may convert Excel file to PDF which Aspose.Cells does support this feature and then use either Aspose.Pdf or Aspose.Words to convert PDF to DOC file format(s).

Moreover, I think Aspose.Words team has created a custom utility for the conversion (Excel to Doc ), this utility uses Aspose.Cells and Aspose.Words APIs. I am not very familiar with the utility either whether it might work for your needs or not.
I would request Aspose.Words team to assist you in the right direction for your needs if possible.

Thank you.

Thank you.
Hi Hari,

Thanks for your inquiry.

First of all, please note that Microsoft Word and Microsoft Excel documents are completely different file formats; so, some features that are available in Microsoft Word are not available in Microsoft Excel and vice versa and it is hard to convert from Word to Excel and from Excel to Word with 100% fidelity. I think, you should simply decide what features are important to preserve during Word to Excel and Excel to Word conversions.

Unfortunately, there is no direct way to convert Excel document to Word. However, it is possible using Aspose.Words + Aspose.Cells. I have attached a simple converter for you (See the attached class). Here is how you should use it:

ConverterXls2Doc xls = new ConverterXls2Doc();

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(@"C:\Temp\in.xlsx");

Document doc = xls.Convert(wb);

doc.Save(@"C:\Temp\out.doc");

Hope this helps you.

Hi Hari,


Adding more to Tahir and Amjadā€™s comments, you can convert XLSX files to PDF format using Aspose.Cells and then convert PDF file to DOCX format using Aspose.Pdf for .NET. Please visit the following link for further details on Convert PDF file to DOC or DOCX format