Reputation: 11801
I have a spreadsheet in an xlsx
-file, how can I easily convert it to a docx
-format with C#?
Upvotes: 0
Views: 5479
Reputation: 106916
You will have to decide how to format a spreadsheet within the bounds of a document. You will have to put some thought into that task.
To do the actual conversion you can use the Open XML SDK from Microsoft. It will allow you to open the Excel file, read it, create a Word document and save it. All this without having Office installed on the computer.
If you have both Excel and Word installed on the target computer for your application you can also use COM automation or Visual Studio Tools for Office to directly control and automate Excel and Office. You are able to control the selection in Excel, copy the selection to the clipboard and then paste it into Word.
Upvotes: 2