Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private IWorksheet[] CreateSheets(Multipart multipart)
 {
     return(GetSheetMaps(multipart).Select(i => new MHTWorksheet(i.Key,
                                                                 multipart.Parts.FirstOrDefault(j => j.Location.Contains(i.Value)))).ToArray());
 }
Exemplo n.º 3
0
        public MHTWorkBook(Stream stream)
        {
            var multipart = new Multipart(stream);

            Worksheets = CreateSheets(multipart);
        }