We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Template based extracts

I am planning to use aspose to generate excel, pdf and csv using excel based templates

However, I am not able to find any code

can you please help with some .net code C# sample?

Basically I am planning to have a predefined template set and then use the template to create new excel, pdf and csv using data from database

a sample code will help


Regards,

Manesh

Hi,


Well, there are two ways to accomplish your task.
1) You may try to use Smart Markers feature provided by Aspose.Cells, see the document for your complete reference:
http://www.aspose.com/docs/display/cellsnet/Smart+Markers

You may create a designer file which would contain smart markers. The markers are just like pointers (in the format i.e. &=Table1.Field1 etc.) which are bound to some data source (e.g Database) on back end. When the markers are processed, the data is filled into the cells accordingly. You may format the cells containing the smart markers in the template file so when the data is processed the formattings are also applied to the cells which are filled dynamically based on the data source.

2) Another way, is use simple template Excel file, here you will load/open your template Excel file and use some Importing data options provided by Aspose.Cells, see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets

You got to fill a data table and then use Cells.ImportDataTable() method to import data to your spreadsheet accordingly.


And, above all after adopting any approach and filling data into the workbook as mentioned above, you only need to add two lines at the end to save the copy of the workbook to PDF and CSV file formats, e.g
e.g
Sample code:

workbook.Save(“e:\test2\out1.pdf”, SaveFormat.Pdf);
workbook.Save(“e:\test2\out2.csv”, SaveFormat.CSV);

Hope, this helps you a bit.

Thank you.