We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

docx-Format page header at 2. page and page footer only at first page - what are the parameters

We have a document that needs the page footer only on the first page (the banner of the institution) and the page header at the second page (here the page number).
For the page header I set in the band properties the “Print when Expression”-Property with the following expression: $V{PAGE_NUMBER} > 1 and it works fine.
For the page footer I set the expression: $V{PAGE_NUMBER} == 1 but the footer is on each page. I also tried $V{PAGE_NUMBER} < 2 with the same reason. What’s going wrong???

Hi Procurement,

Thanks for your inquiry. Could you please attach following files for testing? I will investigate the issue on my side and provide you more information.

  • Please supply us with the Jrxml files along with xml/csv data source
  • Please supply us with the .jrprint file of your jrxml
  • Please supply us with the code from your application.
  • Please attach the output document that shows the undesired behavior.
  • Please share to which file format you are exporting your Jrxml file

As soon as you get these pieces of information to us we'll start our investigation into your issue.

Now I saw, that the page header is also on the first page. I took a look at the wrong place.
So the page header and the footer work in a wrong way.

We need:
Page header at the second page and ff.
Page footer only at the first page.

We create the worddokument from an internet application. This application is realised with intrexx
In Intrexx is a groovy-script that calls a function from the groovy-script in the zip-file.
We use iReport 5.0.1

Hi Procurement,

Thanks for sharing the detail.

I have tested the scenario and have managed to reproduce the page footer issue. There is no issue with page header. I have attached the output document with this post for your kind reference.

For the sake of correction, I have logged this problem in our issue tracking system as WORDSJSP-140. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

[quote user=“tahir.manzoor”]

Hi Procurement,

Thanks for sharing the detail.

I have tested the scenario and have managed to reproduce the page footer issue. There is no issue with page header. I have attached the output document with this post for your kind reference.

For the sake of correction, I have logged this problem in our issue tracking system as WORDSJSP-140. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

[/quote]

But the header also doesn’t work correct!!! On the first page is on top in the left corner the page number. That’s wrong. The page number should begin at page two.
Hi Procurement,

Thanks for your inquiry. I have not found the page number at left top corner of first page. Please check the attache image. Could you please share the screenshot of this issue?

here is a screenshot of my document

Hi Procurement,

Thanks for sharing the detail. Perhaps, you are using an older version of Aspose.Words for JasperReports; as with Aspose.Words for JasperReports 2.0.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words for JasperReports 2.0.0 and let us know how it goes on your side. I hope, this will help. I have attached the output document with this post for your kind reference.

Good morning,
i changed the aspose.word.jasperreports-jar. We work with iReport 5.1.0 so i took the 5.5.0-jar


but the problem is the same. Page number always at page 1 and page footer at every page

Hi Procurement,

Thanks for your inquiry. I have tested again the same scenario using jasperreports server 5.1.0 with same Jar file (aspose.words.jasperreports-5.5.0.jar) and have not found the page number issue (at first page).

  • I have created the jrprint file using iReport 5.1.0 and exported it to Docx with no issue. Please check the attached jrprint file
  • I have exported the shared jrxml to Docx and have not found the page number issue. Please check the attached Out.docx.

Please make sure that you are using latest version of
Aspose.Words for JasperReports 2.0.0.

It would be great if you please share your .jrprint file here for testing. I will investigate the issue on my side and provide you more information.

Please also share the AWDocxExporter parameters which you have used in your code. I have used the following code example to test your scenario.

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());

AWDocxExporter exporter = new AWDocxExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(AWExporterParameter.RECOGNIZE_FIELDS, true);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C:\\out.docx");

exporter.exportReport();


Hi,
here are the parameters we use in our file:


case “docx”:
reportDatei += “docx”
//JRDocxExporter exporter = new JRDocxExporter()
//exporter.setParameter(JRDocxExporter.JASPER_PRINT, jasperPrint)
//exporter.setParameter(JRDocxExporter.OUTPUT_FILE_NAME, reportDatei)

AWDocxExporter exporter = new AWDocxExporter()
exporter.setParameter(AWExporterParameter.LICENSE, “Aspose.Words.JasperReports.lic”);

//so war muss es sein
exporter.setParameter(AWExporterParameter.PAGE_BREAKS, AWExporterParameter.PAGE_BREAKS_NONE);


//ohne Angabe ist dann default - Section Page
//hiermit normal
//exporter.setParameter(AWExporterParameter.PAGE_BREAKS, AWExporterParameter.PAGE_BREAKS_NORMAL);


exporter.setParameter(AWExporterParameter.RECOGNIZE_FIELDS, true);
exporter.setParameter(AWExporterParameter.USE_EXACT_ROW_HEIGHTS, false);
exporter.setParameter(AWExporterParameter.OUTPUT_FILE_NAME, reportDatei)
exporter.setParameter(AWExporterParameter.JASPER_PRINT, jasperPrint)
exporter.exportReport()
break

I put the file in the attachment. The Aspose.Words.jasperreports-5.5.0.jar is from 22.12.2013 I think that is the actual one.

Hi there,

Thanks for sharing the detail. Please use the page break parameter as PAGE_BREAKS_SECTIONS to get the required output. This will fix the issue which you are facing. Please let us know if you have any more queries.

exporter.setParameter(AWExporterParameter.PAGE_BREAKS, AWExporterParameter.PAGE_BREAKS_SECTIONS);


With this parameter, there are undefind page breaks in the document. So we changed it to PAGE_BREAK_NONE and the page breaks work fine but the footer and the header work in the wrong way (footer only fist page, header at page 2 on every page))

Hi Procurement,

Thanks for sharing the detail. I have logged this problem in our issue tracking system as follow:

WORDSJSP-143 : AWExporterParameter.PAGE_BREAKS_NONE does not work with expression [$V{PAGE_NUMBER} > 1]

I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.