Foxtable(狐表)用户栏目专家坐堂 → 导出excel列属性


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

主题:导出excel列属性

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/4 15:14:00 [显示全部帖子]

Dim tbl As Table = Tables("表A")
Dim hdr As Integer = tbl.HeaderRows
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Proc As New Process
tbl.CreateSheetHeader(Sheet,0,0,False)
Dim st As XLS.Style = Book.NewStyle() '定义新样式st.Format = "yyyy-MM-dd"
For c As Integer = 0 To tbl.Cols.Count - 1
    If tbl.Cols(c).IsDate Then
        For r As Integer = 0 To tbl.Rows.Count - 1
            sheet(r + hdr,c).value = tbl(r,c)
            sheet(r + hdr,c).Style = st
        Next
    Else
        For r As Integer = 0 To tbl.Rows.Count - 1
            sheet(r + hdr,c).value = tbl(r,c)
        Next
    End If
Next
Book.Save("c:\reports\test.xls")
Proc.File = "c:\reports\test.xls"
Proc.Start()

 回到顶部