I have a web page that displays a DataGrid and now the customer wants there to be an option to open that data as an Excel file. I am able to create the Excel file and save it to the server, but cannot figure out how to open it. I did get a solution working
in VS, but that uses Interop. I’ve read on various forums where Microsoft does not recommend that, and in addition, I cannot find the dll to copy to my web server to even attempt to get that to work. Shouldn’t there be an easy way to just open an existing
Excel file? Does anyone provide similar functionality, and if so, how did you get it to work?
work with something similar to content-type setting. i guess ms-excel is the syntax to achieve the post task. Also the post is as basis with no truth to solution. past did recalled and putting it to you. chekc
I noticed your questions and it seemed to me that you need to display the data in Excel file (import data from datagrid to Excel ), and don't want to use Interop. Then why not you use Olebd(As Excel is a database technically, but that not allow format operation )
or find free API or components for this?
I've tried a couple of free API solutions but got various errors with each. I am currently trying to use Process.Start("file.xls"). This also works in my dev environment. However, the website is hosted at GoDaddy and running it there gives me this security
error
The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file
I tried setting the trust level to Full in the web.config file, but I can't accress the machine.config file at GoDaddy to allow an override for this setting.
Brian_Burgit
Member
264 Points
84 Posts
How do I open an Excel file from an ASPX page?
Jul 01, 2012 12:58 PM|LINK
Hello,
I have a web page that displays a DataGrid and now the customer wants there to be an option to open that data as an Excel file. I am able to create the Excel file and save it to the server, but cannot figure out how to open it. I did get a solution working in VS, but that uses Interop. I’ve read on various forums where Microsoft does not recommend that, and in addition, I cannot find the dll to copy to my web server to even attempt to get that to work. Shouldn’t there be an easy way to just open an existing Excel file? Does anyone provide similar functionality, and if so, how did you get it to work?
Thanks,
Brian
aspnet2sams
Participant
1772 Points
551 Posts
Re: How do I open an Excel file from an ASPX page?
Jul 01, 2012 01:24 PM|LINK
Brian_Burgit
work with something similar to content-type setting. i guess ms-excel is the syntax to achieve the post task. Also the post is as basis with no truth to solution. past did recalled and putting it to you. chekc
http://forums.asp.net/t/1819886.aspx/1?Response+ContentType+does+it+matter+
panric
Member
46 Points
19 Posts
Re: How do I open an Excel file from an ASPX page?
Jul 02, 2012 09:02 AM|LINK
Hi Brian,
I noticed your questions and it seemed to me that you need to display the data in Excel file (import data from datagrid to Excel ), and don't want to use Interop. Then why not you use Olebd(As Excel is a database technically, but that not allow format operation ) or find free API or components for this?
Best regards.
Brian_Burgit
Member
264 Points
84 Posts
Re: How do I open an Excel file from an ASPX page?
Jul 04, 2012 05:30 PM|LINK
I've tried a couple of free API solutions but got various errors with each. I am currently trying to use Process.Start("file.xls"). This also works in my dev environment. However, the website is hosted at GoDaddy and running it there gives me this security error
The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file
I tried setting the trust level to Full in the web.config file, but I can't accress the machine.config file at GoDaddy to allow an override for this setting.