Foxtable(狐表)用户栏目专家坐堂 → [求助]专业报表预览时 图片有时显示不出来,麻烦大家看看是什么问题?


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

主题:[求助]专业报表预览时 图片有时显示不出来,麻烦大家看看是什么问题?

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


加好友 发短信
等级:一尾狐 帖子:470 积分:4184 威望:0 精华:0 注册:2013/12/9 0:52:00
[求助]专业报表预览时 图片有时显示不出来,麻烦大家看看是什么问题?  发帖心情 Post By:2022/5/11 17:57:00 [只看该作者]

Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.LeftMargin = 26 '设置左边距
Doc.PageSetting.RightMargin = 24 '设置右边距
Doc.PageSetting.TopMargin = 28 '设置上边距
Doc.PageSetting.BottomMargin = 27.4 '设置下边距
Dim rs As New prt.RenderTable() '定义一个表格对象
Dim rb As New prt.RenderText()
rb.style.font=New Font("宋体",22,FontStyle.Bold ) '设置文本对象的字体
rb.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
rb.Text = "图片记录表" '设置文本对象的内容
doc.Body.Children.Add(rb)

rs.Style.TextAlignVert = prt.AlignVertEnum.Center
rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rs.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rs.Width = "Parent.Width" '表宽为150毫米
rs.Height = 230 '表高为150毫米
rs.Rows.Count = 4 '设置行数
rs.Cols.Count = 2 '设置列数
rs.Style.GridLines.All = New Prt.LineDef(0.01, Color.Black)
rs.Style.Spacing.Top = 5

rs.Cols(0).Width =26

rs.Cells(2,0).SpanCols = 2
rs.Cells(3,0).SpanCols = 2
rs.Rows(0).Height=10
rs.Rows(1).Height=10
rs.Rows(2).Height=92
rs.Rows(3).Height=92

rs.cells(0,0).Text = "编号"
rs.cells(0,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs.cells(1,0).Text = "备注"
rs.cells(1,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs.cells(0,1).Text = "DW2022003002" 
rs.cells(0,1).Style.Font = New Font("仿宋", 15)
rs.cells(1,1).Text = "检查前封装正、反面外观照片"
rs.cells(1,1).Style.Font = New Font("仿宋", 15)


Dim rt1 As prt.RenderText
Dim re1 As prt.RenderArea
re1 = rs.Cells(2,0).Area
Dim rm1 As New prt.RenderImage() '定义一个图片对象
rm1.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm1.Style.Spacing.Top = 2
rm1.Style.ImageAlign.KeepAspectRatio = True
rm1.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
rm1.x=13
rm1.Height =90
re1.Children.Add(rm1)

rt1 = New prt.RenderText
rt1.Style.TextAlignHorz = prt.AlignHorzEnum.Center  
rt1.text ="(检查前检材正面外观照片)"
rt1.Style.Font = New Font("仿宋", 15)
rt1.y=92
re1.Children.Add(rt1)



Dim rt2 As prt.RenderText
Dim re2 As prt.RenderArea
re2 = rs.Cells(3,0).Area
Dim rm2 As New prt.RenderImage() '定义一个图片对象
rm2.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm2.Style.ImageAlign.KeepAspectRatio = True
rm2.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
rm2.x=13
rm2.Height =90
rm2.Style.Spacing.Top = 2
re2.Children.Add(rm2)
rt2 = New prt.RenderText
rt2.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt2.text ="(检查前反面外观照片)"
rt2.Style.Font = New Font("仿宋", 15)
rt2.y=92
re2.Children.Add(rt2)
doc.Body.Children.Add(rs)



'-------------------------------------------------------------------------检中
Dim rb1 As New prt.RenderText()
Dim rs1 As New prt.RenderTable() '定义一个表格对象
rb1.Text = "图片记录表" '设置文本对象的内容
rb1.style.font=New Font("宋体",22,FontStyle.Bold ) '设置文本对象的字体
rb1.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
doc.Body.Children.Add(rb1)
rs1.Style.TextAlignVert = prt.AlignVertEnum.Center
rs1.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rs1.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rs1.Width = "Parent.Width" '表宽为150毫米
rs1.Height = 230 '表高为150毫米
rs1.Rows.Count = 4 '设置行数
rs1.Cols.Count = 2 '设置列数
rs1.Style.GridLines.All = New Prt.LineDef(0.01, Color.Black)
rs1.Style.Spacing.Top = 5

rs1.Cols(0).Width =26
rs1.Cells(2,0).SpanCols = 2
rs1.Cells(3,0).SpanCols = 2
rs1.Rows(0).Height=10
rs1.Rows(1).Height=10
rs1.Rows(2).Height=92
rs1.Rows(3).Height=92

rs1.cells(0,0).Text = "编号"
rs1.cells(0,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs1.cells(1,0).Text = "备注"
rs1.cells(1,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs1.cells(0,1).Text = "DW2022003002" 
rs1.cells(0,1).Style.Font = New Font("仿宋", 15)
rs1.cells(1,1).Text = "检查中封装正、反面外观照片"
rs1.cells(1,1).Style.Font = New Font("仿宋", 15)


Dim rt3 As prt.RenderText
Dim re3 As prt.RenderArea
re3 = rs1.Cells(2,0).Area
Dim rm3 As New prt.RenderImage() '定义一个图片对象

rm3.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm3.Style.ImageAlign.KeepAspectRatio = True
rm3.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
 rm3.x=13
rm3.Height =90
rm3.Style.Spacing.Top = 2
re3.Children.Add(rm3)
rt3 = New prt.RenderText
rt3.Style.TextAlignHorz = prt.AlignHorzEnum.Center  
rt3.text ="(检查中正面外观照片)"
rt3.Style.Font = New Font("仿宋", 15)
rt3.y=92
re3.Children.Add(rt3)


Dim rt4 As prt.RenderText
Dim re4 As prt.RenderArea
re4 = rs1.Cells(3,0).Area
Dim rm4 As New prt.RenderImage() '定义一个图片对象
rm4.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm4.Style.ImageAlign.KeepAspectRatio = True
rm4.Style.Spacing.Top = 2
rm4.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
rm4.x=13
rm4.Height =90
re4.Children.Add(rm4)
rt4 = New prt.RenderText
rt4.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt4.text ="(检查中反面外观照片)"
rt4.Style.Font = New Font("仿宋", 15)
rt4.y=92
re4.Children.Add(rt4)
doc.Body.Children.Add(rs1)
'
'----------------------------------------------------------------------------------------检查后
Dim rb2 As New prt.RenderText()
Dim rs2 As New prt.RenderTable() '定义一个表格对象
rb2.Text = "图片记录表" '设置文本对象的内容
rb2.style.font=New Font("宋体",22,FontStyle.Bold ) '设置文本对象的字体
rb2.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
doc.Body.Children.Add(rb2)
rs2.Style.TextAlignVert = prt.AlignVertEnum.Center
rs2.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rs2.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
rs2.Width = "Parent.Width" '表宽为150毫米
rs2.Height = 230 '表高为150毫米
rs2.Rows.Count = 4 '设置行数
rs2.Cols.Count = 2 '设置列数
rs2.Style.GridLines.All = New Prt.LineDef(0.01, Color.Black)
rs2.Style.Spacing.Top = 5


rs2.Cells(2,0).SpanCols = 2
rs2.Cells(3,0).SpanCols = 2
rs2.Rows(0).Height=10
rs2.Rows(1).Height=10
rs2.Rows(2).Height=92
rs2.Rows(3).Height=92
rs2.Cols(0).Width =26
rs2.cells(0,0).Text = "编号"
rs2.cells(0,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs2.cells(1,0).Text = "备注"
rs2.cells(1,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
rs2.cells(0,1).Text = "DW2022003002" 
rs2.cells(0,1).Style.Font = New Font("仿宋", 15)
rs2.cells(1,1).Text = "检查后重新封装后正、反面外观照片"
rs2.cells(1,1).Style.Font = New Font("仿宋", 15)


Dim rt5 As prt.RenderText
Dim re5 As prt.RenderArea
re5 = rs2.Cells(2,0).Area
Dim rm5 As New prt.RenderImage() '定义一个图片对象
rm5.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
rm5.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
rm5.x=13
rm5.Height =90
rm5.Style.Spacing.Top = 2
rm5.Style.ImageAlign.KeepAspectRatio = True
re5.Children.Add(rm5)
rt5 = New prt.RenderText
rt5.text ="(检查后重新封装后正面外观照片)"
rt5.Style.Font = New Font("仿宋", 15)
rt5.Style.TextAlignHorz = prt.AlignHorzEnum.Center  
rt5.y=92
re5.Children.Add(rt5)


Dim rt6 As prt.RenderText
Dim re6 As prt.RenderArea
re6 = rs2.Cells(3,0).Area
Dim rm6 As New prt.RenderImage() '定义一个图片对象
rm6.Image = GetImage("C:\Users\Administrator\Desktop\DSC_1630.JPG")
rm6.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
 rm6.x=13
rm6.Height =90
rm6.Style.Spacing.Top = 2
rm6.Style.ImageAlign.KeepAspectRatio = True
re6.Children.Add(rm6)
rt6 = New prt.RenderText
rt6.text ="(检查后检材封装后反面外观照片)"
rt6.Style.Font = New Font("仿宋", 15)
rt6.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt6.y=92
re6.Children.Add(rt6)
doc.Body.Children.Add(rs2)
doc.Preview() '预览
图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看

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


加好友 发短信
等级:超级版主 帖子:111376 积分:566944 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/5/12 8:33:00 [只看该作者]

代码测试没有问题。会不会是图片有问题?

请新建项目做个例子和图片一起发上来测试一下

 回到顶部