以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]专业报表能否竖向打印 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126728) |
||||
-- 作者:天一生水 -- 发布时间:2018/10/27 13:53:00 -- [求助]专业报表能否竖向打印 |
||||
-- 作者:有点蓝 -- 发布时间:2018/10/27 14:31:00 -- 没有这种设置。可以利用表格宽度让文字自动换行 Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 doc.Body.Children.Add(rt) \'将表格对象加入到报表中 rt.Style.GridLines.All = New prt.Linedef \'设置网格线 rt.Rows(0).Height = 150 rt.Cols(0).Width= 30 rt.Cols(1).Width= 100 \'\'rt.Cells(0, 0).Text = "中建五局" Dim ra As prt.RenderArea = rt.Cells(0,0).Area ra.Style.Font = new Font("宋体",80) Dim rx = New prt.RenderText \'创建一个文本 rx.Text = "中建五局" ra.Children.Add(rx) \' doc.Preview() |
||||
-- 作者:天一生水 -- 发布时间:2018/10/29 11:39:00 -- 我改成在窗口预览,但没显示出来,请老师帮助看一下! 谢谢! 比如,用A4纸竖向打印3个记录:
Dim doc As New PrintDoc \'定义一个报表 With Tables("席签打印_table1") \'rt.Style.GridLines.All = New prt.Linedef \'设置网格线
_MyDoc.Generate() \'这句替代 doc.Preview() \'预览 [此贴子已经被作者于2018/10/29 11:59:02编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2018/10/29 12:56:00 -- 实例发上来测试,说明要做到的效果。 |
||||
-- 作者:天一生水 -- 发布时间:2018/10/29 14:08:00 -- 请老师看实例:
|
||||
-- 作者:有点甜 -- 发布时间:2018/10/29 14:23:00 -- Dim doc As New PrintDoc \'定义一个报表 With Tables("席签打印_table1") rt.Style.GridLines.All = New prt.Linedef \'设置网格线
_MyDoc.Generate() \'这句替代 doc.Preview() \'预览 |
||||
-- 作者:天一生水 -- 发布时间:2018/10/29 19:35:00 -- 谢谢甜老师! 可以预览了,但是应该一张纸打三条记录,现在每条记录打印了一张。 是不是要遍历一下?请老师再帮一下。 |
||||
-- 作者:有点蓝 -- 发布时间:2018/10/29 20:09:00 -- Dim doc As New PrintDoc \'定义一个报表 doc.PageSetting.Width = 210 \'纸张宽度为100毫米 doc.PageSetting.Height = 297 \'纸张高度为120毫米 Doc.PageSetting.LeftMargin = 0 \'设置左边距 Doc.PageSetting.RightMargin = 0 \'设置右边距 Doc.PageSetting.TopMargin = 0 \'设置上边距 Doc.PageSetting.BottomMargin = 0 \'设置下边距 Dim CurRow As Row With Tables("席签打印_table1") Dim rs As List(of Row) = .GetCheckedRows Dim ra As prt.RenderArea \'背景设置 For i As Integer = 0 To rs.Count - 1 Step 3 Dim rep As New prt.RenderEmpty \'定义一个新的空对象 rep.BreakBefore = prt.BreakEnum.Page \'打印前换页 doc.Body.Children.Add(rep) \'加入到报表中 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As prt.RenderText \'定义一个文本对象 rt.Style.GridLines.All = New prt.Linedef \'设置网格线 rt.Rows(0).Height = 297 rt.Cols(0).Width= 99 rt.Cols(1).Width= 99 rt.Cols(2).Width= 99 Dim raa As new prt.RenderArea \'背景设置 raa.Width = "Parent.Width" \'宽度等于页面宽度 raa.Height = "Parent.Height" \'高度等于页面高度 raa.Style.BackColor = Color.Pink raa.Children.Add(rt) CurRow = rs(i) rx = new prt.RenderText ra = rt.Cells(0,0).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 ra.Children.Add(rx) If i+1 < rs.Count CurRow = rs(i+1) rx = new prt.RenderText ra = rt.Cells(0,1).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 ra.Children.Add(rx) End If If i+2 < rs.Count CurRow = rs(i+2) rx = new prt.RenderText ra = rt.Cells(0,2).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 ra.Children.Add(rx) End If doc.body.Children.Add(raa) Next End With |
||||
-- 作者:天一生水 -- 发布时间:2019/3/15 12:20:00 -- 老师好! 楼上的代码我加入垂直居中,为什么没起作用?
Dim doc As New PrintDoc \'定义一个报表
doc.PageSetting.Width = 210 \'纸张宽度为100毫米
doc.PageSetting.Height = 297 \'纸张高度为120毫米
Doc.PageSetting.LeftMargin = 0 \'设置左边距
Doc.PageSetting.RightMargin = 0 \'设置右边距
Doc.PageSetting.TopMargin = 0 \'设置上边距
Doc.PageSetting.BottomMargin = 0 \'设置下边距
Dim CurRow As Row
With Tables("席签打印_table1")
Dim rs As List(of Row) = .GetCheckedRows
Dim ra As prt.RenderArea \'背景设置
For i As Integer = 0 To rs.Count - 1 Step 3
Dim rep As New prt.RenderEmpty \'定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page \'打印前换页
doc.Body.Children.Add(rep) \'加入到报表中
Dim rt As New prt.RenderTable() \'定义一个表格对象
Dim rx As prt.RenderText \'定义一个文本对象
rt.Style.GridLines.All = New prt.Linedef \'设置网格线
rt.Rows(0).Height = 297
rt.Cols(0).Width= 99
rt.Cols(1).Width= 99
rt.Cols(2).Width= 99
Dim raa As new prt.RenderArea \'背景设置
raa.Width = "Parent.Width" \'宽度等于页面宽度
raa.Height = "Parent.Height" \'高度等于页面高度
raa.Style.BackColor = Color.Pink
raa.Children.Add(rt)
CurRow = rs(i)
rx = new prt.RenderText
ra = rt.Cells(0,0).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
ra.Children.Add(rx)
If i+1 < rs.Count
CurRow = rs(i+1)
rx = new prt.RenderText
ra = rt.Cells(0,1).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
ra.Children.Add(rx)
End If
If i+2 < rs.Count
CurRow = rs(i+2)
rx = new prt.RenderText
ra = rt.Cells(0,2).Area
ra.Style.Font = new Font("华文新魏",160)
rx.Text = CurRow("姓名")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
ra.Children.Add(rx)
End If
doc.body.Children.Add(raa)
Next
End With
|
||||
-- 作者:有点甜 -- 发布时间:2019/3/15 12:55:00 -- Dim doc As New PrintDoc \'定义一个报表 doc.PageSetting.Width = 210 \'纸张宽度为100毫米 doc.PageSetting.Height = 297 \'纸张高度为120毫米 Doc.PageSetting.LeftMargin = 0 \'设置左边距 Doc.PageSetting.RightMargin = 0 \'设置右边距 Doc.PageSetting.TopMargin = 0 \'设置上边距 Doc.PageSetting.BottomMargin = 0 \'设置下边距 Dim CurRow As Row With Tables("席签打印_table1") Dim rs As List(of Row) = .GetCheckedRows Dim ra As prt.RenderArea \'背景设置 For i As Integer = 0 To rs.Count - 1 Step 3 Dim rep As New prt.RenderEmpty \'定义一个新的空对象 rep.BreakBefore = prt.BreakEnum.Page \'打印前换页 doc.Body.Children.Add(rep) \'加入到报表中 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As prt.RenderText \'定义一个文本对象 rt.Style.GridLines.All = New prt.Linedef \'设置网格线 rt.Rows(0).Height = 297 rt.Cols(0).Width= 99 rt.Cols(1).Width= 99 rt.Cols(2).Width= 99 Dim raa As new prt.RenderArea \'背景设置 raa.Width = "Parent.Width" \'宽度等于页面宽度 raa.Height = "Parent.Height" \'高度等于页面高度 raa.Style.BackColor = Color.Pink raa.Children.Add(rt) CurRow = rs(i) rx = new prt.RenderText ra = rt.Cells(0,0).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.height = "parent.height" rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 ra.Children.Add(rx) If i+1 < rs.Count CurRow = rs(i+1) rx = new prt.RenderText ra = rt.Cells(0,1).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.height = "parent.height" ra.Children.Add(rx) End If If i+2 < rs.Count CurRow = rs(i+2) rx = new prt.RenderText ra = rt.Cells(0,2).Area ra.Style.Font = new Font("华文新魏",160) rx.Text = CurRow("姓名") rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rx.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rx.height = "parent.height" ra.Children.Add(rx) End If doc.body.Children.Add(raa) Next End With doc.Preview |