Dim dt2 As Table = Tables("出货情况记录")
If dt2.Rows.Count > 0 Then
book.Sheets.Add
Dim Sheet2 As XLS.Sheet = Book.Sheets(2) '引用工作簿的第一个工作表
sheet2.name ="出货明细"
For c2 As Integer = 0 To dt2.Cols.Count -1 '添加列标题
Sheet2(0, c2).Value = dt2.Cols(c2).Name
Next
For r2 As Integer = 0 To dt2.Rows.Count - 1 '填入数据
For c2 As Integer = 0 To dt2.Cols.Count -1
Sheet2(r2 +1, c2).Value = dt2.rows(r2)(c2)
Next
Next
End If
'打开工作簿
Book.Save( dpth & "导出数据.xls")
Dim Proc As New Process
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\Report.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.Range("A:A").NumberFormat = "yyyy-m-d" '日期
Ws.Range("C:C").NumberFormat = "yyyy-m-d h:mm:ss" '时间
Proc.File = dpth & "导出数据.xls"
Proc.Start()
求助 红色部分是不是设置的位置不对,
我想导出数据到EXCEL后,直接把 导出的 excel 部分单元格的日期格式修改,求帮助