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

Bug 325373

Summary: Page number always 1 in the masterpage of the report generated by program
Product: z_Archived Reporter: diyfan <xkymeimei>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: VERIFIED FIXED QA Contact: Xiaodan Wang <xwang>
Severity: critical    
Priority: P3 CC: bluesoldier
Version: 2.6.0   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete

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).