Solved

In ASP.NET 4.0 using C#, how would you prevent READ-ONLY status when creating an Excel 2003 file by exporting records from GridView?

Posted on 2013-12-09
3
757 Views
Last Modified: 2013-12-10
I'm writing my first ASP.NET 4.0 application using C# with VS2010.

I am trying to export a stored procedure result set to an Excel 2003 file.

When I create the new Excel file, I notice that the title bar states that it is READ-ONLY.

Do you know how I can modify my following code to get rid of the READ-ONLY status on the Excel file?

My code is in the attachment:
----------------------------
ExcelExport.txt
0
Comment
Question by:zimmer9
  • 2
3 Comments
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39707878
As this file is considered "downloaded" for security reasons it is marked as read only. Try adding this site to trusted sites section in your browser( still I think it might not work and make the file read only)
0
 
LVL 8

Expert Comment

by:johny_bravo1
ID: 39707890
Try this,

var fInfo = new FileInfo(YourFilePathName );
fInfo.IsReadOnly = false;
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 39707898
I don't think the solution provided by johny_bravo1 will work here. No offense johny_bravo1. This read only message is different than standard read only file scenario. Also this file being generated on server side this method will not have any impact.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question