Community
Participate
Working Groups
When calling reportContext.getOutputFormat() in a beforeFactory script does not always return the right value. Add the following code to the beforeFactory importPackage( Packages.java.io ); out = new PrintWriter( new FileWriter( "c:/test/log.txt", true ) ); out.println( reportContext.getOutputFormat()); out.close() run the report to html, then pdf, then back to html. The last time in html the log will show output format pdf.
Since this script is called at generation time, so if the report is fixed-layout, it always return "pdf". If the report is auto-layout, it always return "html". If this script is called at render time, it should return the actually format. Marked as wontfix.
In my opinion that makes this call misleading. From script you can get the __format url parameter and at runtime in the viewer it is set to html even with a fixed report.
The reason is we execute two task for such a request, the run task has no format while the render task has a format. The beforeFactory is invoked in the run task only.
I understand that. Maybe a better option would be to return rptdocument instead of pdf.
*** Bug 332906 has been marked as a duplicate of this bug. ***