以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 专业报表分组加入图片 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=168771) |
-- 作者:yifan3429 -- 发布时间:2021/5/22 23:35:00 -- 专业报表分组加入图片 Dim doc As New PrintDoc Dim rt As Prt.RenderTable Dim rx As prt.RenderText Dim tbl As Table = Tables("活动家居产品库") Dim Rows As List(Of DataRow) Dim Regions As List(Of String) = tbl.DataTable.GetValues("品牌") doc.Pagesetting.LandScape = True For Each Region As String In Regions rx = New prt.RenderText rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 2 rx.Text = "品牌: " & Region doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.Font = Tables("活动家居产品库").Font rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.Style.Spacing.Bottom = 5 rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font Rows = tbl.DataTable.Select("[品牌] = \'" & Region & "\'") Dim tb As Table = Tables("活动家居产品库") Dim ColNames As String() = New String(){"分类","产品名称","型号","原始图片","备注"} rt.Style.Font = tb.Font For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) Next Next 想显示原始图片 并控制大小 高固定 宽度 自动 rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线 rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头. doc.Body.Children.Add(rt) \'将表格加入到报表 Next doc.preview() [此贴子已经被作者于2021/5/22 23:37:32编辑过]
|
-- 作者:cnsjroom -- 发布时间:2021/5/23 0:56:00 -- 回复:(yifan3429)专业报表分组加入图片 rt.Cells(0,4).Image = GetImage(CurRow("照片")) Dim doc
As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rm As New prt.RenderImage() \'定义一个图片对象 rm.Image = GetImage("logon.ico") \'请改为实际的图标名称和路径 rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'图片水平居中 rm.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center \'图片垂直居中 rm.Style.ImageAlign.StretchHorz = False \'禁止水平方向扩展图片 rm.Style.ImageAlign.StretchVert = False \'禁止垂直方向扩展图片 doc.Body.Children.Add(rt) \'将表格对象加入到报表中 rt.Style.GridLines.All = New prt.Linedef(Color.DarkGray) \'将表格的颜色设为深灰色 rt.Rows.Count = 3 \'设置行数 rt.Cols.Count = 3 \'设置列数 rt.Width = 60 \'设置表格的宽度 rt.Height = 60 \'设置表格的高度 rt.Cells(1,1).RenderObject = rm \'将单元格内容设置为图片对象rm Doc.Preview() \'预览报表 两种方式供参考
|
-- 作者:yifan3429 -- 发布时间:2021/5/23 11:08:00 -- Dim doc As New PrintDoc Dim rt As Prt.RenderTable Dim rx As prt.RenderText Dim CurRow As Row = Tables("活动家居产品库").Current Dim tbl As Table = Tables("活动家居产品库") Dim Rows As List(Of DataRow) Dim Regions As List(Of String) = tbl.DataTable.GetValues("品牌") doc.Pagesetting.LandScape = True For Each Region As String In Regions rx = New prt.RenderText rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 2 rx.Text = "品牌: " & Region doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.Font = Tables("活动家居产品库").Font rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.Style.Spacing.Bottom = 5 rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font Rows = tbl.DataTable.Select("[品牌] = \'" & Region & "\'") Dim tb As Table = Tables("活动家居产品库") Dim ColNames As String() = New String(){"分类","产品名称","型号","原始图片","备注"} rt.Style.Font = tb.Font For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) rt.Cells(0,4).Image = GetImage(CurRow("原始图片")) 还是不显示图片 不知道哪里不多 求助 Next Next rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线 rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头. doc.Body.Children.Add(rt) \'将表格加入到报表 Next doc.preview()
|
-- 作者:cnsjroom -- 发布时间:2021/5/23 11:17:00 -- 回复:(yifan3429)Dim doc As New PrintDocDim rt A... rt.Cells(r+1,3).Image = GetImage(CurRow("原始图片")) 试试看
|
-- 作者:yifan3429 -- 发布时间:2021/5/23 14:19:00 -- For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) rt.Cells(r+1,3).Image = GetImage("\\\\Citywsv\\产品库$\\家居\\" & CurRow("原始图片")) Next Next \\\\Citywsv\\产品库$\\家居\\莫弗\\(1.8M)床组23C002A-3011.jpg 地址可以直接看图片 还是不能显示图片
[此贴子已经被作者于2021/5/23 14:21:15编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/5/23 21:42:00 -- 确定图片路径正确? msgbox("\\\\Citywsv\\产品库$\\家居\\" & CurRow("原始图片")) 这样能不能显示图片? rt.Cells(r+1,3).Image = GetImage("\\\\Citywsv\\产品库$\\家居\\莫弗\\(1.8M)床组23C002A-3011.jpg") 图片单独处理 Dim tb As Table = Tables("活动家居产品库") Dim ColNames As String() = New String(){"分类","产品名称","型号","原始图片","备注"} rt.Style.Font = tb.Font For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 if ColNames(c) <>"原始图片" rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) else rt.Cells(r + 1,3).Image = GetImage(CurRow("原始图片")) 还是不显示图片 不知道哪里不多 求助 end if Next Next |
-- 作者:yifan3429 -- 发布时间:2021/8/1 8:59:00 -- rt.Cells(r + 1,3).Image = GetImage(CurRow("商品图片")) 代码 rt.Cells(r + 1,2).Image = GetImage("https://weapp-1253522117.image.myqcloud.com//image/20210204/d7d3b458d91346ec.jpg") 实际地址 不能显示出来 [此贴子已经被作者于2021/8/1 8:59:48编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/8/1 20:01:00 -- GetImage仅支持本地图片。网络图片请先下载 |