Dim tbl As Table = Tables("查询_Table1")
Dim hdr As Integer = tbl.HeaderRows '获得表头的层数
Dim cnt As Integer
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
tbl.CreateSheetHeader(Sheet) '生成表头
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.Format = "yyyy-MM-dd" '设置样式的字体颜色
For c As Integer = 0 To tbl.Cols.Count - 1
If tbl.Cols(c).Visible Then
If tbl.Cols(c).IsDate Then
Sheet.Cols(cnt).Style = Style
ElseIf tbl.Cols(c).IsBoolean Then
For r As Integer = 0 To tbl.Rows.Count - 1
If tbl.Rows(r).IsNull(c) = False
sheet(r + hdr,cnt).value = IIF(tbl(r,c),"√","")
End If
Next
Continue For
End If
For r As Integer = 0 To tbl.Rows.Count - 1
If tbl.Rows(r).IsNull(c) = False
sheet(r + hdr,cnt).value = tbl(r,c)
End If
Next
cnt = cnt + 1
End If
Next
Book.Save("d:\室内设计项目.xls")
Dim Proc As New Process
Proc.File = "d:\室内设计项目.xls"
Proc.Start()