private void ThreadMethod(WorksheetPart param) { try { var ws = new OpenXmlWorksheet(param, SharedStrings); OpenXmlWorksheets.Add(ws); } catch (XmlException) { return; } catch (InvalidDataException) { return; } catch (InvalidOperationException) { return; } }
private void AddWorksheet(OpenXmlWorksheet sheet) { OpenXmlWorksheets.Add(sheet); }
public static async Task InitAsync(WorksheetPart part, List<string> sharedString, Action<OpenXmlWorksheet> Callback) { var t = Task.Factory.StartNew(() => { try { var ws = new OpenXmlWorksheet(part, sharedString); return ws; } catch(XmlException) { return null; } catch(InvalidDataException) { return null; } catch(InvalidOperationException) { return null; } }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); await t; Callback.Invoke(t.Result); }