public ExcelTableTemplate Parse(string filepath) { var templateMetadata = new TemplateMetaData(); if (filepath.StartsWith("/")) { filepath = HostingEnvironment.MapPath(filepath); } FilePath = filepath; ParserContext context = new ParserContext(filepath); ISpreadsheetParser parser = ParserFactory.CreateSpreadsheet(context); ToxySpreadsheet ss = parser.Parse(); foreach (var table in ss.Tables) { _currTable = table; for (_currRowIndex = 0; _currRowIndex < table.Rows.Count; _currRowIndex++) { var row = table.Rows[_currRowIndex]; for (_currColIndex = 0; _currColIndex < row.Cells.Count; _currColIndex++) { var cell = row.Cells[_currColIndex]; var tabletoken = ParseTable(cell); if (tabletoken != null) { templateMetadata.Tables.Add(tabletoken); } else { var cellToken = ParseCell(cell); if (cellToken != null) { templateMetadata.Cells.Add(cellToken); } } } } } return(null); }
public ExcelTableTemplate Parse(string filepath) { var templateMetadata = new TemplateMetaData(); if (filepath.StartsWith("/")) filepath = HostingEnvironment.MapPath(filepath); FilePath = filepath; ParserContext context = new ParserContext(filepath); ISpreadsheetParser parser = ParserFactory.CreateSpreadsheet(context); ToxySpreadsheet ss = parser.Parse(); foreach (var table in ss.Tables) { _currTable = table; for (_currRowIndex = 0; _currRowIndex < table.Rows.Count; _currRowIndex++) { var row = table.Rows[_currRowIndex]; for (_currColIndex = 0; _currColIndex < row.Cells.Count; _currColIndex++) { var cell = row.Cells[_currColIndex]; var tabletoken = ParseTable(cell); if (tabletoken != null) { templateMetadata.Tables.Add(tabletoken); } else { var cellToken = ParseCell(cell); if (cellToken != null) { templateMetadata.Cells.Add(cellToken); } } } } } return null; }