Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331713 - reportContext.getOutputFormat not working
Summary: reportContext.getOutputFormat not working
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.6.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7.0   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard: Obsolete
Keywords:
: 332906 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-02 14:40 EST by Jason Weathersby CLA
Modified: 2011-05-26 13:33 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***