Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How do you open Excel in ASP.NET in read-only form?

 

I am using C# as the language and have tried to use:

1.) Process.Start() <-- Won't work for web servers

2.) Made a hyperlink to my Excel file

 

Is there a good way to open an Excel file with read-only permissions?

Posted

I create an Excel object with:

 

ExcelObj = new Excel.ApplicationClass();

ExcelObj.Visible = true;

Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(FILE_NAME, false, true, false, false, false, false, true, true, false, true, true, true, true, false);

 

But I still get errors when the program tries to launch Excel. What am I doing wrong?

Posted

From my experience, using the Excel application is not really a good idea. One of my problem I had was simply to close Excel. Everytime you declare an object you must free it with Marshal. If one of them is not realease, Excel won't quit.

 

Really troublesome on a web server where hundreds of users might open it. I suggest that you use something like CSV or any other file type. But learning what you want to do might help you find an alternate solution.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
Tell me what you are trying to do and we might find an alternative.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...