To create the templates required:
Create a template of the spreadsheet you are trying to create, with at least one data row.
Save the spreadsheet as an XML spreadsheet
Edit the XML spreadsheet with a text editor and replace all the dynamic sections except the data row with tags such as [[Tag1]], [[Tag2]], etc.
Find the data row and copy that to another file, replace it in the original file with a tag such as [[RowTag]].
Save the file.
Edit the row template and put tags in it in place of the data elements such as [[Col1]], [[Col2]], etc.To create the spreadsheet:
Use your favorite programming language to read the spreadsheet template into a string
Read the row template into a string
Replace all of the tags in the spreadsheet template except for the [[RowTag]] with the required dynamic values.
Create a variable to hold the row data
For each dynamically generated row of data:
Make a copy of the row template.
Update each column tag, [[Col1]], [[Col2]], etc. in the copy of the row template, with the dynamic data
Append the new row to the row data variable.
Replace the [[RowTag]] in the spreadsheet template with the contents of the row data variable.
Save and serve with your favorite browser.Note: It is possible to incorporate formulas using the same methods. Take a look at how the formulas save and create the appropriate tags in the spreadsheet and row templates. Replace as appropriate.
Google Search
Wednesday, June 4, 2008
create Excel in ASP.NET
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment