Last post Mar 14, 2010 04:22 PM by hans_v
Mar 01, 2010 12:48 PM|mohanvgopal|LINK
I am having an web application in asp.net/c# and hosted on a Windows 2003 Server SP2.
All parts of the application work fine except where I am intending to generate reports based on user data. I have written code to populate the excel report and is working perfectly fine in Win XP machine (development machine). But when it is published to
the server (using the publish option available in Visual Studio 2008), the excel file does not load and get populated.
Task manager window shows an excel application opened and being used for quite some time period. but after a couple of minutes, the CPU usage drops to zero and the instance is in memory for ever.
The same application executes perfectly as expected when run through IDE in local development machine.
Kindly help as i am struggling with this issue for past one week.
Excel C# Data Writing
exporting data to excel on ASP.net
.net excel open problem
Mar 01, 2010 05:49 PM|ignatandrei|LINK
99% on the server Excel has a message box or something.
If you can access the server, put Application.Visible = true and watch for errors!
Mar 02, 2010 03:16 AM|mohanvgopal|LINK
thanks for the info.
But I have gone through all the logs generated by the application and also the event viewer logs of the server machine. there is no error messages logged too.
In event viewer, there is an section "Microsoft Office Sessions", where in, an entry is made which reads as below.
ID: 16, Application Name: Microsoft Office Groove, Application Version: 5.1.2600.2180, Microsoft Office Version: 12.0.6425.1000. This session lasted 0 seconds with 0 seconds of active time. This session ended normally.
Apart from the above lone log, nothing else is logged.
Mar 02, 2010 03:52 AM|ignatandrei|LINK
When you run the first time excel , the Excel app shows you a register screen that you can enter your details. This screen is modal.
I am afraid that is that screen that blocks you.
Can you login on the server with ASP.NET credentials, start Excel?
Mar 13, 2010 10:29 AM|TATWORTH|LINK
I have written code to populate the excel report and is working perfectly fine in Win XP machine (development machine). But when it is published to the server (using the publish option available in Visual Studio 2008), the excel file does not load and get populated.
Microsoft recommend that Excel is not used is not used on a server in unattended mode. I suggest instead, that you use NPOI from
Mar 14, 2010 04:46 AM|DigiMortal|LINK
Don't use Excel in server because it doesn't scale and eats a lot of resources (unless you don't grow servers in your backyard). Starting from Excel 2003 (if I am correct) there is simple XML format that Excel supports - XML Spreadsheets. This XML format
is easy to use and it does not expect so much work from you as XLSX files (packing, unpacking, taking care of information in multiple files). You can also add formatting stuff to XML Spreadsheet. So why not using XML Spreadsheets?
BTW! NPOI and
ExcelPackage both use .NET packaging classes and these classes expect that your application can create temporary files (no zipping in memory). In cloud environments you have to modify these packages if you want to use them. Also if your shared hosting provider
has turned off writing files to disk you have a problem because you have to move to another compression library.
Mar 14, 2010 10:35 AM|mohanvgopal|LINK
hi all, thanks for your valuable time, comments and suggestions.
But i have set constraints from the clients to use only 97-2003 format excel files, since the client has not yet upgraded to the 2007 version of ms office.
secondly they want capability to generate from anywhere and everywhere so that people cant send an excuse that they were out of office and did not have remote access and all sort of excuses.
last but not the least, the client wont accept any third party components to be installed on their server and also would not allow creation of a local user account which has admin previleages and allow this application to impersonate this user.
so can you please suggest me round about ways to achieve with these constraints in place. I cant help changing the constraints since the marketing people have already accepted and committed this without any hesitation (as usual).
Mar 14, 2010 02:56 PM|DigiMortal|LINK
You don't need administrator permissions in server. If you use XML Spreadsheets then Excel 2003 is able to open and show them. XML Spreadsheet is XML file with pretty simple structure and you don't need anu other tools than those you can find from System.Xml
namespace. Take a look at the Office XML formats page in Wikipedia - there is example of XML Spreadsheet. You don't need any third-party tools or MS Office components installed on server.
You can use pure .NET code. :)
To make sure that users computer understand what user is downloading you must set correct content-type. For XML Spreadsheet you should use one of these content-types:
Mar 14, 2010 04:22 PM|hans_v|LINK
last but not the least, the client wont accept any third party components to be installed on their server
But you're using Excel? Just use
NPOI, you only need to put a dll in the bin directory, no need to install anything on the server. That's the beauty of .NET components...