Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsPage number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559075/#msg_559075
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);
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}]]>diyfan 2010-09-15T14:15:02-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559108/#msg_559108
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);
> }
> }]]>Jason Weathersby2010-09-15T15:31:37-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559109/#msg_559109
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]]>diyfan 2010-09-15T15:55:25-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559611/#msg_559611
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]]>Helmut Neubauer2010-09-17T11:02:36-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559612/#msg_559612
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
>]]>Helmut Neubauer2010-09-17T11:04:57-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559653/#msg_559653
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
>>
>]]>Jason Weathersby2010-09-17T13:51:10-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/559869/#msg_559869
thanks for your answer. Is it possible to do the page numbering in another way (using scripts or doing somethind else) as workaround until the bug is fixed?
Thanks,
Helmut
]]>Helmut Neubauer2010-09-20T07:41:34-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/560197/#msg_560197
Any other idea?]]>Helmut Neubauer2010-09-21T14:09:42-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/560208/#msg_560208
Jason]]>Jason Weathersby2010-09-21T14:56:55-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/626084/#msg_626084
Helmut Neubauer2010-09-22T11:39:27-00:00Re: Page number always 1 in the masterpage of the report generated by program
https://www.eclipse.org/forums/index.php/mv/msg/175473/626318/#msg_626318
Jason]]>Jason Weathersby2010-09-22T14:13:45-00:00