Foxtable(狐表)用户栏目专家坐堂 → [求助] 报表生成


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

主题:[求助] 报表生成

帅哥哟,离线,有人找我吗?
wangyinming
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:286 积分:2345 威望:0 精华:0 注册:2013/8/30 3:37:00
[求助] 报表生成  发帖心情 Post By:2020/5/2 12:04:00 [显示全部帖子]

现在是根据 Tables("print_A5")的行来生成报表的,
但是现在只能一条一条生成,希望可以批量生成(可以用辅助列或者复选框吗?)。
该如何写?

'''
Dim doc As New PrintDoc()  '定义一个报表

doc.PageSetting.Width = 90 '纸张宽度为100毫米
doc.PageSetting.Height = 60 '纸张高度为90毫米
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距

Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As prt.RenderText '定义一个文本对象
Dim CurRow As Row = Tables("print_A5").Current

'设置水印
rx = New prt.RenderText '设置文本对象的内容
rx.Text = CurRow("背番号") '设置文本内容
rx.Width = 80 '宽度
rx.Height = 50 '高度
rx.x = 13
rx.y = 18
'rx.Style.TextAngle = 45 '旋转45度
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
rx.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
rx.Style.FontSize = 100 '字体大小为110磅
rx.Style.FontBold = True '字体加粗
rx.Style.TextColor = Color.LightGray '文本颜色为灰色
Doc.WaterMark = rx '作为水印使用

'指定行数?列数?列宽?行高
rt.Rows.Count = 9 '设置总行数
rt.Cols.Count = 6 '设置总列数
rt.Height = 60  '设置表格的高度为60毫米
rt.Width = 90 '设置表格的宽度为100毫米
'rt.Width = "Auto" '表格宽度为自动,

rt.Rows(0).Height = 3 '设置第1行的高度
rt.Rows(1).Height = 20 '设置第2行的高度
rt.Rows(2).Height = 3  '设置第3行的高度
rt.Rows(3).Height = 8 '设置第4行的高度
rt.Rows(4).Height = 5  '设置第5行的高度,剩余高度被平均分排到其他行
rt.Rows(5).Height = 8   '第5行的高度,剩余高度被平均分排到其他行
rt.Rows(6).Height = 3  '设置第5行的高度,剩余高度被平均分排到其他行
rt.Rows(7).Height = 8  '设置第5行的高度,剩余高度被平均分排到其他行
rt.Rows(8).Height = 8  '设置第5行的高度,剩余高度被平均分排到其他行

rt.Cols(0).Width = 17 '设置各列的宽度
rt.Cols(1).Width = 19
rt.Cols(2).Width = 19
rt.Cols(3).Width = 5
rt.Cols(4).Width = 22
rt.Cols(5).Width = 23

'设置合并单元格
rt.Cells(0,0).SpanCols = 5 '第1行第1个单元格向右合并5列
rt.Cells(0,5).SpanRows = 2 '第1行第6个单元格向下合并2行
rt.Cells(1,0).SpanCols = 5 '第2行第1个单元格向右合并5列
rt.Cells(2,0).SpanCols = 5 '第3行第1个单元格向右合并2列
rt.Cells(3,0).SpanCols = 5 '第4行第1个单元格向右合并4列
rt.Cells(4,0).SpanCols = 3 '第5行第1个单元格向右合并2列
rt.Cells(4,5).SpanRows = 2 '第5行第6个单元格向下合并2行
rt.Cells(4,3).SpanRows = 2 '第5行第4个单元格向下合并2行
rt.Cells(5,0).SpanCols = 3 '第6行第1个单元格向右合并2列
rt.Cells(6,1).SpanCols = 4 '第7行第2个单元格向右合并4列
rt.Cells(6,1).SpanCols = 4 '第7行第2个单元格向右合并4列
rt.Cells(7,1).SpanCols = 4 '第8行第2个单元格向右合并4列
rt.Cells(8,1).SpanCols = 4 '第9行第2个单元格向右合并4列
rt.Cells(6,0).SpanRows = 3 '第7行第1个单元格向下合并3行

'设置表格样式
rt.CellStyle.Spacing.All = 0 '单元格内容缩进1毫米
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Rows(0).Style.Borders.Bottom  = New prt.LineDef("0mm", Color.white) '去掉第1行下边框网格线
rt.Rows(2).Style.Borders.Bottom  = New prt.LineDef("0mm", Color.white) '去掉第3行下边框网格线
rt.Rows(4).Style.Borders.Bottom  = New prt.LineDef("0mm", Color.white) '去掉第5行下边框网格线
rt.Rows(6).Style.Borders.Bottom  = New prt.LineDef("0mm", Color.white) '去掉第7行下边框网格线
'rt.Rows(0).Style.TextAlignVert = prt.AlignVertEnum.Top '第0行内容靠上对齐


'下面很简单,指定每一个单元格的内容
'设置二维码位置左下角
Dim rm As  prt.RenderImage '定义一个图片对象
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.BarRatio = 0.3
Bar.QuietZoneWidth = 0
'Bar.BarHeight = 8
Bar.QRCodeModuleSize = 0.4 '(大小)
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
bar.Code = CurRow("QRコードデータ")
rm = new prt.RenderImage
rm.Image = bar.GetImage
rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center '图片垂直居中
rm.Style.ImageAlign.StretchHorz = False '禁止水平方向扩展图片
rm.Style.ImageAlign.StretchVert = False '禁止垂直方向扩展图片
rt.Cells(6,0).RenderObject =rm

'设置二维码位置右上角
Dim rm1 As  prt.RenderImage '定义一个图片对象
Dim Bar1 As New BarCodeBuilder
Bar1.Symbology = Barpro.Symbology.QRCode
Bar1.BarRatio = 0.3
Bar1.QuietZoneWidth = 0
'Bar.BarHeight = 8
Bar1.QRCodeModuleSize = 0.60   '(大小)

Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
bar1.Code = CurRow("QRコードデータ")
rm1 = new prt.RenderImage
rm1.Image = bar1.GetImage
rm1.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm1.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center '图片垂直居中
rm1.Style.ImageAlign.StretchHorz = False '禁止水平方向扩展图片
rm1.Style.ImageAlign.StretchVert = False '禁止垂直方向扩展图片
rt.Cells(0,5).RenderObject =rm1


rt.Cells(0,0).Text = " 背番号"
rt.Cells(0,0).Style.FontSize = 7

rt.Cells(1,0).Text = CurRow("背番号")
rt.Cells(1,0).Style.FontSize = 50
rt.Cells(1,0).Style.FontBold = True '字体加粗
rt.Cells(1,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(1,0).Style.TextAlignVert = prt.AlignVertEnum.Bottom  '垂直靠上

rt.Cells(2,0).Text= " お客様呼び番号"
rt.Cells(2,0).Style.FontSize = 7
rt.Cells(3,0).Text= " "& CurRow ("客先向け呼び番号")
rt.Cells(3,0).Style.FontSize = 18

rt.Cells(2,5).Text= " お客様背番号"
rt.Cells(2,5).Style.FontSize = 7
rt.Cells(3,5).Text= " "& CurRow ("客先背番号")
rt.Cells(3,5).Style.FontSize = 20

rt.Cells(4,0).Text= " ロットNo."
rt.Cells(4,0).Style.FontSize = 7
rt.Cells(5,0).Text=  CurRow ("管理号码")
rt.Cells(5,0).Style.FontSize = 20
rt.Cells(5,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(5,0).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(4,3).Text= "合 格"
rt.Cells(4,3).Style.FontSize = 10
rt.Cells(4,3).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(4,4).Text= " "& CurRow ("工号")
rt.Cells(4,4).Style.FontSize = 8
'rt.Cells(4,4).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(4,4).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(5,4).Text= CurRow ("生产日期")
rt.Cells(5,4).Style.FontSize = 10
rt.Cells(5,4).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(5,4).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(4,5).Text= CurRow ("特記")
rt.Cells(4,5).Style.FontSize = 13
rt.Cells(4,5).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(4,5).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(6,1).Text= " 呼び番号"
rt.Cells(6,1).Style.FontSize = 7
rt.Cells(7,1).Text= CurRow ("KSTEC呼び番号")
rt.Cells(7,1).Style.FontSize = 15

rt.Cells(6,5).Text= " 収容数"
rt.Cells(6,5).Style.FontSize = 7
rt.Cells(6,5).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(6,5).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(7,5).Text= CurRow ("収容数")
rt.Cells(7,5).Style.FontSize = 20
rt.Cells(7,5).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(7,5).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(8,1).Text= "㈱ジェイテクト 亀山工場 御中"
rt.Cells(8,1).Style.FontSize = 10
rt.Cells(8,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(8,1).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Cells(8,5).Text="光洋シーリングテクノ㈱"
rt.Cells(8,5).Style.FontSize = 8
rt.Cells(8,5).Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Cells(8,5).Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中

rt.Style.FontSize = 10  '大体大小为16磅
doc.Body.Children.Add(rt) '将表格对象加入到报表中

doc.PageSetting.Landscape = True '横向打印
doc.Preview() '预览

 回到顶部