Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Jun 08, 2016 7:04 am

Hi,
I am evaluating your software from my company needs.We want to use image extraction from doc and pdf files.
While i was try to open a password protected word document using Word 2016 i got and unhandled exception.

"An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: Destination array was not long enough. Check destIndex and length, and the array's lower bounds."

Is there any way to check if the document is password protected?

I am using spiredoc .net 5.5 free edition

Thanks

Valentinos Loutsios

valentinos
 
Posts: 2
Joined: Tue Jun 07, 2016 7:03 am

Wed Jun 08, 2016 7:58 am

Hello,

Thank you for the posting.
Please try the following method to load the password protected document.
Code: Select all
document.LoadFromFile(string fileName, FileFormat fileFormat, string password);

If there is still the issue after testing, could you please provide us your word document can replicate the issue for investigation? If it is not available, you can send it to support@e-iceblue.com. Thank you for the assistance.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Wed Jun 08, 2016 9:02 am

Hello,

The issue is that i don't know if the file will be password protected. User will select a document for his/her pc therefore i cannot know if the document is password protected.

Thanks

valentinos
 
Posts: 2
Joined: Tue Jun 07, 2016 7:03 am

Wed Jun 08, 2016 9:42 am

Hello,

There is no direct way to detect if the file is password protected, you can only catch the exception with try/catch block and then do something else.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc