gpt4 book ai didi

grails - 如何在 BIRT 报告中使用 Grails 并显示 BIRT Web 查看器

转载 作者:行者123 更新时间:2023-12-02 13:46:20 26 4
gpt4 key购买 nike

我在 Grails Web 应用程序项目上安装了 birt-report 插件,但我无法理解如何使用它。我有两个用例:

  • 生成 BIRT web 查看器并在 GSP 页面上显示(显示图表报告)
  • 将 BIRT 报告生成为其他文件格式(PDF、Word 等)

  • 任何人都可以提供如何做到这一点的例子吗?

    最佳答案

    基本上您可以使用插件文档( http://grails.org/plugin/birt-report )中提到的示例。
    1. 用于生成 HTML 报告使用。注意 BIRT 生成 HTML 而不是 GSP。您可以在 GSP 页面内呈现输出 HTML。

    // generate html output and send it to the browser
    def show() {
    String reportName = params.remove('id')
    String reportExt = 'pdf'
    params.remove('action')
    params.remove('controller')
    params.remove('name')
    def options = birtReportService.getRenderOption(request, 'html')
    def result=birtReportService.runAndRender(reportName, params, options)
    response.contentType = 'text/html'
    response.outputStream << result.toByteArray()
    return false
    }
  • 生成pdf以供下载

    def downloadAsPDF() {
    String reportName = params.remove('id')
    字符串 reportExt = 'pdf'
    params.remove(' Action ')
    params.remove(' Controller ')
    params.remove('name')
    def options = birtReportService.getRenderOption(request, 'pdf')
    def result=birtReportService.runAndRender(reportName, params, options)
    response.setHeader("Content-disposition", "attachment; filename="+reportName + "."+reportExt);
    response.contentType = '应用程序/pdf'
    response.outputStream << result.toByteArray()
    返回假
    }
  • 关于grails - 如何在 BIRT 报告中使用 Grails 并显示 BIRT Web 查看器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3746619/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com