How to change Word Template in Jasper Library?

Hi all,

as the default font for a Jasperserver exported Aspose Word document does not fit my needs (the default Word Template has Times New Roman, I need Arial), I tried to change the template in the Aspose Library “Blank.doc” But after repackaging the jar I get the following error:

SHA-256 digest error for com/aspose/words/jasperreports/resources/Blank.doc

Is there a way to change the Word template?

(In detail, I export a TOC which has to be updated after exporting and opening the Word. But there Times New Roman is used instead of Arial which ist the preformatting of my toc…)

Thanks in advance,
Thomas Zimmer
https://jasper-schulungen.de/

@ThoZi

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your .jrprint file.
  • Please attach the repackaged Jar file.
  • Please share the complete steps that you are using to export the document.
  • You can use your desired font in your jasper report (.jrxml file). Could you please share why you want to update blank.doc file?

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

thanks for your quick response. Do you think it makes sense to attach all these files?

What I can see is, that the jar “aspose.words.jasperreports-20.4-7.1.0-7.5.0.jar” obvisually contains a hashcode for each file in it (for example in the MANIFEST file). Therefore it seems not to work anymore, if I change the Word-Template in the jar and repackage it (according to the error message i posted previously). I tried to regenerate the hashcode, but on the one hand I was not able to generate a similar one compared to the existing ones, on the other hand that seems to make the whole package invalid…

The resulting Problem is simple: My Jasper output contains a toc like { TOC \h \z \t “WHeading1;1;WHeading2;2” }. When updating this in the resulting Word-Doc, the toc has “Times New Roman” as font (according to the formatting for tocs of the Word-Template respectively default font of Blank.doc). I need to change that to Arial. It seems not possible to overwrite the Word-formatting for tocs with a Jasperreports-Style (which is called “Verzeichnis1”, “Verzeichnis2” aso. in German).

Does this clarify/help? Otherwise I will upload any helpful files if needed.

Thanks in advance,
Thomas Zimmer
https://jasper-schulungen.de/

@ThoZi

Yes, you can use JasperReports styles or set font of { TOC } to achieve your requirement. You do not need to modify the blank.doc file.

That does not work. I attach the word-doc how it comes out from Jasperserver: Reporting_FM_Standard (2).zip (45.4 KB)
As you can see, there is a toc with the correct formatting “Arial”, but when I update the toc the font changes to “Times New Roman”.

BTW, interestingly, on my local test system the toc is updated automatically when opening the document, but that doesn´t change anything regarding the wrong font (how can the behaviour for uptating the toc automatically be changed??)

If I create a style named “Verzeichnis1” It is automatically renamed to “Verzeichnis1 1” in the Word-Doc.

Thanks in advance

@ThoZi

You are facing this issue because TOC1 style has font name ‘Times New Roman’. Please ZIP and attach your .jrprint file here for testing. We will investigate the issue and provide you more information on it.

I attach all files and sources. zip contains:

TestReport.jrprint
TestReport-Sources.zip → jrxml files
TestReport-JRS-Export.zip → Jasperserver ReportUnit-Export

TestReport.zip (11.2 KB)

Thanks in advance,
Thomas
https://jasper-schulungen.de/

@ThoZi

Thanks for sharing the detail. Unfortunately, we are unable to export the .jrprint and .jrxml files. Could you please share the JasperReport and Java version that you are using along with Java code example to export the .jrxml to Word document? We will investigate the issue and provide you more information on it.

As I said, I am using Jasperreports Server 7.5.1 for executing and exporting that report.

Jasperserver runs under:
java version “1.8.0_201”
Java™ SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot™ 64-Bit Server VM (build 25.201-b09, mixed mode)

Would it be helpful for you if I wrote a short java prog to run the report?
Can I do that? I have only the license for Aspose.Words for Jasperreports…

Thanks in advance,
Thomas
https://jasper-schulungen.de/

@ThoZi

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJR-301. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks.

Could you tell what exactly the target is? Should it be possible to overwrite the Word-Formatting with Jasperreports Styles?
Or are you going to make it possible to change the Core-Word-Template placed in the jar-package?

Last would be the most flexible way for developers…

Thomas
https://thomaszimmer.net/

@ThoZi

You are facing this issue because TOC styles are based on Normal style and its default font name is ‘Times New Roman’ in our templates. Currently, this issue is pending for analysis. We will investigate the issue and provide you solution or fix of this issue. Thanks for your patience and understanding.