以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 导出的表格没有网格线 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=107497) |
-- 作者:lihe60 -- 发布时间:2017/9/29 7:03:00 -- 导出的表格没有网格线 Dim dt As Table = e.Form.controls("table1").Table Dim Book As New XLS.Book \'定义一个Excel工作簿 Dim Sheet As XLS.Sheet = Book.Sheets(0) \'引用工作簿的第一个工作表 Dim Style As XLS.Style = Book.NewStyle() \'定义新样式 Style.BorderTop = XLS.LineStyleEnum.Thin Style.BorderBottom = XLS.LineStyleEnum.Thin Style.BorderLeft = XLS.LineStyleEnum.Thin Style.BorderRight = XLS.LineStyleEnum.Thin Style.BorderColorTop = Color.Red Style.BorderColorBottom = Color.Red Style.BorderColorLeft = Color.Red Style.BorderColorRight = Color.Red For c As Integer = 0 To dt.Cols.Count -1 \'添加列标题 Sheet(0, c).Value = dt.Cols(c).Name Next For r As Integer = 0 To dt.Rows.Count - 1 \'填入数据 For c As Integer = 0 To dt.Cols.Count -1 Sheet(r +1, c).Value = dt.rows(r)(c) Next Next Dim St2 As XLS.Style = Book.NewStyle St2.Format = "yyyy-MM-dd" Sheet.Cols(dt.Cols("出生日期").Index).Style = st2 \'打开工作簿 Book.Save("c:\\reports\\test.xls") Dim Proc As New Process Proc.File = "c:\\reports\\test.xls" Proc.Start() |
-- 作者:有点甜 -- 发布时间:2017/9/29 9:23:00 -- Dim dt As Table = Tables("表c") \'e.Form.controls("table1").Table Dim Style As XLS.Style = Book.NewStyle() \'定义新样式 Dim St2 As XLS.Style = Book.NewStyle() \'定义新样式
|