Open-XML-SDK
Open-XML-SDK copied to clipboard
CancellationToken in DocumentFormat.OpemXml.Packaging.SpreadsheetDocument.Open function
Discussed in https://github.com/dotnet/Open-XML-SDK/discussions/1489
Originally posted by ahsanaman92 July 7, 2023 Version: DocumentFormat.OpenXml v2.20.0
I am working on an issue where the customer has reported that it takes a while for the DocumentFormat.OpemXml.Packaging.SpreadsheetDocument.Open function to determine a large Excel document (329 MB) is invalid over the network. Is there a plan to be able to pass a CancellationToken to the open function?
The function is passed a System.IO.Stream input like this: using (SpreadsheetDocument Doc = SpreadsheetDocument.Open(input, false))
@ahsanaman92 the challenge here is that we don't currently do anything async (the layers below us don't provide the APIs so it's not for lack of us wanting to) and the normal file open sync methods don't support that (i.e. no CancellationToken while opening a file). If we can get a way to hook that in, we could expose a method to do that.