|
Re: Page number always 1 in the masterpage of the report generated by program [message #559108 is a reply to message #559075] |
Wed, 15 September 2010 15:31 |
|
This does look like a bug. Can you report it? To work around it can
you change your for loop to do the following:
for(int i = 0; i < 1000; i++) {
LabelHandle dataNameLabel = designFactory.newLabel(null);
dataNameLabel.setText(String.valueOf(i));
if( (i % 20) == 0 && i > 0 ){
dataNameLabel.setProperty("pageBreakAfter", "Always");
}
rdh.getBody().add(dataNameLabel);
}
On 9/15/2010 10:15 AM, diyfan wrote:
> 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);
> }
> }
|
|
|
|
|
|
Re: Page number always 1 in the masterpage of the report generated by program [message #559653 is a reply to message #559612] |
Fri, 17 September 2010 13:51 |
|
Helmut,
I think this is the issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=324860
Jason
On 9/17/2010 7:04 AM, Helmut Neubauer wrote:
> Sorry for posting two times. Is there any workaround, using scripts or
> doing something else? We only use the predefined grid component n of m
> in our master page.
>
> Am 17.09.2010 13:02, schrieb Helmut Neubauer:
>> Can you give us the link of your bug report?
>>
>> We've this problem, too. It's a problem of BIRT 2.6, in 2.5 we didn't
>> have the problem.
>>
>> If we use the BIRT web viewer to view our report all is ok. In HTML, our
>> report has 4 pages. If we than export the report to PDF the PDF takes
>> the page numbers of the HTML version. It has above to 50 pages but the
>> page numbers go from 1 to 4 like the HTML version.
>>
>> Helmut
>>
>>
>> Am 15.09.2010 17:55, schrieb diyfan:
>>> Thank you for the quick answer.
>>>
>>> I will report this problem to BIRT.
>>>
>>> Another solution is to use IRunAndRenderTask but I think that it may
>>> cause other problems in the report.
>>>
>>> best regards
>>
>
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.12229 seconds