private KeyValuePair <string, string>[] GetSheetMaps(Multipart multipart) { KeyValuePair <string, string>[] result = null; var reg = new Regex(SheetsReg, RegexOptions.IgnoreCase); foreach (var part in multipart.Parts) { var matches = reg.Matches(part.ToString()); if (matches.Count > 0) { result = matches.Cast <Match>().Select(i => GetMap(i.Value)).ToArray(); break; } } return(result); }
private IWorksheet[] CreateSheets(Multipart multipart) { return(GetSheetMaps(multipart).Select(i => new MHTWorksheet(i.Key, multipart.Parts.FirstOrDefault(j => j.Location.Contains(i.Value)))).ToArray()); }
public MHTWorkBook(Stream stream) { var multipart = new Multipart(stream); Worksheets = CreateSheets(multipart); }