Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Home/ Advanced PDF Templates in NetSuite/Tables & Line Item Formatting in Advanced PDF

Tables & Line Item Formatting in Advanced PDF

One of the most powerful features of Advanced PDF templates is customizing how line items (products, services, expenses) appear on your transaction forms. Using FreeMarker loops, you can format tables, add subtotals, and apply styles to improve readability.

This page covers building item tables, styling rows, and formatting amounts.


🔹 Basic Line Item Table

<table border="1" width="100%" style="border-collapse: collapse;">
   <tr style="background:#f2f2f2; font-weight:bold;">
      <th>Item</th>
      <th>Description</th>
      <th>Quantity</th>
      <th>Rate</th>
      <th>Amount</th>
   </tr>
   <#list record.item as i>
      <tr>
         <td>${i.item}</td>
         <td>${i.description}</td>
         <td style="text-align:center;">${i.quantity}</td>
         <td style="text-align:right;">${i.rate?string["#,##0.00"]}</td>
         <td style="text-align:right;">${i.amount?string["#,##0.00"]}</td>
      </tr>
   </#list>
</table>

✔️ Creates a clean, printable line item table.
✔️ Aligns numbers to the right for better readability.


🔹 Alternating Row Colors (Zebra Striping)

<#list record.item as i>
   <tr <#if i_index % 2 == 0>style="background:#f9f9f9;"</#if>>
      <td>${i.item}</td>
      <td>${i.description}</td>
      <td>${i.quantity}</td>
      <td style="text-align:right;">${i.rate?string["#,##0.00"]}</td>
      <td style="text-align:right;">${i.amount?string["#,##0.00"]}</td>
   </tr>
</#list>

✔️ ${i_index % 2} checks if the row is even/odd.
✔️ Makes long invoices easier to read.


🔹 Adding Subtotals

<#assign subtotal = 0>
<#list record.item as i>
   <tr>
      <td>${i.item}</td>
      <td>${i.description}</td>
      <td>${i.quantity}</td>
      <td style="text-align:right;">${i.rate?string["#,##0.00"]}</td>
      <td style="text-align:right;">
         ${i.amount?string["#,##0.00"]}
         <#assign subtotal += i.amount?number>
      </td>
   </tr>
</#list>

<tr style="font-weight:bold; background:#f2f2f2;">
   <td colspan="4" style="text-align:right;">Subtotal</td>
   <td style="text-align:right;">${subtotal?string["#,##0.00"]}</td>
</tr>

✔️ Demonstrates how to calculate totals using assign.


🔹 Grouping Items by Type

Example: Group by Item Type (Inventory vs. Service).

<h3>Inventory Items</h3>
<table border="1" width="100%">
<#list record.item?filter(i -> i.itemtype == "InvtPart") as inv>
   <tr>
      <td>${inv.item}</td>
      <td>${inv.quantity}</td>
      <td>${inv.amount?string["#,##0.00"]}</td>
   </tr>
</#list>
</table>

<h3>Service Items</h3>
<table border="1" width="100%">
<#list record.item?filter(i -> i.itemtype == "Service") as svc>
   <tr>
      <td>${svc.item}</td>
      <td>${svc.quantity}</td>
      <td>${svc.amount?string["#,##0.00"]}</td>
   </tr>
</#list>
</table>

✔️ Splits items into categories for clearer reporting.


🔹 Highlighting Special Items

<#list record.item as i>
   <tr <#if i.amount?number > 1000>style="background:#ffe6e6;"</#if>>
      <td>${i.item}</td>
      <td>${i.description}</td>
      <td>${i.quantity}</td>
      <td>${i.rate?string["#,##0.00"]}</td>
      <td>${i.amount?string["#,##0.00"]}</td>
   </tr>
</#list>

✔️ Highlights rows where the line amount is greater than 1000.


✅ Best Practices

  • Keep tables lightweight for fast PDF rendering.
  • Use CSS inline styles instead of external CSS for reliability.
  • Always align numbers to the right.
  • Use conditional formatting to highlight important items.

✅ Summary — What You Learned

You now know how to:

  • ✅ Build a basic item table with FreeMarker.
  • ✅ Apply zebra striping for readability.
  • ✅ Calculate subtotals using <#assign>.
  • ✅ Group line items by type or condition.
  • ✅ Highlight special rows using conditional formatting.

This sets you up for the next topic: Adding Custom Fields, where you’ll learn to insert custom body and column fields into your Advanced PDF tables.

Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuite’s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 21 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

© 2025 The NetSuite Pro. All Rights Reserved