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
Post a Comment