以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  这个代码 为啥不能去掉小数点  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=67604)

--  作者:blackzhu
--  发布时间:2015/4/27 14:28:00
--  这个代码 为啥不能去掉小数点
rt.Width = "Auto" \'表格宽度为自动,也就是等于各列设置宽度之和
\'rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded \'表格宽度超出页宽时,可以水平换页
rt.Style.Font = tb.Font
For c As Integer = 0 To ColNames.Count - 1 \'逐列设置和填入内容
    rt.Cells(0,c).Text = ColNames1(c)
    rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
    rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth \'列宽等于实际列宽
    If tb.DataTable.DataCols(ColNames(c)).IsNumeric Then
        tb.DataTable.DataCols(ColNames(c)).SetFormat("0")
    End If
    If tb.Cols(ColNames(c)).IsNumeric OrElse tb.Cols(ColNames(c)).IsDate OrElse tb.Cols(ColNames(c)).IsString Then \'如果是数值或日期列
        rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'数据水平靠右
    End If
    For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容
        rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c))
    Next
Next


--  作者:Bin
--  发布时间:2015/4/27 14:40:00
--  
新项目测试没有问题,你是否没有没有指定到这句代码,或者有其他地方影响
--  作者:blackzhu
--  发布时间:2015/4/27 14:41:00
--  
那奇怪了