Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:导出的excel表零值处理

1楼
g1j2h3 发表于:2025/1/2 11:36:00
如何让导出的excel表中的0值不显示

图片点击可在新窗口打开查看此主题相关图片如下:零值.png
图片点击可在新窗口打开查看

2楼
有点蓝 发表于:2025/1/2 11:44:00
怎么导的?
3楼
g1j2h3 发表于:2025/1/2 11:46:00
Dim tbl As Table = Tables("统计汇总_Table4")
Dim hdr As Integer = tbl.HeaderRows '获得表头的层数
Dim szs() As Integer = {250, 120, 50}
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Dim fnt As New Font("宋", 11)
Style.ForeColor = Color.black '设置样式的字体颜色
Style.AlignHorz = XLS.AlignHorzEnum.Center
Style.AlignVert = XLS.AlignVertEnum.Center
tbl.CreateSheetHeader(Sheet, 1, 0, False) '生成表头
Sheet.DefaultRowHeight = 35
Sheet.GridColor = Color.blue
For f As Integer = 0 To 2
    Sheet.Cols(f).Width = szs(f) '指定列宽
Next

For s As Integer = 3 To tbl.Cols.Count - 1
    Sheet.Cols(s).Width = 50 '指定列宽
Next

For c As Integer = 0 To tbl.Cols.Count - 1
    For r As Integer = 0 To tbl.Rows.Count - 1
        sheet(r + hdr + 1, c).value = tbl(r, c)
        Sheet.MergeCell(0, 0, 1, c + 1)
        Sheet(0, 0).Value = "接单送货汇总表"
        Sheet(r, c).Style = Style
        Sheet(r, c).Style.Font = fnt
    Next
Next

Dim St2 As XLS.Style = Book.NewStyle
St2.Font = New Font("微软雅黑", 15, FontStyle.Bold)
St2.AlignHorz = XLS.AlignHorzEnum.Center
St2.AlignVert = XLS.AlignVertEnum.Center
Sheet.Rows(tbl.Rows("0").Index).Style = st2



Book.Save("d:\data\接单送货汇总表.xls")
Dim Proc As New Process
Proc.File = "d:\data\接单送货汇总表.xls"
Proc.Start()
4楼
有点蓝 发表于:2025/1/2 12:02:00
For c As Integer = 0 To tbl.Cols.Count - 1
    For r As Integer = 0 To tbl.Rows.Count - 1
dim a as string= tbl(r, c)
if a>""
        sheet(r + hdr + 1, c).value = a
end if
        Sheet.MergeCell(0, 0, 1, c + 1)
5楼
g1j2h3 发表于:2025/1/2 12:20:00
谢谢大师

共5 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.