找回密码
 立即注册

QQ登录

只需一步,快速开始

fumasoft
金牌服务用户   /  发表于:2018-5-23 18:41  /   查看:5933  /  回复:11
本帖最后由 fumasoft 于 2018-5-31 18:44 编辑

公司安排我做一个JSON数据源导出PDF的功能,数据中有一个图片需要显示,图片数据是一个URL的图片ID,这个ID会传入报表,与内置的URL拼接并显示出来,但是我在预览状态下可以看到图片显示,但是用WinForm导出报表时看不到图片,可是我可以将图片ID做文本显示出来,但不知道为什么图片无法显示。





请大神指导一下


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

11 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-5-24 10:44:28
沙发
你好,你现在的问题是在winform的情况下,显示图片是可以正常显示的,但是导出PDF的时候图片就显示不出来是吧!
如果是这样,你试着换另外一种PDF的导出方式试试:

  1. // Provide the page report you want to render.
  2. System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
  3. GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);

  4. // Create an output directory.
  5. System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
  6. outputDirectory.Create();

  7. // Provide settings for your rendering output.
  8. GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();

  9. // Reduce the report size and report generation time.
  10. pdfSetting.OptimizeStatic = true;

  11. // Set the rendering extension and render the report.
  12. GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
  13. GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
  14.             
  15. // Overwrite output file if it already exists
  16. outputProvider.OverwriteOutputFile = true;

  17. pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
复制代码




回复 使用道具 举报
fumasoft
金牌服务用户   /  发表于:2018-5-24 14:39:06
板凳
不是,WinForm也显示不出来
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-5-24 16:00:16
地板
那就是直接预览的时候,就显示不出来。
那你要确保图片的URL是正确的,并且在控件图片直接绑定显示的这个URL是可以显示图片的,也就是说,你在winform图片里显示的文字,也就是URL链接是可以显示出来的。如下图这样

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
fumasoft
金牌服务用户   /  发表于:2018-5-24 18:21:09
5#
我知道了,我的图片路径是https的,我看了一个你的贴子
[
设置了<ActiveReports11>
    <WebServicepublicURI   publicURI="https://xxx.com" />
  </ActiveReports11>
但是reportService: { url: 'http://reverse-proxy.com'; };这种怎么设置啊,设置到哪个文件中啊

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-5-25 10:57:26
6#
本帖最后由 KearneyKang 于 2018-5-25 10:58 编辑

你看到这个解决办法可能不可以解决你的问题,这个是Java用户使用AR然后的内外网端口不一致导致无法访问的问题。
你这个是图片绑定的URL根本就不正确的问题,也就是说你的Value值不正确。你要确保绑定的value 值正确,然后图片才可以正常显示
回复 使用道具 举报
fumasoft
金牌服务用户   /  发表于:2018-5-25 15:22:38
7#
本帖最后由 fumasoft 于 2018-5-25 16:35 编辑

哦,好,我再看一下路径问题
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-5-25 16:36:46
8#
你的URL是没有问题,我在我本地直接绑定你提供的是可以正常显示的。
用记事本打开报表的配置信息如下:
  1. <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition">
  2.         <Body>
  3.                 <Height>5cm</Height>
  4.                 <ReportItems>
  5.                         <Image Name="Image1">
  6.                                 <Height>3.4cm</Height>
  7.                                 <Left>3.4cm</Left>
  8.                                 <Sizing>Fit</Sizing>
  9.                                 <Source>External</Source>
  10.                                 <Style />
  11.                                 <Top>0.6cm</Top>
  12.                                 <Value>https://aapi.laifuyun.com/v2/image/2,0a3e0ece9d55/@100</Value>
  13.                                 <Width>5cm</Width>
  14.                         </Image>
  15.                 </ReportItems>
  16.                 <Style />
  17.         </Body>
  18.         <BottomMargin>2.5cm</BottomMargin>
  19.         <LeftMargin>2.5cm</LeftMargin>
  20.         <PageHeight>29.7cm</PageHeight>
  21.         <PageWidth>21cm</PageWidth>
  22.         <RightMargin>2.5cm</RightMargin>
  23.         <TopMargin>2.5cm</TopMargin>
  24.         <Width>16cm</Width>
  25. </Report>
复制代码


回复 使用道具 举报
fumasoft
金牌服务用户   /  发表于:2018-5-25 18:43:44
9#
不好意思,是我这边的问题,现在我已经可以显示图片了,谢谢
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-5-28 09:06:28
10#
很高兴,解决了困扰您很久的问题。你具体是哪里操作导致了该问题
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部