以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表金额问题请教老师  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=29899)

--  作者:mamuaiqing
--  发布时间:2013/3/16 1:23:00
--  专业报表金额问题请教老师

上图上项目,当"借方发生额"为20000.05的时候就出现图中那样的方框,连"摘要"的内容也变方框了,请教老师代码要怎么修改

Dim doc As New PrintDoc \'定义一个报表
Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rx As New prt.RenderText \'定义一个文本对象
Dim tb As Table = Tables("表A")
doc.AutoRotate = False \'禁止自动旋转打印内容
doc.PageSetting.Landscape = True \'横向打印
doc.PageSetting.PaperKind = 9 \'纸张类型改为B5
Doc.PageSetting.LeftMargin = 14 \'设置左边距
Doc.PageSetting.RightMargin = 1 \'设置右边距
Doc.PageSetting.TopMargin = 3 \'设置上边距
Doc.PageSetting.BottomMargin = 3 \'设置下边距

rt = New prt.RenderTable
rt.Rows.Count = 25 \'设置总行数
rt.Cols.Count = 25 \'设置总列数
rt.Height = 204 \'设置表格的高度为80毫米
rt.Width = 280
rt.Rows(0).Height = 8 \'设置第7行
rt.Rows(1).Height = 8 \'设置第7行高度
rt.Cols(0).Width = 35
rt.Cols(1).Width = 50
rt.Cols(23).Width = 35
rt.Cols(24).Width = 35

\'设置合并单元格
rt.Cells(0,0).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,12).SpanRows = 25 \'第1行第5个单元格向下合并2行
rt.Cells(0,1).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,23).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,24).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,2).SpanCols = 10 \'第1行第2个单元格向右合并10列
rt.Cells(0,13).SpanCols = 10 \'第1行第2个单元格向右合并10列

\'设置表格样式
rt.Style.FontSize = 13
rt.Rows(0).Style.FontSize = 14 \'字体大小为16磅
rt.Rows(1).Style.FontSize = 12 \'字体大小为16磅
rt.Style.FontBold = True \'字体加粗
rt.Cells(0,0).Text = "日    期"
rt.Cells(0,1).Text = "摘             要"
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(0,2).Text = "借方发生额"
rt.Cells(0,13).Text = "贷方发生额"
rt.Cells(0,23).Text = "汇款银行"
rt.Cells(0,24).Text = "款项来源"
rt.Cells(1,2).Text = "千"
rt.Cells(1,3).Text = "百"
rt.Cells(1,4).Text = "十"
rt.Cells(1,5).Text = "万"
rt.Cells(1,6).Text = "千"
rt.Cells(1,7).Text = "百"
rt.Cells(1,8).Text = "十"
rt.Cells(1,9).Text = "元"
rt.Cells(1,10).Text = "角"
rt.Cells(1,11).Text = "分"

rt.Cells(1,13).Text = "千"
rt.Cells(1,14).Text = "百"
rt.Cells(1,15).Text = "十"
rt.Cells(1,16).Text = "万"
rt.Cells(1,17).Text = "千"
rt.Cells(1,18).Text = "百"
rt.Cells(1,19).Text = "十"
rt.Cells(1,20).Text = "元"
rt.Cells(1,21).Text = "角"
rt.Cells(1,22).Text = "分"

rt.Style.GridLines.All = New prt.Linedef \'设置网格线
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'内容水平居中
\'下面很简单,指定每一个单元格的内容
For r As Integer = 0 To tb.Rows.Count - 1 \'遍历关联表每一行
    rt.Cells(r+2,0).Text = Format(tb.rows(r)("日期"),"yyyy年MM月dd日")
    rt.Cells(r+2,1).Text = tb.rows(r)("摘要")
    Dim money As String = tb.rows(r)("借方发生额")
    rt.Cells(r+2, 9 - money.length).Text = GetDigit(CDbl(money), money.Length) \'等于"¥"
    For i As Double = 9 To 10 - money.Length Step -1
        rt.Cells(r+2, i).Text = GetDigit(CDbl(money), 9-i)
    Next
Next
doc.Body.Children.Add(rt) \'将表格对象加入到报表中
Doc.Preview() \'预览报表


--  作者:mamuaiqing
--  发布时间:2013/3/16 1:24:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目12.zip


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

--  作者:狐狸爸爸
--  发布时间:2013/3/16 9:01:00
--  

Dim doc As New PrintDoc \'定义一个报表
Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rx As New prt.RenderText \'定义一个文本对象
Dim tb As Table = Tables("表A")
doc.AutoRotate = False \'禁止自动旋转打印内容
doc.PageSetting.Landscape = True \'横向打印
doc.PageSetting.PaperKind = 9 \'纸张类型改为B5
Doc.PageSetting.LeftMargin = 14 \'设置左边距
Doc.PageSetting.RightMargin = 1 \'设置右边距
Doc.PageSetting.TopMargin = 3 \'设置上边距
Doc.PageSetting.BottomMargin = 3 \'设置下边距

rt = New prt.RenderTable
rt.Rows.Count = 25 \'设置总行数
rt.Cols.Count = 25 \'设置总列数
rt.Height = 204 \'设置表格的高度为80毫米
rt.Width = 280
rt.Rows(0).Height = 8 \'设置第7行
rt.Rows(1).Height = 8 \'设置第7行高度
rt.Cols(0).Width = 35
rt.Cols(1).Width = 50
rt.Cols(23).Width = 35
rt.Cols(24).Width = 35

\'设置合并单元格
rt.Cells(0,0).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,12).SpanRows = 25 \'第1行第5个单元格向下合并2行
rt.Cells(0,1).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,23).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,24).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,2).SpanCols = 10 \'第1行第2个单元格向右合并10列
rt.Cells(0,13).SpanCols = 10 \'第1行第2个单元格向右合并10列

\'设置表格样式
rt.Style.FontSize = 13
rt.Rows(0).Style.FontSize = 14 \'字体大小为16磅
rt.Rows(1).Style.FontSize = 12 \'字体大小为16磅
rt.Style.FontBold = True \'字体加粗
rt.Cells(0,0).Text = "日    期"
rt.Cells(0,1).Text = "摘             要"
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(0,2).Text = "借方发生额"
rt.Cells(0,13).Text = "贷方发生额"
rt.Cells(0,23).Text = "汇款银行"
rt.Cells(0,24).Text = "款项来源"
rt.Cells(1,2).Text = "千"
rt.Cells(1,3).Text = "百"
rt.Cells(1,4).Text = "十"
rt.Cells(1,5).Text = "万"
rt.Cells(1,6).Text = "千"
rt.Cells(1,7).Text = "百"
rt.Cells(1,8).Text = "十"
rt.Cells(1,9).Text = "元"
rt.Cells(1,10).Text = "角"
rt.Cells(1,11).Text = "分"

rt.Cells(1,13).Text = "千"
rt.Cells(1,14).Text = "百"
rt.Cells(1,15).Text = "十"
rt.Cells(1,16).Text = "万"
rt.Cells(1,17).Text = "千"
rt.Cells(1,18).Text = "百"
rt.Cells(1,19).Text = "十"
rt.Cells(1,20).Text = "元"
rt.Cells(1,21).Text = "角"
rt.Cells(1,22).Text = "分"

rt.Style.GridLines.All = New prt.Linedef \'设置网格线
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'内容水平居中
\'下面很简单,指定每一个单元格的内容
For r As Integer = 0 To tb.Rows.Count - 1 \'遍历关联表每一行
    rt.Cells(r+2,0).Text = Format(tb.rows(r)("日期"),"yyyy年MM月dd日")
    rt.Cells(r+2,1).Text = tb.rows(r)("摘要")
    Dim money As Integer = tb.rows(r)("借方发生额")
    If money > 0 Then
        For i As Double = 9 To 2 Step - 1
            rt.Cells(r+2, i).Text = GetDigit(Money,9-i)
            If rt.Cells(r+2, i).Text =  "¥" Then
                Exit For
            End If
        Next
    End If
Next
doc.Body.Children.Add(rt) \'将表格对象加入到报表中
Doc.Preview() \'预览报表


--  作者:mamuaiqing
--  发布时间:2013/3/16 14:33:00
--  
感谢老爹,小数点后面的数值怎么显示出来?,比如项目中的金额为20000.05,  .05应该在0角5分位置,上面的代码没显示出来,  再比如20000,正常显示为20000.00,小数点后面为0的时候角分为00
--  作者:狐狸爸爸
--  发布时间:2013/3/16 14:42:00
--  

Dim doc As New PrintDoc \'定义一个报表
Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rx As New prt.RenderText \'定义一个文本对象
Dim tb As Table = Tables("表A")
doc.AutoRotate = False \'禁止自动旋转打印内容
doc.PageSetting.Landscape = True \'横向打印
doc.PageSetting.PaperKind = 9 \'纸张类型改为B5
Doc.PageSetting.LeftMargin = 14 \'设置左边距
Doc.PageSetting.RightMargin = 1 \'设置右边距
Doc.PageSetting.TopMargin = 3 \'设置上边距
Doc.PageSetting.BottomMargin = 3 \'设置下边距

rt = New prt.RenderTable
rt.Rows.Count = 25 \'设置总行数
rt.Cols.Count = 25 \'设置总列数
rt.Height = 204 \'设置表格的高度为80毫米
rt.Width = 280
rt.Rows(0).Height = 8 \'设置第7行
rt.Rows(1).Height = 8 \'设置第7行高度
rt.Cols(0).Width = 35
rt.Cols(1).Width = 50
rt.Cols(23).Width = 35
rt.Cols(24).Width = 35

\'设置合并单元格
rt.Cells(0,0).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,12).SpanRows = 25 \'第1行第5个单元格向下合并2行
rt.Cells(0,1).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,23).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,24).SpanRows = 2 \'第1行第5个单元格向下合并2行
rt.Cells(0,2).SpanCols = 10 \'第1行第2个单元格向右合并10列
rt.Cells(0,13).SpanCols = 10 \'第1行第2个单元格向右合并10列

\'设置表格样式
rt.Style.FontSize = 13
rt.Rows(0).Style.FontSize = 14 \'字体大小为16磅
rt.Rows(1).Style.FontSize = 12 \'字体大小为16磅
rt.Style.FontBold = True \'字体加粗
rt.Cells(0,0).Text = "日    期"
rt.Cells(0,1).Text = "摘             要"
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(0,2).Text = "借方发生额"
rt.Cells(0,13).Text = "贷方发生额"
rt.Cells(0,23).Text = "汇款银行"
rt.Cells(0,24).Text = "款项来源"
rt.Cells(1,2).Text = "千"
rt.Cells(1,3).Text = "百"
rt.Cells(1,4).Text = "十"
rt.Cells(1,5).Text = "万"
rt.Cells(1,6).Text = "千"
rt.Cells(1,7).Text = "百"
rt.Cells(1,8).Text = "十"
rt.Cells(1,9).Text = "元"
rt.Cells(1,10).Text = "角"
rt.Cells(1,11).Text = "分"

rt.Cells(1,13).Text = "千"
rt.Cells(1,14).Text = "百"
rt.Cells(1,15).Text = "十"
rt.Cells(1,16).Text = "万"
rt.Cells(1,17).Text = "千"
rt.Cells(1,18).Text = "百"
rt.Cells(1,19).Text = "十"
rt.Cells(1,20).Text = "元"
rt.Cells(1,21).Text = "角"
rt.Cells(1,22).Text = "分"

rt.Style.GridLines.All = New prt.Linedef \'设置网格线
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'内容水平居中
\'下面很简单,指定每一个单元格的内容
For r As Integer = 0 To tb.Rows.Count - 1 \'遍历关联表每一行
    rt.Cells(r+2,0).Text = Format(tb.rows(r)("日期"),"yyyy年MM月dd日")
    rt.Cells(r+2,1).Text = tb.rows(r)("摘要")
    Dim money As Integer = tb.rows(r)("借方发生额")
    If money > 0 Then
        For i As Double = 9 To 2 Step - 1
            rt.Cells(r+2, i).Text = GetDigit(Money,9-i)
            If rt.Cells(r+2, i).Text =  "¥" Then
                Exit For
            End If
        Next
    End If
    money = (tb.rows(r)("借方发生额") - money) * 100
    If money > 0 Then
        rt.Cells(r+2, 11).Text = GetDigit(Money,0)
    Else
        rt.Cells(r+2, 11).Text = 0
    End If
    If money > 10 Then
        rt.Cells(r+2, 10).Text = GetDigit(Money,1)
    Else
        rt.Cells(r+2, 10).Text = 0
    End If
Next
doc.Body.Children.Add(rt) \'将表格对象加入到报表中
Doc.Preview() \'预览报表