找回密码
 立即注册

QQ登录

只需一步,快速开始

maco

银牌会员

4

主题

15

帖子

3300

积分

银牌会员

积分
3300

活字格认证

最新发帖
maco
银牌会员   /  发表于:2014-3-10 10:17  /   查看:6422  /  回复:7
你好,

我想請教一下, ActiveReports 7 可否先將一份generate 了的report 先cache 後再修改data.
再將他export to PDF..

因為我有一份report 要generate 大約60 分鐘. 因為同一份report 要同時generate 要給不同的人, 但只是在page header 部份更改 一個label 的data. 的, 而內容是一樣的.

所以請教可以將第一次generate 這份report 時.. 先將這份report cache .. 再修改page header 之後才export to PDF ??

7 个回复

倒序浏览
roger.wang
社区贡献组   /  发表于:2014-3-10 11:12:00
沙发
回复 1楼maco的帖子

请问,您用的是什么报表:Page还是Section报表?

Section报表的话,可通过RDF 的方式实现cache,详细可参考:
ActiveReports 7 > ActiveReports User Guide > How To > Section Report How To > Save and Load RDF Report Files
回复 使用道具 举报
maco
银牌会员   /  发表于:2014-3-10 14:56:00
板凳
我嘗試過.是可以cache 的. 但是. 當我load 回這個RDF 之後.. 再change 里面Label 的Text 之後.. 我在debug mode 看到它已經給修改了.. 但是當export 出來的PDF. 還是舊的data.
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-3-10 16:03:00
地板
回复 3楼maco的帖子

load、export的代码有吗?

我在本地验证一下效果。
回复 使用道具 举报
maco
银牌会员   /  发表于:2014-3-10 20:22:00
5#
附上Source code.

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim rpt As New SectionReport1
  3.         rpt.Run()
  4.         rpt.Document.Save("test.rdf")

  5.         Dim PDFExport As GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  6.         PDFExport = New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  7.         PDFExport.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17
  8.         PDFExport.ImageQuality = GrapeCity.ActiveReports.Export.Pdf.Section.ImageQuality.Medium
  9.         PDFExport.NeverEmbedFonts = ""
  10.         PDFExport.Export(rpt.Document, "test.pdf")

  11.     End Sub

  12.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  13.         Dim rpt As New SectionReport1
  14.         rpt.Document.Load("test.rdf")
  15.         MsgBox(rpt.Label1.Text)
  16.         rpt.Label1.Text = "After Changed"
  17.         MsgBox(rpt.Label1.Text)
  18.         Dim PDFExport As GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  19.         PDFExport = New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  20.         PDFExport.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17
  21.         PDFExport.ImageQuality = GrapeCity.ActiveReports.Export.Pdf.Section.ImageQuality.Medium
  22.         PDFExport.NeverEmbedFonts = ""
  23.         PDFExport.Export(rpt.Document, "test_after_changed.pdf")

  24.     End Sub
复制代码


本帖子中包含更多资源

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

x
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-3-11 13:38:00
6#
回复 5楼maco的帖子

在这行代码 rpt.Label1.Text = "After Changed"后,添加rpt.Run()试试。
回复 使用道具 举报
maco
银牌会员   /  发表于:2014-3-11 14:25:00
7#
如果是這樣子的話... Label2 的data 會被reset.
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim rpt As New SectionReport1
  3.         rpt.Label2.Text = "ABC"
  4.         rpt.Run()
  5.         rpt.Document.Save("test.rdf")
  6.         Dim PDFExport As GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  7.         PDFExport = New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  8.         PDFExport.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17
  9.         PDFExport.ImageQuality = GrapeCity.ActiveReports.Export.Pdf.Section.ImageQuality.Medium
  10.         PDFExport.NeverEmbedFonts = ""
  11.         PDFExport.Export(rpt.Document, "test.pdf")
  12.     End Sub
  13.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  14.         Dim rpt As New SectionReport1
  15.         rpt.Document.Load("test.rdf")
  16.         MsgBox(rpt.Label1.Text)
  17.         rpt.Label1.Text = "After Changed"
  18.         MsgBox(rpt.Label1.Text)
  19.         rpt.Run()
  20.         Dim PDFExport As GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  21.         PDFExport = New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
  22.         PDFExport.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17
  23.         PDFExport.ImageQuality = GrapeCity.ActiveReports.Export.Pdf.Section.ImageQuality.Medium
  24.         PDFExport.NeverEmbedFonts = ""
  25.         PDFExport.Export(rpt.Document, "test_after_changed.pdf")
  26.     End Sub
复制代码
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-3-11 17:04:00
8#
回复 7楼maco的帖子

抱歉,动态修改的值,无法保存为rdf文件。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部