Dim tbl As Table = Tables("出入库查询_商品列表")
Dim hdr As Integer = tbl.HeaderRows '获得表头的层数
Dim cnt As Integer
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.AlignHorz = XLS.AlignHorzEnum.Center
Style.AlignVert = XLS.AlignVertEnum.Center
Style.Font = New Font("宋体", 10) '设置字体
tbl.CreateSheetHeader(Sheet) '生成表头
For c As Integer = 0 To tbl.Cols.Count - 1
If tbl.Cols(c).Visible Then
For r As Integer = 0 To tbl.Rows.Count - 1
sheet(r + hdr,cnt).value = tbl(r,c)
Sheet(r,c).Style =Style
Next
cnt = cnt + 1
End If
Next
Book.Save("E:\文件导出\1.xls")
Dim Proc As New Process
Proc.File = "E:\文件导出\1.xls"
Proc.Start()
图片红色部分是样式 没变 不知道为什么
此主题相关图片如下:11111.png