I looking a sample how to do this “Combine with Essential DocIO to generate Word documents from Excel worksheets. You can easily create tables in a Word document by exporting a range of cell values, including their formatting, from the Excel worksheet into that Word document. Again, no need for Excel or Word to be installed.”
I can't find some internal converter like for pdf and the way to simple insert datatable. How can i do it? Should i do it cell by cell?
Hi Nina Zarina,
Thank you for using Syncfusion products.
We have prepared the sample for importing excel table data to word document and attached here for your reference. Please try the sample at your side and let us know if this helps you.
Please let us know if you need any further assistance.
Thank you, Shridar.
It was a very useful sample, but I have additional questions, first of all: how to convert merge cells?I try it with my excel file, result in attachment.
Sridhar, I found the how way to convert merge cells.
But I still need help to convert rich text, maybe you have some sample of it?
Hi Nina Zarina,
Thank you so much for the update.
Currently, we do not have support for converting the RTF text from excel table to work table. We are sorry for the inconvenience.
using (ExcelEngine excelEngine = new ExcelEngine())
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2016;
//Open the Excel workbook
FileStream fileStream = new FileStream(Server.MapPath("App_Data/Sample.xlsx"), FileMode.Open, FileAccess.ReadWrite);
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorksheet worksheet = workbook.Worksheets;
// Convert as bitmap
System.Drawing.Image image = worksheet.ConvertToImage(1, 1, 41, 4);
//Create a new Word document
WordDocument document = new WordDocument();
//Adds section to the document
IWSection section = document.AddSection();
//Adds new paragraph to the section
IWParagraph firstParagraph = section.AddParagraph();
MemoryStream stream = new MemoryStream();
byte imageBytes = stream.ToArray();
//Append the picture to the document
IWPicture picture = firstParagraph.AppendPicture(imageBytes);
//Save the document as .docx and download
document.Save("Output.docx", FormatType.Docx, Response, HttpContentDisposition.Attachment);