How to insert a string field with newline in the content in docx report

I use report addon to generate documents from DOCX template.
I have some fields that are “comments” including newline.
All are good in the application, textArea save newline and display newline.
But in a docx report the same field will display its content without newline…
How can I correct this ?

In Jmix
In Word

I’m looking for a global solution, I have more than 1000 fields…

I use Jmix 1.6

Hi,

Newline within simple String value is not supported yet for docx reports. We have an issue for that.

There are possible WA:

Use rich text

Use RichTextArea to input data to field and use HTML formatter for that value (Report Parameters and Field Formatters :: Jmix Documentation).
But this may not work for you if you have a lot of fields.

Use custom ContentInliner

You can try to implement you own custom ContentInliner to support newline for current values.
You will also need to register new ContentInliner - override existing bean JmixInlinersProvider (declared in ReportsConfiguration) and add custom ContentInliner:

@Primary
@Bean
public JmixInlinersProvider inlinersProvider(FileStorageContentInliner fileStorageContentInliner, CustomContentInliner customContentInliner) {
    return new JmixInlinersProvider(fileStorageContentInliner, customContentInliner);
}

And in report you will need to apply formatter related to new ContentInliner.

Regards,
Ivan

I used the ContentInliner, it’s OK…
but I had to install it for each variable in the report…
10 reports… more than 100 fields…

I will have to find a way to execute the inliner for each text variable…

Hi JMIX team,

We are facing the same problem using JMIX version 2.5.2, We are using the report addon and we are struggling to send a new line inside a string variable, is there any forecast when this issue will be solved? If not so, would you be so kind to provide a bit more details about the ContentInliner workaround, I was not able to fully understand this option with your comments.

Thanks you very much.

Luis

Hi,

In Jmix 2.5.1 the new property jmix.reports.multilineStringsProcessingEnabled was introduced. If it’s set to true - it keeps line breaks. Please try.

Regards,
Ivan

Hi Ivan,

Thank you, we tried your solution and it worked, when we insert \n in a string, a new line is created.

Best Regards

Luis