[#11981] - Textfields do not stretch correctly in Powerpoint

Bug report
Feedback Requested
Project: Severity:
Component: Reproducibility:
Assigned to:

Textfields do not stretch correctly when exporting to Powerpoint so that the Text overflows the textfields boundaries.

This only happends when exporting to Powerpoint and seems to work correctly when exporting to PDF and Word.
Please see the attached minimal example and the generated pptx and pdf-files.

I have used JasperReports Library v6.9.0.

Best regards

Binary Data textfield_stetch_bug_example.jrxml1.19 KB
PDF icon pdf_test.pdf5.66 KB
File pptx_test.pptx10.89 KB
FabianAlbrecht's picture
Joined: Jul 12 2019 - 4:51am
Last seen: 1 year 1 month ago


  • Priority:Normal» High
  • Status:New» Feedback Requested
  • Assigned:nobody» teodord


When we talk about this level of pixel perfectness, then specifying fonts and making sure these fonts exist on the machine that views the document is a must.
In your JRXML, there is no font name in sight. So what font do you think the program is using when the report is generated?
And do you think that font used when generating the report exist on the machine where the PPTX is viewed?

The solution is to use a font that you are making available to the application that generates the report through a JasperReports font extension mechanisms.
Fonts can be embedded into PDF, to make sure they are available on the machine that displays the PDF.

Since version 6.9.0, fonts can also be embedded into DOCX and PPTX exports, for the same purpose.
Take a look at the /demo/samples/fonts sample in the project distribution package:

I hope this helps.



Just to add more info to this tracker. While indeed controlling the exact fonts that are used in the report is very important as the font metrics are the ones that determine the size of the expanding text field element and all the layout calculations that derive from that, in this particular case we are also facing an issue with line spacing.
By making sure the same font is used, we make sure the words wrap the same way and lines break in the same places in AWT/PDF compared to PPTX.
But we would still have a difference in height coming from the different line spacing used in the different document formats.

Single, double or one_and_a_half line spacing types do not have the same actual height in the different document formats and document viewers. It appears that in PPTX, the classical Single line spacing that we use as default is slightly bigger than AWT/PDF, so across many lines of text it gets exacerbated and amounts to a difference that pushes the last line of text out of the text field boundaries.

Although JasperReports allows setting an absolute line spacing specified in pixels with lineSpacing="Fixed", this is not honoured in PPTX. This is probably an oversight from when these new types of line spacings were introduced many years ago, but it might also be related to the fact that "exact" line spacing value in PPTX seems to take into consideration only integer values expressed in points (seems to round values and ignore decimals).
This means that even if Fixed/Exact line spacing would be supported in PPTX export, it would not give us the level of accuracy we need.

However, tests indicate that line spacing expressed in percentage is more accurate and its decimals are not ignored. We could consider a configuration property that could be set to alter the line spacing of PPTX exports in percentage.
For example, this would allow making the Single line spacing 5% smaller and thus match the line spacing of AWT/PDF.



Thank you for the additional information about embedding fonts.
Can you tell me, if there are any plans to fix this issue for example by adding the configuration property you suggested?