Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Dim doc As New PrintDoc '定义一个报表
Dim rt1 As New prt.RenderText '定义一个箱号文本对象
Dim rt2 As New prt.RenderText '定义一个件数文本对象
Dim rt3 As New prt.RenderText '定义一个区域文本对象
Dim rt4 As New prt.RenderText '定义一个客户代码文本对象
Dim Count As Integer = Tables("在库明细").Current("件数")
doc.PageSetting.Width = 102 '纸张宽度为102毫米
doc.PageSetting.Height = 76 '纸张高度为76毫米
For i As Integer =1 To Count
rt1.Text = Tables("在库明细").Current("起始箱号") + Count - 1
rt1.Style.Font = New Font("宋体", 36, FontStyle.Bold) '设置字体
rt1.Width = "Auto" '自动设置宽度
rt1.X =10 '指定水平位置
rt1.y =5 ' 指定垂直位置
rt1.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
rt2.Text = Tables("在库明细").Current("件数")
rt2.Width = "Auto" '自动设置宽度
rt2.X =10'指定水平位置
rt2.y =25'指定垂直位置
rt2.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
doc.Body.Children.Add(rt1) '将文本对象加入到报表
doc.Body.Children.Add(rt2) '将文本对象加入到报表
Count=Count-1
doc.Preview() '预览
Next
专业报表中的代码执行后,出现这个错误提示,请老师指教,谢谢!
Dim doc As New PrintDoc '定义一个报表
Dim rt1 As prt.RenderText '定义一个箱号文本对象
Dim rt2 As prt.RenderText '定义一个件数文本对象
Dim rt3 As New prt.RenderText '定义一个区域文本对象
Dim rt4 As New prt.RenderText '定义一个客户代码文本对象
Dim Count As Integer = Tables("在库明细").Current("件数")
doc.PageSetting.Width = 102 '纸张宽度为102毫米
doc.PageSetting.Height = 76 '纸张高度为76毫米
For i As Integer =1 To Count
rt1 = New prt.RenderText
rt2 = New prt.RenderText
rt1.Text = Tables("在库明细").Current("起始箱号") + Count - 1
rt1.Style.Font = New Font("宋体", 36, FontStyle.Bold) '设置字体
rt1.Width = "Auto" '自动设置宽度
rt1.X =10 '指定水平位置
rt1.y =5 ' 指定垂直位置
rt1.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
rt2.Text = Tables("在库明细").Current("件数")
rt2.Width = "Auto" '自动设置宽度
rt2.X =10'指定水平位置
rt2.y =25'指定垂直位置
rt2.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
doc.Body.Children.Add(rt1) '将文本对象加入到报表
doc.Body.Children.Add(rt2) '将文本对象加入到报表
Count=Count-1
doc.Preview() '预览
Next
好象这样的循环打印有问题。
预览时不能清除上一次的值,不知真正打印时会不会这样。
好象这样的循环打印有问题。
预览时不能清除上一次的值,不知真正打印时会不会这样。
打印肯定也是这样的
楼主,你每次打印都是同一个printDoc,结果当然是这样的。
要不重复,就得每次打印都创建一个新的PrintDoc:
For i As Integer =1 To Count
Dim doc As New PrintDoc '定义一个报表
Dim rt1 As New prt.RenderText '定义一个箱号文本对象
Dim rt2 As New prt.RenderText '定义一个件数文本对象
Dim Count As Integer = Tables("在库明细").Current("件数")
doc.PageSetting.Width = 102 '纸张宽度为102毫米
doc.PageSetting.Height = 76 '纸张高度为76毫米
rt1.Text = Tables("在库明细").Current("起始箱号") + Count - 1
rt1.Style.Font = New Font("宋体", 36, FontStyle.Bold) '设置字体
rt1.Width = "Auto" '自动设置宽度
rt1.X =10 '指定水平位置
rt1.y =5 ' 指定垂直位置
rt1.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
rt2.Text = Tables("在库明细").Current("件数")
rt2.Width = "Auto" '自动设置宽度
rt2.X =10'指定水平位置
rt2.y =25'指定垂直位置
rt2.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
doc.Body.Children.Add(rt1) '将文本对象加入到报表
doc.Body.Children.Add(rt2) '将文本对象加入到报表
doc.Preview() '预览
Next
或者
Dim doc As PrintDoc '定义一个报表变量
Dim rt1 As prt.RenderText '定义一个箱号文本对象变量
Dim rt2 As prt.RenderText '定义一个件数文本对象变量
For i As Integer =1 To Count
doc = New PrintDoc '定义一个报表
rt1 = New prt.RenderText '定义一个箱号文本对象
rt2 = New prt.RenderText '定义一个件数文本对象
Dim Count As Integer = Tables("在库明细").Current("件数")
doc.PageSetting.Width = 102 '纸张宽度为102毫米
doc.PageSetting.Height = 76 '纸张高度为76毫米
rt1.Text = Tables("在库明细").Current("起始箱号") + Count - 1
rt1.Style.Font = New Font("宋体", 36, FontStyle.Bold) '设置字体
rt1.Width = "Auto" '自动设置宽度
rt1.X =10 '指定水平位置
rt1.y =5 ' 指定垂直位置
rt1.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
rt2.Text = Tables("在库明细").Current("件数")
rt2.Width = "Auto" '自动设置宽度
rt2.X =10'指定水平位置
rt2.y =25'指定垂直位置
rt2.Style.Borders.All = New prt.Linedef(0.3, Color.black) '设置边框
doc.Body.Children.Add(rt1) '将文本对象加入到报表
doc.Body.Children.Add(rt2) '将文本对象加入到报表
doc.Preview() '预览
Next
另外你的循环语句中出现Count = Count- 1,是啥意思?这一句让人感觉很奇怪。
在doc.Print() 后面加上
rt1.Text = ""
rt2.Text = ""
应该就可以解决这个问题了
学生刚刚开始学,确实是很多的不懂,还要恶补下帮助文件
循环语句中出现Count = Count- 1,是为了让打印的内容是流水号
可能是个菜鸟的土办法吧
在doc.Print() 后面加上
rt1.Text = ""
rt2.Text = ""
虽然是不得法,也算是个土办法吧,呵呵,见笑了