Adding Page Breaks to Tables
If you have text overlapping a footer or missing from a printout, ensure that any long content is enclosed in an element that will split across pages.
The Report Generator has specific rules for where page breaks can occur. A <table>
tag nested inside a <td>
tag is cut off at the bottom if it spreads across multiple pages. Only the following tags split correctly if they are spread across multiple pages:
<table>
<ul>
<p>
<pre>
<ol>
<h1>
<h2>
<h3>
<h4>
<blockquote>
For more information about the tags that support table pagination, see Page 17 of the BFO (Big Faceless Organization) Guide.
The following example shows a typical table layout.
<!-- start of item table in transaction -->
<#list record.item as item>
<#if item_index==0> <!-- Header Definition -->
<tr>
<th>${item.field1@label}</th>
<th>${item.long_text_field@label}</th>
<th>${item.field2@label}</th>
<!-- ... -->
</tr>
</#if>
<tr>
<td>${item.field1}</td>
<td>${item.long_text_field}</td>
<td>${item.field2}</td>
<!-- ... -->
</tr>
</#list>
<!-- end of item table in transaction -->
If item.long_text_field
contains more than 2000 text characters, one table line can span the whole page and overflow, and the data can be truncated. If it is necessary to print a long table over more than one page, use code similar to the following.
<!-- start of item table in transaction -->
<#list record.item as item>
<#if item_index==0> <!-- Header Definition -->
<tr>
<th>${item.field1@label}</th>
<th>${item.long_text_field@label}</th>
<th>${item.field2@label}</th>
<!-- ... -->
</tr>
</#if>
<#list item.long_text_field?split("<br />") as paragraph>
<#if paragraph_index==0>
<tr>
<td>${item.field1}</td>
<td>${paragraph}</td>
<td>${item.field2}</td>
<!-- ... -->
</tr>
<#else>
<tr>
<td></td>
<td>${paragraph}</td>
<td></td>
<!-- ... -->
</tr>
</#if>
</#list>
</#list>
<!-- end of item table in transaction -->
You can enter any delimiter that you want. The previous example uses a delimiter of "<br />"
.
With the #list
statement shown in the example, instead of printing out one table row containing all of the paragraphs, more rows are printed. A split function is applied on long_text_field
, so "paragraph1<br />paragraph2<br />paragraph3"
becomes a list of values "paragraph1","paragraph2","paragraph3"
. To print the list of paragraphs, in the first row, all of the fields and the first paragraph of long_text_field
are printed. In each subsequent row, one paragraph of long_text_field
is printed and all other cells are left blank.
A table that looked like this before:
Field 1 |
Long Text Field |
Field 2 |
---|---|---|
Value 1 |
Paragraph 1 Paragraph 2 Paragraph 3 |
Value 4 |
— |
Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 |
Value 5 |
Value 3 |
Paragraph 1 |
Value 6 |
Now looks like this:
Field 1 |
Long Text Field |
Field 2 |
---|---|---|
Value 1 |
Paragraph 1 |
Value 4 |
— |
Paragraph 2 |
— |
— |
Paragraph 3 |
— |
Value 2 |
Paragraph 1 |
Value 5 |
— |
Paragraph 2 |
— |
— |
Paragraph 3 |
— |
— |
Paragraph 4 |
— |
Value 3 |
Paragraph 1 |
Value 6 |
With each paragraph in a separate row, as many rows as possible are fit onto the page, and any rows that do not fit are moved to the next page.
Related Topics
- Source Code Editing in the Template Editor
- Source Code Editing to Customize Advanced Templates
- Syntax for Advanced Template Fields
- Setting a Template to Use a Font Unavailable in NetSuite
- Languages for Printed Forms that Use Advanced Templates
- Adding Translated Content in Advanced Printouts
- Adding Striping to Line Items in Advanced Templates
- Printing Subsidiary Logo on Advanced Templates
- Adding Apply Sublist to Check Templates
- Using FreeMarker to Work with Hidden Fields Used in Advanced Templates
- Adding Bar Codes in Advanced Templates