HTML Splitter

Long HTML texts have been a problem with Business Central reporting for a while. HTML is designed to be used on webpages and emails and these don’t have page splits. Report documents do, however, therefore we need to break the HTML off in a logical place, so we can continue the text on the next page.

With ForNAV, we have found a solution that will break the HTML text on <br> tags. These are the natural places where HTML text should be broken. ForNAV will continue all the formatting of your text. Tables in your HTML text will never be broken off; breaking off tables can cause the size of table rows to be mismatched.

ForNAV places each HTML section in a separate temporary record. Because the HTML is placed in separate records, ForNAV displays the next record on the next page, when there is no space on the current page.

Splitting HTML works for the following use cases:

  • Text from the ForNAV Text Storage table
  • Entity text
  • Text from a third-party extension

The following sections describe how to set up each of these cases.

The ForNAV Text Storage table

The ForNAV Text Storage table is a table that was specially designed to hold any text you want to place on your reports. Text in this table is formatted as HTML and therefore can be split.

Normally, you would add this table like any other table relation in the ForNAV Designer. To automatically split the HTML text, simply add the table as usual but set the Temporary and Auto Populate properties to True. Also, add the Text field to the Calculated Fields property.

Create a new body section and set the Can Grow property on the new body section to True. Add a new text box in the section and set the Text field from the ForNAV Text table as the source expression and set the Can Grow property to True.

Entity text

Some tables have the new entity text with the rich text editor enabled. One of these is the Item table, which has the Marketing Text field. ForNAV will automatically recognize the entity text when you connect the HTML table to a table that has an item connected, like the sales line.

To add this marketing text on a report, open the report in the ForNAV Designer and add the ForNAV HTML table as a new data item under the data item that contains the Item reference. Set the Temporary and Auto Populate properties to True and add the HTML field to the Calculated Fields property.

Create a new body section and set the Can Grow property on the new body section to Yes. Add a new text box on the section and set the HTML field from the ForNAV HTML table as the source expression and set the Can Grow property to True.

 

Third-party extension

Finally, you might want to split HTML text from a third-party extension. In this case, you need to use the ForNAV HTML table linked to your extension table data item and specify the blob field. For example, to split the text from the ForNAV Text Storage table, the Text field that stores the HTML is field 6 in this table. Everything else works exactly as described for the Entity text use case.

Alternatively, you can use codeunit 6188554, ForNAV HTML Splitter, to split the HTML directly in your extension.