以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  编译错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132559)

--  作者:nxqtxwz
--  发布时间:2019/3/25 9:29:00
--  编译错误

总是未知的编译错误,请老师帮忙看看,到底错在哪了呢?

 

Dim doc  As New PrintDoc  \'定义一个新报表
Dim rt  As New prt.RenderTable \'定义一个新表格
Dim rs As New prt.RenderText() \'定义一个文本对象
Dim rss As New prt.RenderText()
Dim rs2 As New prt.RenderText()
Dim rs3 As New prt.RenderText()
Dim rs4 As New prt.RenderText()

Dim rt1 As New prt.RenderTable() \'定义一个表格对象
doc.PageSetting.PaperKind = 9 \'纸张A4
Doc.PageSetting.LeftMargin = 20 \'设置左边距
Doc.PageSetting.RightMargin = 20 \'设置右边距
Doc.PageSetting.TopMargin = 20 \'设置上边距
Doc.PageSetting.BottomMargin = 20 \'设置下边距

rt.Style.Spacing.Top = 1  \'表格和前面对象的垂直间隔为1毫米
rt.Style.Spacing.Bottom = 1  \'表和和后续对象的垂直间隔为1毫米
rs.Text = "青铜峡市铝业学校入库单"  \'设置文本对象的内容
rs.y=21
rs.Style.Font = New Font("黑体", 14) \'设置文本对象的字体
rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'文本内容水平居中
doc.Body.Children.Add(rs) \'将文本对象加入到表格中
doc.Body.Children.Add(rt1) \'将表格对象加入到报表中

\'rs2 = New prt.RenderText() \'再次定义一个文本对象
rs2.Text = "第一联:报账凭证"
rs2.Style.TextAngle = -90 \'顺时钟旋转45度
rs2.style.Font = New Font("楷体", 8 )
rs2.x=191
rs2.y=40
doc.Body.Children.Add(rs2) \'将文本对象加入到表格中

\'rss = New prt.RenderText() \'再次定义一个文本对象
rss.Text ="凭证号:"& Vars("bbbbb")
rss.style.Font = New Font("楷体", 10 )
rss.x=23
rss.y=25
doc.Body.Children.Add(rss) \'将文本对象

rs3 = New prt.RenderText() \'再次定义一个文本对象
rs3.Text = "入库日期:" & Format(Today,"yyyy年MM月dd日")
rs3.style.Font = New Font("楷体", 10 )
rs3.x=145
rs3.y=25
doc.Body.Children.Add(rs3) \'将文本对象加入到表格中

rs4.Text = "制表:   " & user.name & "                          保管员:                      经手人:"
rs4.style.Font = New Font("黑体", 10 )
rs4.x=22
rs4.y=84
doc.Body.Children.Add(rs4) \'将文本对象加入到表格中


Dim sum As Integer = 0
Dim tb  As  Table = Tables("打印入库单_table1")     \'.Cols("办理入库") = \'True\'
Dim Colnames As String() = {"物品名称","规格型号","单位","采购数量","采购单价","采购总价","供货单位"}
\'rt.Width = "Auto"  \'表格宽度为自动,也就是等于各列设置宽度之和
\'rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded \'表格宽度超出页宽时,可以水平换页
rt.Style.Font = tb.Font
rt.y=28
rt.Height = 55
rt.Cols(0).Width = 30 \'设置列宽
rt.Cols(1).Width = 40
rt.Cols(2).Width = 10
rt.Cols(3).Width = 20
rt.Cols(4).Width = 10
rt.Cols(5).Width = 20
rt.Cells(6,2).SpanCols = 2 \'第7行第1个单元格向右合并5列
rt.Cells(6,4).SpanCols = 3 \'第7行第1个单元格向右合并5列
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中

For c  As  Integer =  0 To Colnames.length -1  \'逐列设置和填入内容
    rt.Cells(0,c).Text = colnames(c) \'列名作为标题
    rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
    \' rt.Cols(c).Width = tb.Cols(colnames(c)).PrintWidth \'列宽等于实际列宽
    \' If tb.Cols(colnames(c)).IsNumeric Then  \'如果是数值或日期列
    rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Center  \'数据水平靠右
    \' End  If
    Dim i As Integer = 1
    \' For r As Integer = tb.TopPosition To tb.BottomPosition \'开始填入该列内容
    For r As Integer = 0 To tb.Rows.Count -1
        If tb.rows(r)("办理入库") = True Then
            rt.Cells(i, c).Text = tb.Rows(r)(colnames(c))
            i=i+1
            If colnames(c) = "采购总价"
                sum =sum + tb.rows(r)("采购总价")
            End If
        End If
    Next
Next

rt.Cells(6, 0).Text ="合计金额"
rt.Cells(6, 1).Text ="¥"& Sum & "元"
rt.Cells(6, 2).Text ="合计金额大写"
rt.Cells(6, 4).Text =CUMoney(Sum)
rt.Style.Gridlines.All = New prt.Linedef   \'灰色网格线
rt.CellStyle.Spacing.All = 0.5  \'单元格内距设为0.5毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头
doc.Body.Children.Add(rt) \'将表格加入到报表

 

 


rt  = New prt.RenderTable \'定义一个新表格
rs = New prt.RenderText() \'定义一个文本对象
rs2 = New prt.RenderText()
rt1 = New prt.RenderTable() \'定义一个表格对象

doc.PageSetting.PaperKind = 9 \'纸张A4
Doc.PageSetting.LeftMargin = 20 \'设置左边距
Doc.PageSetting.RightMargin = 20 \'设置右边距
Doc.PageSetting.TopMargin = 20 \'设置上边距
Doc.PageSetting.BottomMargin = 20 \'设置下边距

rt.Style.Spacing.Top = 1  \'表格和前面对象的垂直间隔为1毫米
rt.Style.Spacing.Bottom = 1 \'表和和后续对象的垂直间隔为3毫米
rs.Text = "青铜峡市铝业学校入库单"  \'设置文本对象的内容
rs.y=120
rs.Style.Font = New Font("黑体", 14) \'设置文本对象的字体
rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'文本内容水平居rs.y=100
doc.Body.Children.Add(rs) \'将文本对象加入到表格中
doc.Body.Children.Add(rt1) \'将表格对象加入到报表中

rs2 = New prt.RenderText() \'再次定义一个文本对象
rs2.Text = "第二联:保管员留存"
rs2.Style.TextAngle = -90 \'顺时钟旋转45度
rs2.style.Font = New Font("楷体", 10 )
rs2.x=191
rs2.y=130
doc.Body.Children.Add(rs2) \'将文本对象加入到表格中

rss = New prt.RenderText() \'再次定义一个文本对象
rss.Text ="凭证号:"& Vars("bbbbb")
rss.style.Font = New Font("楷体", 10 )
rss.x=23
rss.y=123
doc.Body.Children.Add(rss) \'将文本对象

rs3 = New prt.RenderText() \'再次定义一个文本对象
rs3.Text = "入库日期:" & Format(Today,"yyyy年MM月dd日")
rs3.style.Font = New Font("楷体", 10 )
rs3.x=145
rs3.y=123
doc.Body.Children.Add(rs3) \'将文本对象加入到表格中

rs4 = New prt.RenderText()
rs4.Text = "制表:   " & user.name & "                          保管员:                      经手人:"
rs4.style.Font = New Font("黑体", 10 )
rs4.x = 22
rs4.y = 204
doc.Body.Children.Add(rs4) \'将文本对象加入到表格中

Dim sum As Integer = 0
\'rt.Width = "Auto"  \'表格宽度为自动,也就是等于各列设置宽度之和
\'rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded \'表格宽度超出页宽时,可以水平换页
rt.Style.Font = tb.Font
rt.Height = 55
rt.y = 126
rt.Cols(0).Width = 30 \'设置列宽
rt.Cols(1).Width = 40
rt.Cols(2).Width = 10
rt.Cols(3).Width = 20
rt.Cols(4).Width = 10
rt.Cols(5).Width = 20
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
For c  As  Integer =  0 To Colnames.length -1  \'逐列设置和填入内容
    rt.Cells(0,c).Text = colnames(c) \'列名作为标题
    rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
    rt.Cols(c).Width = tb.Cols(colnames(c)).PrintWidth \'列宽等于实际列宽
    \' If tb.Cols(colnames(c)).IsNumeric Then  \'如果是数值或日期列
    rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Center  \'数据水平靠右
    \' End  If
    Dim i As Integer = 1
    \' For r As Integer = tb.TopPosition To tb.BottomPosition \'开始填入该列内容
    For r As Integer = 0 To tb.Rows.Count -1
        If tb.rows(r)("办理入库") = True Then
            rt.Cells(i, c).Text = tb.Rows(r)(colnames(c))
            i=i+1
            If colnames(c) = "采购总价"
                sum =sum + tb.rows(r)("采购总价")
            End If
        End If
    Next
Next

rt.Cells(6, 0).Text ="合计金额"
rt.Cells(6, 1).Text ="¥"& Sum & "元"
rt.Cells(6, 2).Text ="合计金额大写"
rt.Cells(6, 4).Text = CUMoney(Sum)
rt.Style.Gridlines.All = New prt.Linedef   \'正常
rt.CellStyle.Spacing.All = 0.5  \'单元格内距设为0.5毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头
doc.Body.Children.Add(rt) \'将表格加入到报表
Doc.Preview


--  作者:有点甜
--  发布时间:2019/3/25 9:45:00
--  

第二次的这句代码删除,即可

 

Dim sum As Integer = 0