I am currently encountering an issue while trying to create a PDF template using FreeMarker for NetSuite. One specific challenge I am facing is related to a column titled "Serial Number."
Within the template, the code appears as follows:
<table class="itemtable">
<#list record.item as item>
<#if item_index==0>
<thead>
<tr valign="top">
<th colspan="1">#</th>
<th colspan="4">${item.item@label}</th>
<th align="left">${item.quantity@label}</th>
<th align="left">${item.description@label}</th>
<th align="left">${item.serial_num@label}</th>
</tr>
</thead>
</#if>
<tr>
<td colspan="1">${item_index+1}</td>
<td colspan="4">${item.item}</td>
<td align="right">${item.quantity}</td>
<td align="left">${item.description}</td>
<td align="left">${item.serial_num}</td>
</tr>
</#list>
</table>
If the length of the serial number is shorter than the header's title "Serial Number," the width of the column remains unchanged.
However, if the serial number (e.g. AB-795-1245-SER-572) exceeds the length of its header, the column should extend to display the entire value in one line without any breaks.
Currently, the column width does not adjust automatically when the value surpasses the title length. I am unsure about the CSS adjustments needed for this. Can anyone provide some guidance on how to resolve this? Thank you!
Update: Description
The current issue has evolved to the following:
The third column needs to dynamically adjust based on the length of its value and maintain a fixed distance from the second column.
The second column has a set width, and the table alignment should be towards the right.
<table style="margin-top: 10px;">
<tr>
<td></td>
<td align="right">SubTotal</td>
<td align="right">${subtotal}</td>
</tr>
<tr>
<td></td>
<td align="right">Tax</td>
<td align="right">${tax}</td>
</tr>
<tr>
<td></td>
<td align="right">Total</td>
<td align="right">${total}</td>
</tr>
</table>
What would be the best approach to implement these changes? Is it advisable to utilize the "colspan" attribute?