How to Export Excel Data to Word Table Maintaining Formatting in C#

Sometimes office staff may need to export selected cell range from Excel file to Word document displaying as a Word table, like below. It is easy to complete this task by copy-and-paste. This article focuses on how to programmatically transfer formatted Excel data as Word table using Spire.Office.

This solution requires Spire.XLS and Spire.Doc to be referenced in the same project, please download Spire.Office and add the related DLLs from bin folder to .NET assemblies. Then, let's get started with the code.

Step 1: Initialize an instance of Workbook and load a sample Excel file. Get the first worksheet from workbook.