I am reaching out to request assistance with an issue related to exporting reports to Word format through Aspose in JasperServer. Our report setup requires both header and footer sections to be implemented as subreports. However, we’ve encountered difficulties getting the header and footer to map correctly to the designated header and footer sections in the exported Word document.
Issue Details:
- When exporting to Word, the main report’s header and footer content renders in the correct header/footer sections of Word if implemented directly within the main report.
- However, when we use subreports for the header and footer content (due to design requirements and reusability), the exported Word document does not place this content within the Word header and footer areas. Instead, the subreport content appears as part of the main document body.
Our Requirements:
- We need the header and footer content (currently implemented as subreports) to appear in the Word document’s header and footer sections upon export.
- Reusability is essential, as we utilize the same header and footer subreports across multiple reports.
Request for Support: Could anyone advise on any potential solutions or configurations within JasperServer or Aspose that may allow subreport content to map correctly to Word’s header and footer areas? Alternatively, if a post-processing step via Aspose.Words API is required, any guidance on how to structure this would also be helpful.
Thank you for your time and support in addressing this matter. I look forward to any recommendations anyone may have to help us meet these requirements.
@skhalid.ccm
Could you please specify the version of Aspose.Words and JasperServer you are using, as well as any specific error messages or behaviors you are encountering during the export process?
We are using Aspose.Word version 22.7 and JasperServer 8.2.0
@skhalid.ccm Please try the following:
- Take subreports that contains only header content
- Move header content from
<detail>
to <pageHeader>
- Use AWExporterParameter.PROCESS_SUBREPORT_HEADER_AS_HEADER
I placed the subreports within the header and footer bands of the main report, and inside each subreport, the content is positioned within their respective header and footer sections.
Could you clarify where to set the AWExporterParameter.PROCESS_SUBREPORT_HEADER_AS_HEADER
property? I’m not sure where exactly this parameter should be applied. Any guidance on the specific location for configuring this would be greatly appreciated!
@skhalid.ccm
In JasperReports you can use Java code:
AWDocExporter exporter = new AWDocExporter();
exporter.setParameter(AWExporterParameter.PROCESS_SUBREPORT_HEADER_AS_HEADER, true);
exporter.setParameter(AWExporterParameter.PROCESS_SUBREPORT_FOOTER_AS_FOOTER, true);
exporter.exportReport();
In JasperServer you can update applicationContext.xml:
<bean id="aw_exportParameters" class="com.aspose.words.jasperreports.AWExportParametersBean">
<property name="processSubreportHeaderAsHeader" value="true"/>
<property name="processSubreportFooterAsFooter" value="true"/>
</bean>
So it looks like this is still not functioning properly. I see the header and footer in word document, however, they are not within the header and footer section of the word document.
Hi @skhalid.ccm
I found similar problem in Issue with Aspose.Words and JasperReport Integration and export report to word and Header and footer on the loose after upgrade
If you want quick solution you can change subreports for the header and footer content:
- Take subreports that contains only header content
- Move header content from
<detail>
to <pageHeader>
- Use AWExporterParameter.PROCESS_SUBREPORT_HEADER_AS_HEADER
After that AWExporterParameter.PROCESS_SUBREPORT_HEADER_AS_HEADER recognize header in subreprot and use it.
We’re encountering issues with our report headers and footers in Aspose, even though we’re using version 23.10. From prior discussions, it seemed this issue was resolved in version 23.2, but we’re not seeing the expected results.
Current Setup:
- Main Report:
- Header Band: Contains a subreport intended for the header.
- Footer Band: Contains a subreport intended for the footer.
- Subreports:
- The header subreport has its header content within its own header band.
- Similarly, the footer subreport has its footer content within its own footer band.
Issue:
Even with this configuration, we’re facing problems where the headers and footers in these subreports aren’t rendering or functioning as expected in the main report. It seems there may be an issue with the inheritance or alignment of these bands within the main report.
Could you confirm if this should indeed work as expected in version 23.10, or if there are additional configurations we need to set up for header and footer functionality across main reports and subreports? Any guidance or workaround would be highly appreciated.
This is after I added this as well
<bean id="aw_exportParameters" class="com.aspose.words.jasperreports.AWExportParametersBean">
<property name="processSubreportHeaderAsHeader" value="true"/>
<property name="processSubreportFooterAsFooter" value="true"/>
</bean>
@skhalid.ccm Could you please attach your .jrprint
file that will allow us to reproduce the problem here for testing? We will check the issue and provide you more information.
Hello Alexey,
It actually won’t let me upload a .jrprint
file here. It is giving me the following error: “Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, zip, pdf, docx, 7z).”