希望实现导入时可以选择文件地址,还有就是一个表格多个Sheet,也要可以选择导入的Sheet
在客户选择后 按在确认在导入数据
Dim Book As New XLS.Book(projectpath & "\20201128素冉报价册.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("素冉报价册").StopRedraw()
'注意以下数组中列名称的顺序,必须和Excel表中的列顺序一致
Dim nms() As String = {"序号","产品名称","型号","产品图片","规格(mm)长","规格(mm)宽","规格(mm)高","销售价","材质说明","颜色","配布/面料","备注","重量(KG)","体积(方)","包件数","分类"}
'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题
For n As Integer = 1 To Sheet.Rows.Count -1
Dim r As Row = Tables("素冉报价册").AddNew()
For m As Integer = 0 To nms.Length - 1
r(nms(m)) = Sheet(n,m).Value
Next
Dim fl As String = ProjectPath & "Attachments\" & r("_Identify") & ".jpg"
If Sheet(n,3).SaveImage(fl) Then '如果照片保存成功
r("产品图片") = fileSys.GetName(fl)
End If
Next
Tables("素冉报价册").ResumeRedraw()