Page number always 1 in the masterpage of the report generated by program [message #559075] |
Wed, 15 September 2010 10:15  |
Eclipse User |
|
|
|
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);
}
}
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07945 seconds