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.
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
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:
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.
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.
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:
 Delete the section.
 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.
 Edit the section's margins.
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.
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:
 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.
 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.
 Change a section's position in the document by using the Move Section Up and Move Section Down buttons.
 Reuse page settings defined in another section. Choosing another section's page settings will hide the page settings options in the current section.
 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.
That's all there is to it! DOC-NEW gives you the flexibility of creating section-based templates without ever leaving Salesforce.
Tags: Microsoft, Template Editor