以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] 那里出错了?excel样式 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=94778) |
-- 作者:114039247 -- 发布时间:2017/1/1 21:12:00 -- [求助] 那里出错了?excel样式 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() |
-- 作者:狐狸爸爸 -- 发布时间:2017/1/2 20:15:00 -- 你的问题是什么? 如果你不需要多层表头,直接: http://www.foxtable.com/webhelp/scr/1148.htm |