Free Support Forum - aspose.com

Aspose can no longer open locked Excel files

Hello,

My application opens Excel files using code similar to this:

var workbook1 = new Workbook();
workbook1.Open(@"C:\asposetests\Test1.xls", FileFormatType.Default);

When we were using version 4.8.1.6 of Aspose.Cells , this code would work even if someone had the named file open in Excel.

Since moving to version 4.8.2.5 (and 4.9.0.0 which I just tried), this is no longer the case. If the Excel file is open, the code throws this error:

System.IO.IOException: The process cannot access the file 'C:\asposetests\Test1.xls' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Aspose.Cells.Workbook.Open(String fileName, FileFormatType type)

Is there any way we can get the old behaviour? Our users want to be able to keep their files open even while using them in our application.

Thank you,

Mishelle

Hi,

Please try the attached latest fix v4.9.0.2.

If you still find the issue, kindly post your template file here. We will check your issue soon.


Thank you.

This version does solve my problem.

Thanks much,

Mishelle