I have an excel – file that works as a template for data to be generated. I need to modify this Excel-Sheet, duplicate it a few times and add data to it.
I tried using excellibrary from nuget the following way:
Workbook tmpl = Workbook.Load("template.xlt");
tmpl.Save("newFile.xls");
As you can see I do nothing at all: Just opening the Excel File and saving it under a different name.
The Problem is:
All the content is inside the target xls, but all Styles are gone (Font sizes, Colors, etc.)
Using an XLS file instead of a xlt when loading does not change a thing.
Is there a way to solve this or another library that works better?
I would recommend using the OpenXML SDK from Microsoft. It allows you to do about anything with the newer xlsx files (Excel 2007 and up) using C#.
Answer:
I suggest you to try NPOI this one gives you the ability to serve the Temple structure. i was having problem with the template editing i solved by sing this. this might help you.
for more help about this you can view Create excel file
Answer:
Another Library you can Try is ClosedXML, in my experience it makes it very easy to manipulate Excel documents.