调用JasperReports报表通过RapidClipseX。

huangapple go评论95阅读模式
英文:

call JasperReports report by RapidClipseX

问题

以下是翻译好的部分:

对于 RapidClipse4,我使用以下代码调用并在新窗口中打开 JasperReport。

  1. try {
  2. this.browserFrame = new XdevBrowserFrame();
  3. final Resource exportToResource = Report.New()
  4. .jrxml("WebContent/WEB-INF/resources/reports/MeinReport.jrxml")
  5. .dataSource(com.xdev.dal.DAOs.get(com.MyReportDAO.class)
  6. .parameter("selJahr", selJahr)
  7. .mapField("L1_GroupName", "l1GroupName")
  8. .mapField("L2_GroupName", "l2GroupName")
  9. .mapField("dBetrag", "dbetrag")
  10. .mapField("JahrMonat", "jahrMonat"))
  11. .exportToResource(ExportType.PDF);
  12. this.browserFrame.setSource(exportToResource);
  13. } catch (final Exception e) {
  14. e.printStackTrace();
  15. }

几个月前,我切换到了 RapidClipseX。但是使用的代码不再起作用。

是否有关于以下内容的经验/示例代码:

  • 如何从 RapidClipseX Web 应用程序中调用 JasperReport?
  • 如何将其作为 PDF 在新窗口中打开?

(注意:以上内容仅为翻译,不包含回答或其他信息。)

英文:

For RapidClipse4 I used following code to call and open a JasperReport in a new window

  1. try {
  2. this.browserFrame = new XdevBrowserFrame();
  3. final Resource exportToResource = Report.New()
  4. .jrxml("WebContent/WEB-INF/resources/reports/MeinReport.jrxml")
  5. .dataSource( com.xdev.dal.DAOs.get(com.MyReportDAO.class)
  6. .parameter("selJahr", selJahr)
  7. .mapField("L1_GroupName", "l1GroupName")
  8. .mapField("L2_GroupName", "l2GroupName").mapField("dBetrag", "dbetrag")
  9. .mapField("JahrMonat", "jahrMonat")
  10. .exportToResource(ExportType.PDF);
  11. this.browserFrame.setSource(exportToResource);
  12. } catch (final Exception e) {
  13. e.printStackTrace();
  14. }

A few months ago I switched to RapidClipseX.
But the used code did not more work.

Are there any experience/ sample code to

  • call a JasperReport out of a RapidClipseX Webapplication?
  • open it in a new window as pdf?

答案1

得分: 2

这里有一个小例子:

  1. final StreamResource pdf = Report.New()
  2. .dataSource(new ArrayList<>())
  3. .jrxml("/Simple.jrxml")
  4. .exportToResource(Format.Pdf());
  5. final HtmlObject pdfViewer = new HtmlObject(pdf, "application/pdf");
  6. pdfViewer.setSizeFull();
  7. this.add(pdfViewer);

还有一个有用的提示:当您处于代码视图时,在左上角有一个代码调色板中的“Report”条目。当您点击此按钮时,将打开一个向导,它将帮助您创建导入jasper报表所需的代码。

英文:

Here is a small example:

  1. final StreamResource pdf = Report.New()
  2. .dataSource(new ArrayList&lt;&gt;())
  3. .jrxml(&quot;/Simple.jrxml&quot;)
  4. .exportToResource(Format.Pdf());
  5. final HtmlObject pdfViewer = new HtmlObject(pdf, &quot;application/pdf&quot;);
  6. pdfViewer.setSizeFull();
  7. this.add(pdfViewer);

Also a useful tip: When you are in the code view, in the top left there is a "Report" entry in the code palette. When you click this button a wizard will open that will help you create the code needed to import a jasper report.

答案2

得分: 0

使用上面的答案帮助,我按照以下代码使其运行起来:

  1. final StreamResource pdf = Report.New()
  2. .jrxml("/frontend/reports/MyReport.jrxml")
  3. .dataSource(MyReportDAO.INSTANCE.findAll())
  4. .mapField("Beschreibung", "beschreibung").mapField("Status", "status")
  5. .mapField("Erfassungsdatum", "erfassungsdatum").mapField("StatusAenderungsDatum", "statusAenderungsDatum")
  6. .exportToResource(Format.Pdf());
  7. final HtmlObject pdfViewer = new HtmlObject(pdf, "application/pdf");
  8. pdfViewer.setSizeFull();
  9. this.add(pdfViewer);
英文:

With help by the answer above I got it running by following code:

  1. final StreamResource pdf = Report.New()
  2. .jrxml(&quot;/frontend/reports/MyReport.jrxml&quot;)
  3. .dataSource(MyReportDAO.INSTANCE.findAll())
  4. .mapField(&quot;Beschreibung&quot;, &quot;beschreibung&quot;).mapField(&quot;Status&quot;, &quot;status&quot;)
  5. .mapField(&quot;Erfassungsdatum&quot;, &quot;erfassungsdatum&quot;).mapField(&quot;StatusAenderungsDatum&quot;, &quot;statusAenderungsDatum&quot;)
  6. .exportToResource(Format.Pdf());
  7. final HtmlObject pdfViewer = new HtmlObject(pdf, &quot;application/pdf&quot;);
  8. pdfViewer.setSizeFull();
  9. this.add(pdfViewer);

huangapple
  • 本文由 发表于 2020年8月15日 21:00:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/63426327.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定