0

I noticed that when calling SpreadsheetGear's Factory.GetWorkbook(filename) method, that it can successfully read in the file, even if that file is currently open in Excel.

I'm guessing the method is doing something like opening a FileStream using FileShare.ReadWrite ? e.g. like:

FileStream fsSource = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)

This is overall a useful feature, but I'm wondering if there are possible edge case scenarios to be aware of ? e.g. maybe if, as the file is being read, the user saves changes to the file in Excel.

Moe Sisko
  • 11,665
  • 8
  • 50
  • 80
  • `if there are possible edge case scenarios to be aware of ? e.g. maybe if, as the file is being read, the user saves changes to the file in Excel.` Well obviously that would be a problem, yes. If you are reading a copy of a file being edited elsewhere, there is always a risk the two will get out of sync. – mjwills Sep 07 '22 at 05:41
  • I wasn't able to create a error in our application on simultaneous Spreadsheetgear upload and Excel save of a 3MB file . The timing of the two processes will determine whether Spreadsheetgear receives the old or new file. It is a bit hard to test but from what I can see Spreadsheetgear will get the old file if it starts before the Excel save process is incomplete. – Xcheque Sep 07 '22 at 23:52

0 Answers0