ANS-0819 · PRINTING, PDF & EMAIL TEMPLATES

How to Left-Justify Multi-Line Text in NetSuite Advanced PDF Templates

Properly align multi-line text within Advanced PDF/HTML template cells by applying text alignment directly to the content's paragraph element.

Short answer

To left-justify multi-line text in a NetSuite Advanced PDF cell, embed the field value within a <p> tag and apply text-align: left; style to that paragraph. This ensures proper formatting even when lines exceed cell width, preventing misalignment issues often seen when applying alignment directly to the <td> element.

Scenario

Users often encounter challenges when attempting to left-justify multi-line text within cells of NetSuite Advanced PDF/HTML templates. When some lines of text exceed the cell's defined width, applying alignment styles directly to the table cell () may not produce the desired left-justified output, leading to inconsistent formatting.

Solution

To correctly left-justify multi-line text within a NetSuite Advanced PDF/HTML template cell, the alignment style should be applied to a paragraph element (

) that encloses the field value, rather than directly to the table cell (). This method ensures that the text wraps and aligns properly, even when individual lines are longer than the cell's width. Consider the following original code snippet where record.billaddress and record.shipaddress are placed directly within elements:

<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
    <table align="left" style="margin-top:10px;width:100%;"><tr>
<td colspan="3" style="font-size: 8pt; padding: 6px 0 2px; font-weight: bold; color: #333333">${record.billaddress@label}</td>
<td colspan="3" style="font-size: 8pt; padding: 6px 0 2px; font-weight: bold; color: #333333">${record.shipaddress@label}</td>
<td colspan="5" style="font-size: 12pt; background-color: #e3e3e3; font-weight: bold;">${record.total@label?upper_case}</td>
</tr>
<tr>
<td colspan="3" style="padding: 0">${record.billaddress}</td>
<td colspan="3" style="padding: 0">${record.shipaddress}</td>
<td align="right" colspan="5" style="font-size: 28pt; padding-top: 20px; background-color: #e3e3e3;">${record.total}</td>
</tr></table>

To achieve proper left justification for the multi-line addresses, modify the code by wrapping the record.billaddress and record.shipaddress fields within

tags, as shown in the updated code below:

<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
    <table align="left" style="margin-top:10px;width:100%;"><tr>
<td colspan="3" style="font-size: 8pt; padding: 6px 0 2px; font-weight: bold; color: #333333">${record.billaddress@label}</td>
<td colspan="3" style="font-size: 8pt; padding: 6px 0 2px; font-weight: bold; color: #333333">${record.shipaddress@label}</td>
<td colspan="5" style="font-size: 12pt; background-color: #e3e3e3; font-weight: bold;">${record.total@label?upper_case}</td>
</tr>
<tr>
<td colspan="3" style="padding: 0">*<p style="text-align: left;">*${record.billaddress}*</p>*</td>
<td colspan="3" style="padding: 0">*<p style="text-align: left;">*${record.shipaddress}*</p>*</td>
<td align="right" colspan="5" style="font-size: 28pt; padding-top: 20px; background-color: #e3e3e3;">${record.total}</td>
</tr></table>

Expert NetSuite Support

Need help with this NetSuite issue?

Printing, PDF & Email Templates consulting and configuration support

Talk to a consultant