Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Jul 25, 2012 3:13 pm

Hi,

We are evaluating the iceblue product.

We need to loop through all excel workbooks and worksheets in a specified folder and apply certain changes to each one. Our first step in our evaluation was to simply loop through each file and return the Count of Worksheets. The folder has 235 worksheets and one of them is "locked for editing by another user". Which is fine. In this case, i would like to nicely stop the process and inform the user which file is locked for editing. (this is not a protected file, it is locked for editing).

However, in the function that gets the worksheet count, the LoadFromFile is failing on this edit-locked spreadsheet and the try/catch is not trapping the accessviolation.

Any ideas on how I could trap this condition?

Thanks!

Public Function GetWorkSheetCount(ByVal strFilePath As String)
Dim WorkbookSource As New Workbook()

Try
WorkbookSource.LoadFromFile(strFilePath, ExcelVersion.Version2007)
Catch ex As AccessViolationException
MsgBox(ex.Message)
End Try

GetWorkSheetCount = WorkbookSource.Worksheets.Count

WorkbookSource.Dispose()

End Function

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Wed Jul 25, 2012 3:17 pm

** Update, my apologies. It turns out the LoadFromFile is leaving the xlsx file in a Locked for Editing state.

It appears the the load from file may be finding some corrupt data in the workbook that bypasses any checks performed by Excel, Excel opens the file with no issues.

This may be unrelated to the LoadFromFile.

Thanks,

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Thu Jul 26, 2012 1:52 am

Hi dfowler,

Thanks for evaluating our product.

Please contact us if you have any problems.

Have a great day!

Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Aug 06, 2012 9:18 pm

Amy, thanks for your reply.

The access violation has come up again with another workbook. In debuggin my code I don't get much feedback from the LoadFromFile object.

The workbook can be opened within Excel without issue.

If I delete the Workbook, the process works normally, so it must be something within the workbook that the LoadFromFile does not like.

Could I send you the Workbook and see if you all can reproduce and debug?

Thanks
Daniel

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Tue Aug 07, 2012 2:26 am

Hi dfowler,

Could you send us your workbook? So that we can reproduce your problem quickly.Thanks.

Best wishes.

Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Aug 07, 2012 8:09 pm

Hi Amy, the file causing the issue is attached here in a ZIP file.

Thank you very much.
Daniel
Attachments
LoadFromFileExample.zip
(182.73 KiB) Downloaded 525 times

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Wed Aug 08, 2012 3:33 am

Hi Daniel,

I have reproduced your problem. We have created a research and are trying to fix it. Once it has be fix, we will inform you immediately.
If you have any problems, please feel free to contact us.

Have a nice day!

Best wishes.
Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Aug 08, 2012 7:42 pm

Thank you very much Amy.

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Wed Aug 08, 2012 8:18 pm

Amy, one other comment while you perform you research.

A standard Try/Catch within VB .NET is not trapping the access violation which keeps me from providing feedback to the user and crashing gracefully.

Try
WorkbookSource.LoadFromFile(strFilePath, ExcelVersion.Version2010)
Catch ex As Exception
MsgBox(ex.Message)
End Try

Thanks,
Daniel

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Wed Aug 08, 2012 9:40 pm

Hi Amy,

Our team has found what we believe may be the issue. I have attached a zip with some screen shots and explanation.

Thank you for your time.

Daniel
Attachments
IceBlue_RW_Screenshots..zip
(73.7 KiB) Downloaded 554 times

dfowler
 
Posts: 7
Joined: Tue Jul 24, 2012 7:40 pm

Thu Aug 09, 2012 10:06 am

Hi Daniel,

Thanks your provide. It does help us. For the issue, we need some time to fix it. Once it has been fixed, we will inform you immediately.

Have a nice day!

Best wishes.
Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Fri Aug 24, 2012 8:32 am

Hi Daniel,

Thanks for your patience and so sorry for the long-time waiting.
The issue you reported is already resolved. Please download the latest hot fix Spire.Xls(v6.8.5 ) here(http://www.e-iceblue.com/Download/download-excel-for-net-now.html).
If you hava any problems, please feel free to contact us.

Best wishes.
Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS