ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Formatting a table for Print Format

customization
child_table
print_format

#1

I want to show a table with the elements of a Child table for the Print Format of a custom Doctype.

I want a fixed table with 8 rows and 9 columns, so that only the cells containing data are filled in, leaving the cells without data blank.

I’ve been testing, but I can not give the table the format I want.


#2

Hi @vazdan,

have you tried an HTML/Jinja insert like this

<table>
  <tr>
	<td>{{ doc.items[0].item_code or "" }}</td>
	<td>{{ doc.items[0].item_name or "" }}</td>
	<!-- ... -->
  </tr>
  <tr>
            {% if doc.items[1] %}
	<td>{{ doc.items[1].item_code or "" }}</td>
	<td>{{ doc.items[1].item_name or "" }}</td>
	<!-- ... -->
            {% else %}
            <!-- define empty row -->
            {% endif %}
  </tr> 
  <!-- ... -->
</table>

Define your hard-coded table design, fill the content where available.

Hope this helps.


#3

I tried similar things, but none like this. Thank you @lasalesi


#4