dera support,
Hi Guido,
Thanks for your posting and using Aspose.Cells.
We were not able to observe this issue with the latest version: Aspose.Cells for .NET 8.2.2. When file is loaded by Aspose.Cells, Excel is able to load it and user is also able to save the contents.
Please note, when Aspose.Cells saves the workbook, it creates a new file, the contents of old file are deleted or overwritten. So, suppose if some file say C:\abc.xlsx is already open in Excel, then Aspose.Cells will not be able to save to C:\abc.xlsx and it will give exception saying
The process cannot access the file ‘C:\abc.xlsx’ because it is being used by another process.
So, you must release abc.xlsx file from Excel in order Aspose.Cells could save it in abc.xlsx file.
If you open “c:\abc.xlsx” file in Aspose.Cells and then also open it in MS-Excel. MS-Excel will be able to open the file too. It means, Aspose.Cells does not lock the file from opening. Instead, Aspose.Cells read the contents of file and leave the file as it is i.e unlocked.
Please see the following code. You can also try it at our end. Here all the bytes of the files are read and Aspose.Cells creates a workbook object from memory stream, so there is no question of locking the file arises.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\test.xls”;
//Read all bytes of the file
byte[] fileData = File.ReadAllBytes(filePath);
//Create memory stream from the read bytes
MemoryStream ms = new MemoryStream();
ms.Write(fileData, 0, fileData.Length);
//Open the workbook from memory stream now
Workbook workbook = new Workbook(ms);