# Wrap text in report module

**URL:** <https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 7, 2024, 7:43am UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322 "2024-11-07T07:43:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchen](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jchen](https://forum.inductiveautomation.com/u/jchen)\
**Post date:** [November 7, 2024, 7:43am UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322/1 "2024-11-07T07:43:48Z")

</div>

Hi there,

I have some long text like the format :  
 ![企业微信截图_17309645631433](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/425f755a683a46af158368370a29465aeed07cb7.png)

When I try to display the words use text of the report, it looks like:

 ![企业微信截图_1730964633460](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/5/15e194a20e3135174f05e0cb8e03320dbbbb5663.png)

I understand it maybe a standard style for wrap, but is it posiible to fill the first line first and then wrap?  
 ![企业微信截图_17309652823213](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/050c60229f42caccbbf2a5a5103bafe62a5f24eb.png)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [November 7, 2024, 12:23pm UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322/2 "2024-11-07T12:23:29Z")

</div>

If your text really is a long string with no whitespace in it, you may have to insert your own whitespace at a pre-defined position within that field to force it to wrap. I have seen ways to do it in Perspective with CSS, but I don't know of a way to do it in Vision/Reporting without basically inserting it manually.

---

<div class="post-metadata">

**Author:** ![jchen](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jchen](https://forum.inductiveautomation.com/u/jchen)\
**Post date:** [November 7, 2024, 2:17pm UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322/3 "2024-11-07T14:17:12Z")

</div>

Yeah, my application is to have a text area for user to input some notes, then record the text to MySQL database, finally display the notes on report.  
I found it will work well if I have some whitespace at the end of each row of text area.

 ![企业微信截图_1730989148139](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/b/1b8c0e338acc1adf26c0bd6234c89f4d8aa67033.png)  
 ![企业微信截图_17309891883144](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a9ab75d0c32e46d5e76a5e4fb15e968fa3414dd.png)

However, requiring users to pay attention to this detail during input may not be very user-friendly. If there is a way to automatically add two spaces at the end of each line, it would be great.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 7, 2024, 4:11pm UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322/4 "2024-11-07T16:11:19Z")

</div>

They're not mentioned in [our manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/reporting/report-design/data-keys/keychain-expressions#string-functions), for whatever reason, but Reportmill, the underlying Java library that powers reporting, has some built-in functions to interact with strings that might be helpful: [https://www.reportmill.com/support/keychains.pdf](https://www.reportmill.com/support/keychains.pdf)

Specifically, the `wrap` function looks like it might do what you want:

> `wrap(limit)`: Returns the base string wrapped to limit chars, separated by newlines.

Another alternative would be to use a script data source to rewrite the input from the query and do a `replace("\n", "\n ")` - replace newlines with newlines + two spaces.

---

<div class="post-metadata">

**Author:** ![jchen](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jchen](https://forum.inductiveautomation.com/u/jchen)\
**Post date:** [November 8, 2024, 6:21am UTC](https://forum.inductiveautomation.com/t/wrap-text-in-report-module/98322/5 "2024-11-08T06:21:51Z")

</div>

Thanks Paul, this is a really good suggestion.  
In my application, the input text is Chinese, and may be mixed with English and numbers, so in many cases it had unexpected results. I will even tried Python textwrap module.  
To temporarily solve this problem，in text area of vision window, I deselected the "Line Wrap" option and let user manually wrap when the number of characters reaches a certain number, this action made the result look good.  
The new question is there any idea to limit the characters of each line of text area. If more than that number it will wrap automatcly with the end of "\n".
