I. Overview
1. Problem description
When the FineReport cell displays the content, it cannot wrap display. If you want the cell to wrap display when displaying data on the Web, how to achieve it?
2. Solutions
FineReport provides the \n operator to wrap display the cell content.
This article will briefly explain the two ways of using \n and a string.
II. Use \n to wrap
1. Direct input data
Create a new template, enter A\nB in the cell.
\n is an escape character, which means wrap.
Save the template, click Pagination Preview, you can see that it is displayed in a new line, as shown in the following figure:
2. Create a dataset
If the data comes from a dataset and needs to wrap display, then the data in the dataset needs to store the character \n, as shown in the following figure:
III. \n display as a string
When FineReport displays the report on the Web, it will parse all the \n in the cell as wrap by default.
What if the user does not want to wrap the content of the cell, but wants to display \n as a string on the Web?
1. Direct input data
If you want to display \n as a string when entering data directly in a cell, instead of the meaning of wrap, just enter \\\\n instead of \n, as shown in the following figure:
\\\\ means two backslashes \\, which are escape characters \, and the following n is independent. This will output a string like \n instead of wrap.
2. Create a dataset
If the data comes from a dataset, you can set the Display Value of the cell in Cell Element> Advanced.
Replace \n in the dataset with \\\\n, the formula is replace($$$,"\n","\\\\n"), as shown in the figure below: