How to create Excel Doc on the fly from web apps?

H

harifajri

Hi,

i can generate an excel doc from console apps using C#
and by using the following :
using Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Runtime.InteropServices;

How do i create Excel Doc on the fly from web apps?

Rgds

HF
 
P

Patrick Steele

Hi,

i can generate an excel doc from console apps using C#
and by using the following :
using Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Runtime.InteropServices;

How do i create Excel Doc on the fly from web apps?

To be honest, you really shouldn't:

"All current versions of Microsoft Office were designed, tested, and
configured to run as end-user products on a client workstation. They
assume an interactive desktop and user profile, and do not provide the
level of reentrancy or security that is necessary to meet the needs of
server-side components that are designed to run unattended."

http://support.microsoft.com/kb/257757/en-us
 
M

Mark Rae [MVP]

i can generate an excel doc from console apps using C#
and by using the following :
using Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Runtime.InteropServices;

How do i create Excel Doc on the fly from web apps?

As Patrick has said, don't even consider using server-side Office
automation - Microsoft don't support it because it doesn't work...

Fortunately, creating Excel documents from ASP.NET (which I assume is what
you're using) is fairly simple:

1) Use HTML
Create an HTML document and give it a .xls extention - Excel will treat it
like a native Excel document. This is very simple and (obviously) free, but
you are limited to a single worksheet.

2) Use OpenXML
http://www.microsoft.com/downloads/...52-3547-420a-a412-00a2662442d9&displaylang=en
http://www.microsoft.com/downloads/...80-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en

Again, this is free, but is not for the faint-hearted... However, it will
allow you to create multi-sheet workbooks

3) Use Aspose
http://www.aspose.com/Products/Aspose.Cells/Default.aspx
This is by far the simplest solution, but it's a commercial product...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top