News & Resources — News Announcements

How to Create Amazing CPQ Template Content Using HTML and Tables

Posted by Greg Coolidge, Senior Consultant

You have just put together a large quote for a very important client.  The only thing left to do is generate the output document and send it to the customer for their signature.  Here are a few tips and tricks to help you create professional templates using tables in your template content.

When it comes to content, HTML is your friend

When creating new HTML content, consider creating it directly in HTML.  This is especially true when using tables and adding text or background colors.  If you create your content using the content editor, click the Source button to view the HTML.  This is a great way to ensure that the font, size, color or additional lines have been set and will render correctly on your template.

Tables, Tables, Tables…

When creating template content tables can serve a variety of purposes.   In addition to easily keeping fields aligned, by placing text or fields in different table cells, you can set them with different fonts, colors and sizes.

While tables can be created using the table wizard on the content toolbar, they can also be created or modified directly in HTML.  When creating a table, first set width of your table using the tag <table style=”width:100%;”>.  The width can be set in pixels or as a percent.

Within the table, column widths should also be set.  The total of widths of the columns should equal the width of the table.  This is done on each row.  For example:

<tr>

<td style=”width:20%;font-size: medium;”>{!companyLogo}</td>

<td style=”width:80%;font-size: medium;”>Quote</td>

</tr>

Tables are also an easy way to inset images and include text around the image.  Store the image in a Documents folder in your instance of Salesforce.com then reference the URL using Image button on the content toolbar.  Placing the image in a middle row allows text to be placed in cells above, to the side, and below the image.

If you need to force part of your content to be aligned on the left or right side of the page, create a table with a width of 100%.  Include a blank column to the right or left of your text to force it to the correct side of the page.  Adjust the column widths to get the text to align where you would like it.  Placing blank columns on the left and right of the column containing text can be used to center the text on the page.

Setting Borders

Creating borders around your table or specific cells can be done in the source HTML.  Border lines can be set to be thick lines, thin lines or dotted lines.  The color of the lines can also be controlled using HEX or RGB codes.

Borders are set within the <td> tag.

<td style=”border-left:thick solid black;”> would place a thick, black solid line on the left side of the cell.

<td style=”border-right:thin solid #CA2015;”> would place a thin, red solid line on the right side of the cell.

<td style=”border-top: dotted black; border-bottom:dotted black;”> would place dotted black lines on the top and bottom of the cell.

On the content toolbar there is an option to insert a solid line in your content.  Using this tool places a line that is visible on the content page.  However, it does not render on the previewed or printed document.  To insert a line, create a table with a width of 100% and a single row and column.  Use the <td style=”width:100%;border-bottom:thin solid black;”> tag to insert a solid line across the document and have it render on the previewed and printed document.

Aligning Text

To align the text within a cell, add “align:right;” or “align:left;” to the cell style; for example:

<td style=”border-left:thick solid black; align:right;”>.

Padding Cells

The padding attribute can be used to add some space before, after, above or below the text in the cell.

<td style=”padding-left:5px; padding-right:5px; padding-top:2px;padding-bottom:2px;”> will pad the cell by five pixels on the left and right sides of the cell and by two pixels on the top and bottom of the cell.

Testing & Troubleshooting Content

You have created your template and added your content.  However, when you go to preview your output, you get an error indicating the document failed to render.  To troubleshoot the error, clone your template with all of the content and quote lines.  On your cloned copy, begin removing content sections one at a time, previewing the template as you go.  Once you have determined which content is causing the error, review your HTML.  The majority of the time the error is caused by an issue with the HTML.

Always make a copy of your content before making changes.  You never know when you might have to revert back to your original code.

Time to Create a Template

If you are new to CPQ Template Content, it can take some time to create your content.  With a little practice and some basic HTML you can create some amazing quote templates.

 


Posted in News Announcements, Tips & Tricks, What We’re Reading