Convert Between Different Template Formats

Introduction

S-Docs templates are limited to one template format (file output type) each. If you want to convert a template to a new file type, you need to take different considerations into account depending on your template's current file type and the desired file type.

Automatic Conversions

The following template format conversions can be accomplished by changing the Template Format field to your desired file type (no need to create a new template).

Convert PDF Templates to DOC Templates

PDF templates generally convert cleanly to DOC templates. However, consider the following:

If your PDF template utilizes the page count or page number special merge fields, these will not function in your DOC template.

Remove any page count/number special merge fields and use the mso-field-code method of displaying page count/number by placing the following into your template header or footer's source:

Page Number: <span style="mso-field-code: PAGE "></span>
Total Pages: <span style="mso-field-code: NUMPAGES "></span>
Note: This code is not functional in the template body and must be used in either the Header or Footer tabs.

Convert DOC Templates to PDF Templates

When converting a DOC template to a PDF template, consider the following:

  • Fonts not supported by the PDF template format will convert to Times New Roman 12pt. Find a list of fonts supported by the PDF template format here.
  • If your DOC template utilizes the mso-field-code method of displaying page count/number, this will not function in your PDF template. Remove any mso-field-code and replace with PDF page count/number special merge fields.

Convert PDF/DOC Templates to HTML Templates

When converting a PDF or DOC template to an HTML template, consider the following:

  • Content in the template Header/Footer tabs will be ignored
  • Data from the Page Settings tab (orientation & margins) will be ignored
  • Page count/numbers will be ignored, no matter which method is used

Convert HTML Templates to PDF/DOC Templates

HTML templates generally convert cleanly to PDF/DOC templates. However, consider the following:

  • If your template was originally created as an HTML template (it wasn't converted to HTML from a different format), the converted PDF/DOC template will have default Page Settings and empty Header/Footer tabs
  • If your template was originally a PDF/DOC that was converted to HTML and back to PDF/DOC, content from the original Page Settings & Header/Footer tabs will be restored

Convert PDF/DOC Templates to Component Templates

When converting a PDF or DOC template to a component template, consider the following:

  • Content in the template Header/Footer tabs will be ignored
  • Data from the Page Settings tab (orientation & margins) will be ignored
  • Page count/numbers will be ignored, no matter which method is used
Warning
This conversion is not recommended. Whenever possible, create component templates using the Component template format.

Manual Conversions

The following template format conversions must be accomplished by creating a new template with the desired Template Format, and copy-pasting content from the original template.

Convert DOC-NEW Templates to PDF/DOC Templates

When converting a DOC-NEW template to a PDF or DOC template, we recommend opening the template Source of your DOC-NEW template, copying your content, and pasting it into the template Source of your PDF or DOC template.

You should also consider the following:

  • You cannot convert DOC-NEW templates that have both landscape and portrait sections, since PDF/DOC templates only support one page orientation
  • You cannot convert DOC-NEW templates that have sections with different Page Settings, since PDF/DOC templates only support one set of Page Settings
  • If your DOC-NEW template contains a table of contents, it will not function in your PDF/DOC template
Note: Follow a similar process when converting PDF templates to the DOC-NEW template format. Copy the PDF template Source into the DOC-NEW template Source. Consider whether you want different portions of your PDF template to have different orientations/other page settings, and create different sections in your DOC-NEW template as needed.

Convert DOC Templates to DOC-NEW Templates

If you are using S-Docs 4.356+, you can run the following functions in the Execute Anonymous window in the Developer Console:

Convert ALL DOC templates to DOC-NEW templates:

SDOC.SDUtil.convertDOCTemplatesToDOCNEW();

Convert a SUBSET of DOC templates to DOC-NEW templates:

SDOC.SDUtil.convertDOCTemplatesToDOCNEW('Name LIKE \'%to be converted%\'');

When using this method of conversion, consider the following:

  • Your DOC templates will be cloned and saved as a backup
  • Header, Footer, and Body content from your DOC template will be placed in the Header, Footer, and Body sections of Section 1 in your DOC-NEW template.
Note: If you are using S-Docs 4.355 or below, the functions above will not work. You must create a new DOC-NEW template and copy the DOC template Source into the DOC-NEW template Source. Consider whether you want different portions of your DOC template to have different orientations/other page settings, and create different sections in your DOC-NEW template as needed.

Convert Between Microsoft File Types

When converting from DOC, PPT, or XLS to DOCX, PPTX, or XLSX, consider the following

  • You must add square brackets around all merge fields, related lists, queries, and render (conditional logic) statements. Refer to the following examples.
MERGE FIELDS:
{{!Opportunity.Name}} 

becomes

[{{!Opportunity.Name}}]

RELATED LISTS:
<!–{{! <Lineitems>
<listname>opportunitylineitems</listname>
<column>PriceBookEntry.product2.Name</column>
<column>PriceBookEntry.product2.Description</column>
<column>UnitPrice</column>
<column>Quantity</column>
<column>TotalPrice</column>
</lineitems> }}–>

becomes

[{{!<lineitems>
<tableformat>]

//Your Table Here

[</tableformat>
<listname>opportunitylineitems</listname>
<column>PriceBookEntry.product2.Name</column>
<column>PriceBookEntry.product2.Description</column>
<column>UnitPrice</column>
<column>Quantity</column>
<column>TotalPrice</column>
</lineitems>}}]

NAMED QUERIES
<!--{{!<LineItemsSOQL>
...
</LineItemsSOQL>}}-->
{{!myQuery1.fieldname}}

becomes

[{{!<LineItemsSOQL>
...
</LineItemsSOQL>}}]
[{{!myQuery1.fieldname}}]

RENDER STATEMENTS
<!--RENDER={{!Contact.Phone}}=="123-456-7890"-->
{{!Contact.Name}} can be reached at {{!Contact.Phone}}. This is never true.
<!--ENDRENDER-->

becomes

[<!--RENDER={{!Contact.Phone}}=="123-456-7890"-->]
[{{!Contact.Name}}] can be reached at [{{!Contact.Phone}}]. This is never true.
[<!--ENDRENDER-->]

Note that you must manually build the header, even, and odd rows for your related list table, and wrap the related list code around it as shown in the following image.

Warning
This conversion is not recommended. Whenever possible, build Microsoft-X templates from new in Microsoft Word, PowerPoint, or Excel.

PDF-Upload Templates

PDF-Upload templates cannot be converted to different template formats at this time, and vice versa.

Tags: , , , ,

Was this helpful?