我在b/s插件上安装了Grails Web应用程序项目,但我无法理解使用它。我有2个用例:如何在BIRT报告中使用Grails并显示BIRT Web查看器
- 生成BIRT的Web浏览器,并显示在GSP页面(显示图表报告)
- 产生一些其他的文件格式(PDF,Word等)
任何人都可以请提供如何做到这一点的例子?
我在b/s插件上安装了Grails Web应用程序项目,但我无法理解使用它。我有2个用例:如何在BIRT报告中使用Grails并显示BIRT Web查看器
任何人都可以请提供如何做到这一点的例子?
基本上,您可以使用插件文档(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(){ 字符串所以reportName = params.remove( '编号') 字符串reportExt = 'PDF' params.remove( '动作' ) params.remove( '控制器') params.remove( '姓名') DEF选项= birtReportService.getRenderOption(请求, 'PDF') 高清结果= birtReportService.runAndRender(所以reportName,则params,选项) response.setHeader(“Content-disposition”,“attachment;文件名= “+所以reportName +”“+ reportExt); response.contentType = '应用/ PDF' response.outputStream < < result.toByteArray() 返回false }
为什么这个问题保护?答案在哪里? – aldrin 2013-11-22 04:19:14