-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
How can we open password protected excel file with npoi? #170
Comments
@karanjshah, hi you can use this code from the [NPOI.TestCases] project (https://github.com/tonyqus/npoi/blob/master/testcases/main/POIFS/Crypt/TestDecryptor.cs):
But this code is not working, because NPOI.POIFS.Crypt namespace is missing (Crypt folder is excluded from the project) for some reason... @tonyqus, can you confirm it was excluded by mistake? |
any update on this ? |
Would love to hear an update! |
Hello @tonyqus , do you have an estimated date to have this issue solved? |
+1 |
I would like to see an update/timeline on this also. I am trying to open an Excel 2016 password protected file but I get errors. this is the error I get.... System.IO.IOException This exception was originally thrown at this call stack: I This is the code I used...
|
Hello, Is there any fix for this. I would like to open and read a Password protected Excel file on the server-side. I used the below code. ` Public Sub open_2()
` |
+1 Would like to have this feature in our toolbelt. |
@Bykiev NPOI.POIFS.Crypt is included but I notice that there are a few methods in this namespace, which are not implemented |
is there any update on this because I have been facing this issue since very long and I need a fix urgently. Else i will have to use other library. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I noticed that, some files, even if they are password-protected, can still be open with Excel without an issue. These files have only their structure protected, but contents can still be read. Is it possible to open such files in read-only mode, without specifying a password and without triggering an exception? |
I found this PR just after creating a workaround myself. I tested it and I can confirm #883 works like a charm! |
I'm testing code of #883. Looks it's not fully working. @tim-ruecker can you give me a sample code that is working on your side? Exception I got: |
@tonyqus This exception is commented out in #883: npoi/main/POIFS/Crypt/CryptoFunctions.cs Lines 212 to 214 in b5f9afd
Are you sure you checked out the right branch? This is how I open the workbook:
|
My bad. I used the wrong branch. Looks it works very well. |
@tonyqus Great. Any chance we can have this added to 2.6.0? |
Great, huge big thanks to all of you! @KnyazSh @tonyqus @tim-ruecker |
@tim-ruecker #883 will be shipped with 2.6.0. I've merged the PR. |
How can I encrypt the xlsx? With this way I only can decrypt the file, right? @tonyqus |
@JulienLeal It's not supported. |
I have 2.6.0 and trying to open a sheet where the tabs are password protected against changes and this line gives me an error: Note, I am inside a using statement after opening a stream when I execute that line. Error indicates the supplied data is Office 2007+ XML. It's an xlsx file just like in the example from @tim-rue so not sure what's going wrong. |
@egtalbot POIFSFileSystem is for xls only. Please try the following code: |
Thanks - I did try that and it failed to create. I tried so many things I can't even remember what the error was, but I'm moving back to ExcelDataReader. I do appreciate the response |
If anyone can guide me that how can we access password protected file with NPOI in c# then it would really very grateful for me.
Thank You
The text was updated successfully, but these errors were encountered: