以下代码运行出现错误,错误提示“添加的项目有所有者了”
设计的目的是,从“考试科目”表的“学科”列中,动态批量生成每个学科与这个学科均分对比的结果,形成一段描述性文字。
不知道问题出在哪里?
请老师帮我看看,谢谢
'---------------------
Dim rxt As New prt.RenderText '定义一个文本对象
Dim pj4 As Table = Tables("学生查询四")
Dim pj0 As Table = Tables("学生查询")
Dim pj1 As Table = Tables("学生查询一")
Dim tpp As Table = Tables("考试科目")
For i As Integer = 0 To tpp.Rows.Count -1
Dim yw0 As Double = pj0.Compute("sum(" & tpp.Rows(i)("学科") & ")")
Dim yw4 As Double = pj4.Compute("avg(" & tpp.Rows(i)("学科") & ")")
Dim yw As Double = Format(yw0 - yw4,"0.0")
Dim yw3 As String = iif(yw0 = 0 Or yw4 = 0,"",tpp.Rows(i)("学科") & "学科超均分" & yw & "分,")
Dim zf0 As Double = pj0.Compute("sum(总分)")
Dim zf4 As Double = pj4.Compute("avg(总分)")
Dim zf As Double = Format(zf0 - zf4,"0.0")
Dim zfpm0 As Double = pj0.Compute("sum(总分排名)")
Dim zfpm1 As Double = pj1.Compute("sum(总分排名)")
Dim zfpm As Double = Format(zfpm1 - zfpm0,"0")
rxt.text = "分数分析:"
rxt.Style.FontBold = True '字体加粗
rxt.Style.FontSize = 11 '大体大小为16磅
rxt.Style.TextAlignHorz = prt.AlignHorzEnum.left '水平居中排列
rxt.Style.Spacing.top = 15 '和下面的对象(表格)距离3毫米
rxt.Style.Spacing.Bottom = 2 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rxt) '加入到报表中
Dim rx11 As New prt.RenderText '定义一个文本对象
rx11.text = " 此次考试您的孩子成绩总分为"& CurRow1("总分") & "分,总分名次为" & CurRow1("总分排名") & "名.与全班相比," & yw3 & "总分超均分" & zf & "分.与上期考试相比,总分名次进步" & zfpm & "名,希望您在繁忙的工作之余,对孩子多加鼓励,鞭策前行,我们期待孩子在未来取得更大的进步!"
rx11.Style.LineSpacing = 180 '设置1.5倍行距
rx11.Style.FontSize = 10 '大体大小为16磅
rx11.