以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  第一次做报表,有些搞不懂,请帮忙改改  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131675)

--  作者:hongyefor
--  发布时间:2019/3/4 11:30:00
--  第一次做报表,有些搞不懂,请帮忙改改

Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
Dim fl2 As String = ProjectPath & "Reports\\发票图片.pdf" \'指定目标PDF文件
Dim doc As New PrintDoc \'定义一个报表
Dim ra As New prt.RenderArea
doc.PageSetting.Landscape = True
Dim rm As New prt.RenderImage() \'定义一个图片对象
rm.Image = GetImage(Tables("发票认证信息_Table1").Current("发票图片")) \'请改为实际的图标名称和路径
rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'图片水平居中
rm.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center \'图片垂直居中
rm.Style.ImageAlign.StretchHorz = False \'禁止水平方向扩展图片
rm.Style.ImageAlign.StretchVert = False \'禁止垂直方向扩展图片
ra.Children.Add(rm)
doc.Body.Children.Add(ra) \'将表格对象加入到报表中
doc.SavePDF(fl2) \'保存为PDF文件
doc.Build() \'逐行生成报表
doc.Quit() \'退出
wbr.AddRess = fl2

 

本窗口是图片显示窗口,上面代码是在AfterLoad里,窗口控件只有WebBrowser1

但是提示错误

我的想法是在发票认证信息的Table1表中双击后在,表中的图片文件生成报表显示在WebBrowser1,之前是用word,因为安装附件麻烦所以使用代码,请帮我改一下以上代码


--  作者:有点甜
--  发布时间:2019/3/4 11:39:00
--  

用一个picturebox显示不行?

 

Dim p As WinForm.PictureBox = e.Form.Controls("picturebox")
Dim file = Tables("发票认证信息_Table1").Current("发票图片")
Dim ftp As new FTPClient
ftp.Host = "xxx"
ftp.Account = "xxx"
ftp.Password = "xxx"
If ftp.Download(file, ProjectPath & "temp.jpg") Then
    p.Image = GetImage(ProjectPath & "temp.jpg") \'请改为实际的图标名称和路径
Else
    msgbox("下载失败")
End If


--  作者:hongyefor
--  发布时间:2019/3/4 11:48:00
--  
我在想反正今后需要,所以想边学边做啊,这样今后就懂怎么做了呀,是不是可以帮忙改改?
--  作者:有点甜
--  发布时间:2019/3/4 12:28:00
--  

Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
Dim fl2 As String = ProjectPath & "Reports\\发票图片.pdf" \'指定目标PDF文件
Dim doc As New PrintDoc \'定义一个报表
Dim ra As New prt.RenderArea
doc.PageSetting.Landscape = True
Dim file = Tables("发票认证信息_Table1").Current("发票图片")
Dim ftp As new FTPClient
ftp.Host = "xxx"
ftp.Account = "xxx"
ftp.Password = "xxx"
If ftp.Download(file, ProjectPath & "temp.jpg") Then
    Dim rm As New prt.RenderImage() \'定义一个图片对象
    rm.Image = GetImage(ProjectPath & "temp.jpg") \'请改为实际的图标名称和路径
    rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'图片水平居中
    rm.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.Center \'图片垂直居中
    rm.Style.ImageAlign.StretchHorz = False \'禁止水平方向扩展图片
    rm.Style.ImageAlign.StretchVert = False \'禁止垂直方向扩展图片
    ra.Children.Add(rm)
Else
    msgbox("下载失败")
End If

doc.Body.Children.Add(ra) \'将表格对象加入到报表中
doc.SavePDF(fl2) \'保存为PDF文件

wbr.AddRess = fl2