Hi, I'd like to request a feature which would allow opening a spreadsheet as read-only to allow reading a spreadsheet even if a user has it open for editing.
ThanksStuart
Official response
Hi,
Apologize, I misunderstood what this feature request was for.
I judged only based on the feature's title and presumed that the feature was related to the workbook's protection (saving a file as read-only).
The feature you are looking for already exists in GemBox.Spreadsheet.
When using the following Load method GemBox.Spreadsheet will open a file with FileAccess.Read mode:
ExcelFile ef = ExcelFile.Load("Sample.xlsx");
This loading works even if the file is opened by another application.
In case you're using another Load method that accepts a stream then you'll need to make sure that the provided stream has the correct access option for your requirements, for example:
using (var stream = File.Open("Sample.xlsx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
ExcelFile ef = ExcelFile.Load(stream, LoadOptions.XlsxDefault);
// ...
}
I hope this helps.
If the problem remains please submit a support ticket and we'll investigate your issue.
Regards,
Mario
Comments (2)