Project DescriptionExports a DataTable/IEnumerable to Word / Excel / PDF / CSV / HTML / CSV
Can be customized
It's developed in C#
The project exports a Data Table or an IEnumerable of same objects to Word 2003- 2007 / Excel 2003 - 2007 / PDF / XML / HTML
Make extensive use of
- String Template - for rendering templates
- OfficeSDK for rendering the Word /Excel 2007
- itextsharp. for exporting to PDF from XML.
Can be customized because it is based on file templates.
NOTES :
Just download the latest source code from either
1) http://exporter.codeplex.com/SourceControl/ListDownloadableCommits.aspx or
2) Subversion URL: https://Exporter.svn.codeplex.com/svn or
3) TFS Server URL: https://tfs02.codeplex.com
And then goto ExportDemo\bin\Debug . There you will find ExportDemo.exe . Please ensure that you have write permissions for C: and run ExportDemo.exe . You will find the following files in C:
andrei.doc
andrei.docx
andrei.html
andrei.pdf
andrei.xls
andrei.xlsx
andrei.xml
Now, if you are satisfied with the demo, you can modify the templates to suit your needs and/or modify the source demo ( see Program.cs in ExportDemo)
For your convenience, I will list here
using www.serviciipeweb.ro.iafblog.ExportDLL; // extension methods for data table ...
static void Main(string[] args)
{
DataTable dta = new DataTable("andrei");
dta.Columns.Add(new DataColumn("ID", typeof(int)));
dta.Columns.Add(new DataColumn("Data", typeof(string)));
dta.Rows.Add(1, "test 1 & <");
dta.Rows.Add(2, "test 2 ");
dta.Rows.Add(3, "test 3 >"); // initial Data
dta.ExportTo(ExportToFormat.Excel2007, @"C:\andrei.xlsx");
dta.ExportTo(ExportToFormat.Word2003XML, @"C:\andrei.doc");
dta.ExportTo(ExportToFormat.Word2007, @"C:\andrei.docx");
dta.ExportTo(ExportToFormat.itextSharpXML, @"C:\aitext.xml");
dta.ExportTo(ExportToFormat.Excel2003XML, @"C:\andrei.xls");
dta.ExportTo(ExportToFormat.HTML, @"C:\andrei.html");
dta.ExportTo(ExportToFormat.XML, @"C:\andrei.xml");
dta.ExportTo(ExportToFormat.PDFtextSharpXML, @"C:\andrei.pdf");
System.Diagnostics.Process.Start("cmd.exe"," /K \"dir c:\\andrei.????\"");
return;
}
For any improvements wrote to

\
You can download the
first release