以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]为什么预览打印与直接打印,结果不一致? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=163073) |
-- 作者:老鼠 -- 发布时间:2021/4/22 16:07:00 -- [求助]为什么预览打印与直接打印,结果不一致? Dim doc As New PrintDoc \'定义一个报表 doc.PageSetting.Width = 297 \'纸张宽度为100毫米 doc.PageSetting.Height = 420 \'纸张高度为120毫米 Dim rx As new prt.RenderText \'定义一个文本对象 Dim CurRow As Row = Tables("基本信息").Current rx = new prt.RenderText rx.Text = CurRow("合同项") rx.x = 232 rx.y = 87 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("合同期限") rx.x = 222 rx.y = 90 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"yyyy") rx.x = 222 rx.y = 115 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"MM") rx.x = 222 rx.y = 138 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"dd") rx.x = 222 rx.y = 158 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"yyyy") rx.x = 212 rx.y = 22 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"MM") rx.x = 212 rx.y = 50 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"dd") rx.x = 212 rx.y = 66 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("聘用部门") rx.x = 134 rx.y = 95 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("聘用岗位").SubString(0,6) \'获得左边6个字符 rx.x = 134 rx.y = 155 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 12 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("聘用岗位").SubString(6) \'获得左边第6个字符开始的后面的所有字符 rx.x = 124 rx.y = 22 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 12 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) Doc.PrinterName = e.Form.Controls("ComboBox1").text doc.Print 以上是直接打印代码,但结果是: rx = new prt.RenderText rx.Text = CurRow("合同项") rx.x = 232 rx.y = 87 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = CurRow("合同期限") rx.x = 222 rx.y = 90 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"yyyy") rx.x = 222 rx.y = 115 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"MM") rx.x = 222 rx.y = 138 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("起始日期"),"dd") rx.x = 222 rx.y = 158 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"yyyy") rx.x = 212 rx.y = 22 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"MM") rx.x = 212 rx.y = 50 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) rx = new prt.RenderText rx.Text = Format(CurRow("终止日期"),"dd") rx.x = 212 rx.y = 66 rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 14 \'字体大小为16磅 rx.Style.TextAngle = -90 \'文本旋转角度 doc.body.Children.Add(rx) 以上代码没有起作用。 但只要最后改成: Doc.Preview 所有内容都会被打印或者说是显示完整。
|
-- 作者:有点蓝 -- 发布时间:2021/4/22 16:27:00 -- 这个是专业报表本身的bug,暂时无法解决。只能把预览和打印分开2个按钮分别调用,不要在预览里打印 |