c# - How do I open a file that is opened in another application -


I have a winforms application that is loaded in Excel files for analysis Currently, the file excel to open Excel file Should not be open in advance otherwise FileIOException is thrown when I try and load in the file.

What do I want to do, read my application in the file, even if it is open in Excel rather than compelling the user to close the worksheet. Note that the application only needs to read the file in question, not writing it.

Is this possible?

You can try to run the fileshare. Redirection when opening a file:

 using  (var stream = new filestream (@ "d: \ myfile.xls", Flamemade. Open, File Access. Read, FileShare. Read-White }) {}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -