Create DOC-NEW Templates

Introduction

The DOC-NEW template format allows you to create .doc templates with separate sections that behave like next-page section breaks in Microsoft Word. Sections are subdivisions of a single document and can be formatted separately from one another; for example, one section can be landscape while the other is portrait. The DOC-NEW template format provides a section-based editor that makes it easy to create and edit different sections.

Access DOC-NEW

Note: DOC-NEW is available in S-Docs version 4.317 and above.

To access the DOC-NEW template format, you'll need to add it as a Template Format value on the SDoc Template object. From the setup menu, navigate to the Object Manager and find the SDoc Template object.

Next, navigate to the Fields and Relationships tab, and click on the Template Format field.

Scroll down to the Values section and click New. Type DOC-NEW into the text box, then click Save.

You've now successfully added the DOC-NEW option to the Template Format field. To create your first DOC-NEW template, simply select this option as your template format.

Convert DOC Templates to DOC-NEW

Note: The DOC-NEW conversion functions are available in S-Docs version 4.356 and above.

To quickly convert all existing DOC templates to the DOC-NEW format, you can run the following function in the Execute Anonymous window in the Developer Console:

SDOC.SDUtil.convertDOCTemplatesToDOCNEW();

Your original DOC templates will be cloned and saved as a backup.

To convert a subset of DOC templates to the DOC-NEW format, you can specify a WHERE clause as an input to the function. For example, the following function would convert all DOC templates with the string "to be converted" in their names.

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

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.

Using DOC-NEW

The DOC-NEW template editor is broken up into three elements: Page Settings, Section Content, and Conditional Logic. Let's examine each of these elements now.

Page Settings

The dedicated Page Settings tab is absent from the DOC-NEW template editor. Instead, the DOC-NEW template editor's page settings appear at the top of each section as follows:

The Page Settings element allows you to:

[1] Delete the section.
[2] Edit the section's units of measurements, page width, and page height. The page width and height can be used to change the section's orientation; for example, by default a section is set to 8.5 x 11 inches, or portrait orientation. Altering these measurements to 11 x 8.5 inches would change the section to landscape orientation.
[3] Edit the section's margins.

Note: The Unit of Measure setting applies to all measurements in the Page Settings.

Section Content

The Section Content element allows you to edit the header, body, and footer of each section. It appears as follows:

You can add content into a section's three editors just like you would in any other S-Docs template, including merge fields, related lists, and component templates. You can also edit the template source in each section's three editors.

Note: CSS applied in one editor will only apply to content in that editor. For example, if CSS is added to the footer of section 1, it will only affect content in the footer editor of section 1.

Conditional Logic

The Conditional Logic element allows you to input conditions that dictate whether or not a section is rendered in the final document. It appears as follows:

[1] Input your render conditions into this field using the same syntax as the S-Docs Conditional Logic feature, omitting the render tags. If conditions in this field evaluate to "true," the section will be included in the final document; otherwise, it will be omitted.
[2] This element also allows you to create a new section by clicking Add New Section.

Creating New Sections

When you create a new section by clicking Add New Section at the bottom of the section editor, you'll see a few more options appear for every section.

[1] Change a section's position in the document by using the Move Section Up and Move Section Down buttons.
[2] Reuse page settings defined in another section. Choosing another section's page settings will hide the page settings options in the current section.
[3] Reuse another section's header and footer. Choosing another section's header or footer will hide the header and footer editors in the current section, respectively.

Note: When using a header or footer across multiple sections, ensure the same page settings are applied to each section.

That's all there is to it! DOC-NEW gives you the flexibility of creating section-based templates without ever leaving Salesforce.

Tags: ,

Was this helpful?