以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  导出问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=125230)

--  作者:admin22327
--  发布时间:2018/9/23 9:10:00
--  导出问题
我设计的导出错了一列,帮我看看
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:添雨账务.table


--  作者:有点甜
--  发布时间:2018/9/23 13:48:00
--  

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()