Creating an MDB/XLS file

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

Using ASP.NET/VB.NET and SQL Server backend,
I need to return calculation results to user as an Access MDB file or Excel
XLS sheet.
What would be the best way to create a MDB or XLS file inside a .NET
program?

Thanks,
Ali
 
Hi Ali,

Firstly I want to thank Dino for his great help in this issue. Please check
his response carefully.

In addition, the following article is what Dino has mentioned in his post.

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=kb;en-us;257757
"...
Microsoft does not currently recommend, and does not support, Automation of
Microsoft Office applications from any unattended, non-interactive client
application or component (including ASP, DCOM, and NT Services), because
Office may exhibit unstable behavior and/or deadlock when run in this
environment.
..."

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I'd drop the idea of creating an MDB.

But on the excel side, you don't have to using office automation to "create"
an excel spreadsheet. Excel know how to parse HTML tables, so you can
create a spreadsheet that way.

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "filename=" + "calculations.xls")
Response.write("<table><tr><th>Data</th><td>2</td></tr></table>")
Response.End

If you are using VS.NET make sure to remove everything from the .aspx file
except for the <% @Page ...%> directive.

Don't change the name of the page from .aspx! That is handled by the
Content-Disposition header

If you provide a link to this page, the user will be prompted to download
the .xls file or open it in Excel.

If you need actual formulas and stuff in the spreadsheet, you'll have to do
some experimenting. Don't know if that can be done.
 
Back
Top