Foxtable(狐表)用户栏目专家坐堂 → [求助]帮助中控制每页打印行数代码 增加坐标求助


??共有21人关注过本帖树形打印复制链接

主题:[求助]帮助中控制每页打印行数代码 增加坐标求助

帅哥,在线噢!
laipiwen
??1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:191 积分:1434 威望:0 精华:0 注册:2015/4/29 11:50:00
[求助]帮助中控制每页打印行数代码 增加坐标求助??发帖心情 Post By:2019/10/8 15:24:00 [只看该作者]

帮助代码

Dim doc As New PrintDoc
Dim
tb As Table = Tables("订单")
Dim
prs As Integer = 20 '每页20行
For
p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
??? Dim
rx As New prt.RenderText
??? rx
.Text = "2010年订单"
???
rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
??? rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
??? rx.Style.Spacing.Bottom =
3
??? Doc.body.Children.Add(rx)

??? Dim
rt As New prt.RenderTable
??? rt
.Style.Gridlines.All = New prt.Linedef(Color.Gray)
??? rt
.CellStyle.Spacing.All = 0.5
??? For
c As Integer = 0 To tb.Cols.Count - 1
???????
rt.Cells(0,c).Text = tb.Cols(c).Name
??????? For
r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
??????????? rt
.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
??????? Next
??? Next
??? If
p < math.Ceiling(tb.Rows.Count / prs) - 1
???????
rt.BreakAfter = prt.BreakEnum.Page
??? End If

??? doc
.Body.Children.Add(rt)
Next

doc
.Preview
()


增加了坐标的代码

Dim doc As New PrintDoc
Dim tb As Table = Tables("订单")
Dim prs As Integer = 20 '每页20行
'Dim rt As New prt.RenderTable
'rt.X = 50
'rt.y = 50
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
??? Dim rx As New prt.RenderText
??? rx.Text = "2010年订单"
??? rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
??? rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
??? rx.Style.Spacing.Bottom = 3
??? Doc.body.Children.Add(rx)
??? Dim rt As New prt.RenderTable
??? rt.X = 50
??? rt.y = 50
??? rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
??? rt.CellStyle.Spacing.All = 0.5
??? For c As Integer = 0 To tb.Cols.Count - 1
??????? rt.Cells(0,c).Text = tb.Cols(c).Name
??????? For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
??????????? rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
??????? Next
??? Next
??? If p < math.Ceiling(tb.Rows.Count / prs) - 1
??????? rt.BreakAfter = prt.BreakEnum.Page
??? End If
??? doc.Body.Children.Add(rt)
Next
'doc.Body.Children.Add(rt)
doc.Preview()


图片点击可在新窗口打开查看
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20191008152321.png
图片点击可在新窗口打开查看


增加坐标之后打印预览 都重合到一个表中去了,请问这里该如何设置坐标位置?




?回到顶部
帅哥,在线噢!
有点蓝
??2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:34799 积分:177149 威望:0 精华:8 注册:2015/6/24 9:21:00
??发帖心情 Post By:2019/10/8 15:35:00 [只看该作者]

没看懂,为什么要设置坐标,要做什么功能?实际效果应该是怎么样的?

?回到顶部
帅哥,在线噢!
laipiwen
??3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:191 积分:1434 威望:0 精华:0 注册:2015/4/29 11:50:00
??发帖心情 Post By:2019/10/8 15:39:00 [只看该作者]

这个是想控制表格的位置,在上面打印其他?RenderText 作为标题? 什么的,想实现截图所示效果
图片点击可在新窗口打开查看此主题相关图片如下:企业微信截图_20191008154129.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2019/10/8 15:42:30编辑过]

?回到顶部
帅哥,在线噢!
有点蓝
??4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:34799 积分:177149 威望:0 精华:8 注册:2015/6/24 9:21:00
??发帖心情 Post By:2019/10/8 15:46:00 [只看该作者]

表格整体右移?

Dim doc As New PrintDoc
Dim tb As Table = Tables("订单")
Dim prs As Integer = 20 '每页20行
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
? ? Dim rx As New prt.RenderText
? ? rx.Text = "2010年订单"
? ? rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
? ? rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
? ? rx.Style.Spacing.Bottom = 3
? ? Doc.body.Children.Add(rx)
? ? Dim rt As New prt.RenderTable
? ? rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
? ? rt.CellStyle.Spacing.All = 0.5
? ? rt.Style.Padding.Left = 30
? ? For c As Integer = 0 To tb.Cols.Count - 1
? ? ? ? rt.Cells(0,c).Text = tb.Cols(c).Name
? ? ? ? For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
? ? ? ? ? ? rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
? ? ? ? Next
? ? Next
? ? If p < math.Ceiling(tb.Rows.Count / prs) - 1
? ? ? ? rt.BreakAfter = prt.BreakEnum.Page
? ? End If
? ? doc.Body.Children.Add(rt)
Next
doc.Preview()

?回到顶部