public RangeFinder(ExcelBase Owner, string sheet) { this.eb = new Import(Owner.WorkBook); eb.Range = sheet; eb.UseHeaders = false; eb.InterMixedAsText = true; //DataTable dt = eb.Query(); try { eb.OpenConnection(); //get the number of rows and columns da = new OleDbDataAdapter( "select * from [" + sheet + "]", eb.Connection); dtSchema = new DataTable(); da.FillSchema(dtSchema, SchemaType.Source); cols = dtSchema.Columns.Count; int rows = (int)ExecuteScalar("select count(*) from [" + sheet + "]"); //fill the range object rng.From.Row = rng.From.Column = 1; rng.To.Row = rows; rng.To.Column = cols; min = (int)(cols * minfilled); //now rng contains the complete square range of data containing cells //try to narrow it by getting as much hits as possible DecreaseRange(); } finally { indexReader.Close(); eb.CloseConnection(); } }
public static IExcel GetExcel(string excelType = "original") { switch (excelType.ToLower()) { case "original": return(ExcelBase.GetExcel()); default: return(ExcelBase.GetExcel()); } }