Exemple #1
0
        public static DataSet AsDataSet(this ExcelOpenXmlReader self, DataSetConfig config)         //DONE
        {
            Log("Extracting Sheets to DataSet");
            Log(@"config: {{
    TableSelect = {0},
    DataTableConfigSelect = {1}
}}",
                string.Join(".", config.TableSelect.Method.DeclaringType?.Namespace, config.TableSelect.Method.DeclaringType?.Name, config.TableSelect.Method.Name).TrimStart('.'),
                string.Join(".", config.DataTableConfigSelect.Method.DeclaringType?.Namespace, config.DataTableConfigSelect.Method.DeclaringType?.Name, config.DataTableConfigSelect.Method.Name).TrimStart('.')
                );
            var result = new DataSet();

            do
            {
                try
                {
                    config.TableSelect(self, config);
                }
                catch
                {
                    break;
                }
                result.Tables.Add(AsDataTable(self, config.DataTableConfigSelect(self, config)));
            } while (self.NextResult());
            result.AcceptChanges();
            Log($"Finished Extracting {result.Tables.Count} Sheet(s) to DataSet");
            return(result);
        }
Exemple #2
0
 public static DataSet AsDataSetExt(this ExcelOpenXmlReader self, DataSetConfig config = null) => AsDataSet(self, config ?? new DataSetConfig());