Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325373 - Page number always 1 in the masterpage of the report generated by program
Summary: Page number always 1 in the masterpage of the report generated by program
Status: VERIFIED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.6.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.7.0   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Xiaodan Wang CLA
URL:
Whiteboard: Obsolete
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-15 11:59 EDT by diyfan CLA
Modified: 2011-05-26 13:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description diyfan CLA 2010-09-15 11:59:22 EDT
Hello,

I found a problem of autotext of PageNumber in MasterPage

The page number is always 1 if the report is designed and generated by Java program.

To reproduce the problem, you create an empty rptdesign file with A4 size and put an autotext of page number in the header of MasterPage, then use the program below to generate the report:

public static void main(String[] args) {
try {
EngineConfig config = new EngineConfig();
config.setBIRTHome("E:\\eclipsebirtsdk\\birt-runtime-2_6_0\\ReportEngine ");
Platform.startup(config);

IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_E NGINE_FACTORY);
IReportEngine bre = factory.createReportEngine(config);

String eoRptDesignFilePath = "C:\\projets\\java\\doccompta\\PisteAuditReport\\" +
"test_report.rptdesign";
IReportRunnable eoRptDesign = bre.openReportDesign(eoRptDesignFilePath);
ElementFactory designFactory = eoRptDesign.getDesignHandle().getElementFactory( );
ReportDesignHandle rdh = (ReportDesignHandle)eoRptDesign.getDesignHandle();

for(int i = 0; i < 1000; i++) {
LabelHandle dataNameLabel = designFactory.newLabel(null);
dataNameLabel.setText(String.valueOf(i));

rdh.getBody().add(dataNameLabel);
}
IRunTask runTask = bre.createRunTask(eoRptDesign);
String rptDocFilePath = "c:\\temp\\temp.rptdocument"; //fichier temporaire de birt
runTask.run(rptDocFilePath);

IReportDocument rptdoc = bre.openReportDocument(rptDocFilePath);
IRenderTask renderTask = bre.createRenderTask(rptdoc);

IRenderOption option = new PDFRenderOption();
option.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
option.setOutputFileName("c:\\temp\\a.pdf");

renderTask.setRenderOption(option);

renderTask.render();
renderTask.close();

rptdoc.close();

new File(rptDocFilePath).delete();

bre.destroy();

System.out.println("ok");
Desktop.getDesktop().open(new File("c:\\temp\\a.pdf"));

System.exit(0);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
Comment 1 Xiaoying Gu CLA 2010-09-17 02:39:47 EDT
This issue does exist in 2.6.0 release, but I can not reproduce it in the latest 2.6.1 build (v20100915-1750)

Set as fixed.
Comment 2 Xiaodan Wang CLA 2010-09-20 01:45:40 EDT
Verified in build (2.6.1.v20100915-1750).