找回密码
 立即注册

QQ登录

只需一步,快速开始

shenglingshi

初级会员

40

主题

82

帖子

266

积分

初级会员

积分
266
shenglingshi
初级会员   /  发表于:2016-9-13 09:20  /   查看:3368  /  回复:5
本帖最后由 Lenka.Guo 于 2016-9-13 11:17 编辑

                  我使用API将区域报表导出PDF,页面报表没错,为什么区域报表生成的PDF文件错误呢?
                导出数据代码如下:              //区域报表               SectionReport sectionReport = new SectionReport();

                    sectionReport.LoadLayout(filePath);
                    sectionReport.DataSource = getDataSource();

                    PdfExport pdfExport = new PdfExport();
                    pdfExport.Export(sectionReport.Document, Server.MapPath("~/PrintExport/" + newDirectory) + "/index.pdf");



                      导出的PDF使用Adobe Reader打开如下:
                     


本帖子中包含更多资源

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

x

5 个回复

倒序浏览
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-9-13 09:31:57
沙发
代码看起来好像在创建区域报表时,少一句代码:
  1. GrapeCity.ActiveReports.SectionReport sectionReport = new GrapeCity.ActiveReports.SectionReport();
  2. System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(@"..\..\SectionReport1.rpx");
  3. sectionReport.LoadLayout(xtr);
  4. xtr.Close();

复制代码


回复 使用道具 举报
shenglingshi
初级会员   /  发表于:2016-9-13 09:41:19
板凳
本帖最后由 shenglingshi 于 2016-9-13 09:50 编辑

貌似,没有起作用。。。 还有,生成html也没成功。
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-9-13 11:04:23
地板
shenglingshi 发表于 2016-9-13 09:41
貌似,没有起作用。。。 还有,生成html也没成功。

测试之后,发现错误原因还是代码的问题:

  1.             GrapeCity.ActiveReports.SectionReport sectionReport = new GrapeCity.ActiveReports.SectionReport();
  2.             System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(@"..\..\SectionReport2.rpx");
  3.             sectionReport.LoadLayout(xtr);
  4.             sectionReport.Run();

  5.             viewer1.LoadDocument(sectionReport);

  6.             GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
  7.             PdfExport1.Export(sectionReport.Document, Application.StartupPath + "\\PDFExp.pdf");
复制代码


回复 使用道具 举报
shenglingshi
初级会员   /  发表于:2016-9-13 15:01:38
5#
Lenka.Guo 发表于 2016-9-13 11:04
测试之后,发现错误原因还是代码的问题:

女侠厉害  可以了。
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-9-13 15:28:45
6#
shenglingshi 发表于 2016-9-13 15:01
女侠厉害  可以了。

解决了就好~~~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部