officewriter - Export ado.net dataset into excel worksheets using softartisans Excelwriter -
i have ado.net dataset have 3 datatables let dataset name customer , tables accounts, purchases , profile . export them using softartisans excelwriter worksheets using templates
example
dataset mydataset = new dataset(); mydataset.tables.add("customer"); mydataset.tables.add("accounts"); mydataset.tables.add("purchases"); xlt.binddata(mydataset,null , xlt.createdatabindingproperties());
i export theses tables seperate excel worksheets.
the binddata method of officewriter's exceltemplate object has number of overloads. 1 accepts dataset not automatically import every datatable in dataset, imports first one. if want use every datatable in dataset, should use overload takes datatable (see documentation). example:
//the 2nd parameter datasource name must correspond first //part of datamarker in template workbook (i.e. %%=customer.firstname) xlt.binddata(ds.tables["customer"], "customer", xlt.createdatabindingproperties());
you in loop, this:
foreach (datatable table in mydataset.tables) { xlt.binddata(table, table.tablename, xlt.createdatabindingproperties()); }
Comments
Post a Comment