public DataTable GetDataTableToExcelByHeard(string filename, int sheetindex, int[] rowColumnNum, string headName, Stream StremContent) { DataTable tables = null; if (StremContent == null) { StremContent = new FileInfo(filename).OpenRead(); } NIPOIReadExcel niponstrem = new NIPOIReadExcel(filename); if (filename.IndexOf(".xls") > 0) //2003 Excel { tables = niponstrem.GetExcelToTable03(StremContent, sheetindex, rowColumnNum, headName); } return(tables); }
private DataTable GetDataTableToExcel(string fileName, string sheetName, int sheetIndex, Stream StremContent) { DataTable tables = null; if (StremContent == null) { StremContent = new FileInfo(fileName).OpenRead(); } //Stream StremContent = new FileInfo(fileName).OpenRead(); NIPOIReadExcel niponstrem = new NIPOIReadExcel(fileName); if (fileName.IndexOf(".xlsx") > 0) //2007 Excel { tables = niponstrem.GetExcelToTable07(StremContent, sheetName, sheetIndex); } else if (fileName.IndexOf(".xls") > 0) //2003 Excel { tables = niponstrem.GetExcelToTable03(StremContent, sheetName, sheetIndex); } return(tables); }