C# 使用Aspose.Cells 将DataGridView,ListView,DataTable导出为Excel 点此跳转
以下为C# 使用Aspose.Cells将Excel转换为DataTable
下载地址:Aspose.Cells
/// <summary> /// ExcelToDataTable /// </summary> /// <param name="path">导入路径</param> /// <returns></returns> [Obsolete] public static DataTable ExcelToDataTable(string path) { Workbook workbook = new Workbook(); try { workbook.Open(path); Cells cells = workbook.Worksheets[0].Cells; return cells.ExportDataTableAsString(0, 0, cells.MaxDataRow + 1, cells.MaxDataColumn + 1, true); } catch { return null; } }
评论前必须登录!
注册