If you want to install Excel and adjust the security settings somewhat, you
can definitely do it through automation. I use VBSCript and just output
the contents of a datagrid to excel, but this is really limited in terms of
formatting and since I'm not using Automation , formatting is lame.
Another choice is FarPoint's Spread. I've used it extensively and it has a
desktop and a web version. If you get it from
www.xtras.net I think the
xtras subscription will pay for itself.
http://www.xtras.net/products/spreadwebforms.asp You don't need excel at
all but you want easily write to the native Excel format and you have
unbelievable power over it, in addition, users can use the Spread control
within a browser and you can use stuff like VLOOKUP and a whole lot of other
neat stuff on the browser - which is amazing b/c the user nor the server
need Excel. I do a fair amount of work and reviewing of third party tools
and Spread is without a doubt one of the finer tools I've encountered.
Everything Mike has over there is top notch and he's pretty anal about who
he features so if you have a few extra bucks, it's well worth the
investment.
If you just want to output a grid to excel though, you can set your
formatting in the grid stick a button on the form (HTML) and then just
invoke this <script language="vbscript">
Sub exportbutton_onclick
Dim sHTML, oExcel, oBook
sHTML = document.all.item("dgLogs").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub
</script>
</body>
</HTML>
HTH,
Bill
--
W.G. Ryan, eMVP
http://forums.devbuzz.com/ http://www.knowdotnet.com/williamryan.html http://www.msmvps.com/WilliamRyan/
"Guy Incognito" <an*******@devdex.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,
I've written an asp.net application that creates Excel documents. It
works by creating an excel document in XML format.
But I wonder if I'm reinventing the wheel. I know that there are ways to
read and write Excel files with ADO, but as far as I can tell, it
doesn't provide the flexibility I need. I need to be able to generate
tabs, cell formatting, formulas, etc.
Is there a better way to dynamically create an excel file from scratch
on an asp.net web server, through automation or otherwise? Are there any
open source projects that deal with this?
Thanks,
Jason
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!