Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331713

Summary: reportContext.getOutputFormat not working
Product: z_Archived Reporter: Jason Weathersby <jasonweathersby>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: RESOLVED WONTFIX QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, millvall, wyan
Version: 2.6.1   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard: Obsolete

Description Jason Weathersby CLA 2010-12-02 14:40:39 EST
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.
Comment 1 Xiaoying Gu CLA 2010-12-07 01:28:31 EST
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.
Comment 2 Jason Weathersby CLA 2010-12-07 09:02:32 EST
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.
Comment 3 Wei Yan CLA 2010-12-07 12:38:16 EST
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.
Comment 4 Jason Weathersby CLA 2010-12-07 12:59:33 EST
I understand that.  Maybe a better option would be to return rptdocument instead of pdf.
Comment 5 Xiaoying Gu CLA 2010-12-19 21:36:56 EST
*** Bug 332906 has been marked as a duplicate of this bug. ***