Foxtable(狐表)用户栏目专家坐堂 → 导出日期不正确


  共有2290人关注过本帖树形打印复制链接

主题:导出日期不正确

帅哥哟,离线,有人找我吗?
lihe60
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:6886 积分:43605 威望:0 精华:0 注册:2009/3/2 14:07:00
导出日期不正确  发帖心情 Post By:2019/2/22 9:36:00 [只看该作者]

1、导出的日期格式不正确
2、列顺序不正确
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目3.foxdb


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110790 积分:563882 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/2/22 10:52:00 [只看该作者]

Dim tbl As Table = Tables("表A")
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.font = New Font("Arial",11) ',FontStyle.Bold Or FontStyle.Underline)
style.AlignHorz = XLS.AlignHorzEnum.Center
style.AlignVert = XLS.AlignVertEnum.Center
Style.BorderTop = XLS.LineStyleEnum.Thin
Style.BorderBottom = XLS.LineStyleEnum.Thin
Style.BorderLeft = XLS.LineStyleEnum.Thin
Style.BorderRight = XLS.LineStyleEnum.Thin
Style.BorderColorTop = Color.black
Style.BorderColorBottom = Color.black
Style.BorderColorLeft = Color.black
Style.BorderColorRight = Color.black

Dim St2 As XLS.Style = Book.NewStyle() '定义新样式
st2.font = New Font("Arial",11) ',FontStyle.Bold Or FontStyle.Underline)
St2.BorderTop = XLS.LineStyleEnum.Thin
St2.BorderBottom = XLS.LineStyleEnum.Thin
St2.BorderLeft = XLS.LineStyleEnum.Thin
St2.BorderRight = XLS.LineStyleEnum.Thin
St2.BorderColorTop = Color.black
St2.BorderColorBottom = Color.black
St2.BorderColorLeft = Color.black
St2.BorderColorRight = Color.black
St2.Format = "yyyy-MM-dd"

tbl.CreateSheetHeader(Sheet) '生成表头
Dim c As Integer =0
For Each c1 As Col In tbl.cols
    If c1.Visible Then
        For r As Integer = 0 To tbl.Rows.Count - 1
            sheet(r + hdr,cnt).value = tbl.Rows(r)(c1.Name)
            If c1.IsDate Then
                sheet(r + hdr,cnt).style = St2
            Else
                sheet(r + hdr,cnt).style = Style
            End If
            
        Next
        cnt = cnt + 1
        c=c+1
    End If
Next
c=0
For c=0 To Sheet.Cols.Count - 1
    Sheet(0, c).style = style
Next

Book.Save("e:\问题\test.xls")
Dim Proc As New Process
Proc.File = "e:\问题\test.xls"
Proc.Start()

 回到顶部