I have made a NuGet package that exports a List to Word(2003/2007) / Excel(2003/2007) / PDF / CSV / HTML.
It is made with Razor Templating – interpreted by WestWind Razor Engine ( source code at https://github.com/RickStrahl/Westwind.RazorHosting )
What it does it generates templates in Razor ( that can be freely modified after) and it generates the specific output.
The whole code is that simple
List<Electronics> list = Electronics.GetData();
List<Electronics> list = Electronics.GetData();
ExportList<Electronics> exp = new ExportList<Electronics>();
exp.PathTemplateFolder = Path.Combine(Environment.CurrentDirectory, "templates/electronics");
//export
exp.ExportTo(list, ExportToFormat.HTML, "a.html");
exp.ExportTo(list, ExportToFormat.CSV, "a.csv");
exp.ExportTo(list, ExportToFormat.XML, "a.xml");
exp.ExportTo(list, ExportToFormat.Word2003XML, "a_2003.doc");
exp.ExportTo(list, ExportToFormat.Excel2003XML, "a_2003.xls");
exp.ExportTo(list, ExportToFormat.Excel2007, "a.xlsx");
exp.ExportTo(list, ExportToFormat.Word2007, "a.docx");
exp.ExportTo(list, ExportToFormat.itextSharpXML, "a.xml");
exp.ExportTo(list, ExportToFormat.PDFtextSharpXML, "a.pdf");
GitHub Console Demo at https://github.com/ignatandrei/Export_Word_Excel_PDF_CSV_HTML
The Nuget package is at http://www.nuget.org/packages/Exporter/
YouTube demo at http://youtu.be/2CBdn6ru47M