''' <summary>
''' 获取从Excel文档到DataTable
''' </summary>
''' <param name="path">excel路径</param>
''' <returns>返回DataTable</returns>
''' <remarks>从excel文档导入到</remarks>
Private Function GetDataTable(path As String) As DataTable
Dim wb As Aspose.Cells.Workbook = New Aspose.Cells.Workbook()
wb.Open(path)
Dim cells As Aspose.Cells.Cells = wb.Worksheets("明细").Cells
Return cells.ExportDataTable(1, 0, cells.MaxDataRow, cells.Columns.Count, False)
End Function
''' 获取从Excel文档到DataTable
''' </summary>
''' <param name="path">excel路径</param>
''' <returns>返回DataTable</returns>
''' <remarks>从excel文档导入到</remarks>
Private Function GetDataTable(path As String) As DataTable
Dim wb As Aspose.Cells.Workbook = New Aspose.Cells.Workbook()
wb.Open(path)
Dim cells As Aspose.Cells.Cells = wb.Worksheets("明细").Cells
Return cells.ExportDataTable(1, 0, cells.MaxDataRow, cells.Columns.Count, False)
End Function
本文介绍了一种将Excel文件转换为DataTable的方法。使用Aspose.Cells库,通过指定路径打开Excel文件,并从中提取数据到DataTable中。
1万+

被折叠的 条评论
为什么被折叠?



