How to Create Templates

Skip to main content
You are here:
< Back

Easy template editor

The core of Doc Converter Pro is the powerful template system. Here you can edit the built-in templates, duplicate templates, and create your own templates. To enter this section, just click on the radial button next to the Templates list on the main screen. Remember to first select the template you want to edit/duplicate/delete by selecting a template from the drop-down list.

tipTip: Remember, you can edit or duplicate and modify the templates that come with Doc Converter Pro.

In the Easy Editor tab, all you need to do is click on options on the left and select the options you need on the right side.

You can also preview how your template will work. At the top, you have the Template Preview tab (3rd tab). There, you can select a file to convert and preview its HTML code and see how it looks in the browser. You can go back to Easy Editor, make some changes, and go back to Template Preview, click the Preview file button again to see how Doc Converter Pro will convert your document.

 

Template Overview

Converting format (1): Doc Converter Pro can save files in different formats. The main conversion format is XHTML 1.0, HTML5, HTML4, HTML FIXED (fixed layout – HTML looks exactly like in your Word document), but Doc Converter Pro can save files as  PDF, DOCX/DOC, ODT, RFT, text files (TXT),  MARKDOWN, or save document pages as graphic image files (jpg, png, webp, gif, bmp, wmf). When saving to images, you can also create either a single or separate HTML file for each page saved as an image. The ‘Create an index HTML file for converted output file’ option is useful when you convert many files, and you want to have a list with <a> links referencing all converted files. Doc Converter Pro will create an index.html file in the same folder as your source documents are located. Later, you can upload all converted HTML files to a website and use those index file links on a web page.

What conversion engine should I use? (2) Always try our built-in Doc Converter first.

Output file naming (3): One of the cool features of Doc Converter Pro is the ability to automatically rename output files to make them web-friendly. By default, Doc Converter Pro will save documents with web-friendly file names. You can turn it off by unticking the ‘File name web-friendly format’ checkbox.

By default, all spaces will be changed to the dash character ‘-‘ (Space replacement), but you can specify your replacement character. All special characters (not URL-friendly) will be deleted from the file name. Doc Converter Pro will try to convert language-specific characters to their equivalent in the ASCII character set (eg, äöü.doc will be saved to an aou.html file).

You can also control the case of output file names. Doc Converter Pro can save file names without changing them or can save them to lowercase or uppercase letters.

The ‘Create new output file each time you convert’ option is useful if you want to create a new file each time you convert the same document. It can be useful if you want to compare differences in files to see how different templates create different output content. If you tick this, then if the converted file name already exists in the folder, Doc Converter Pro will not overwrite it. For example, if your Word file is called aboutus.doc, and aboutus.html exists in the same folder, then Doc Converter Pro will rename the new converted file to aboutus_1.html. Turning this option off will overwrite the existing HTML file, so be careful.

By default, Doc Converter Pro will save files with a .html extension, but if you want to, you can set your extension.

HTML input file options (4): Backup HTML files before cleaning if input and output file names are the same’ – Ticking this will make Doc Converter Pro create a backup of any HTML file before it cleans it if input and output file names are the same. It will prevent overwriting input HTML files.

Process HTML input file by conversion engine’ – If you tick this option, your HTML will be processed by either our Internal Converter or MS Word (depending on the option you tick above). This means you can use all the customisation options in the templates.  If you do not tick this option, then options like Image Output Folder, CSS, Image & Metadata options will not work. The reason you would untick this option would be if you find the Internal Converter or MS Word conversion process is affecting your HTML in a bad way. If you untick this option, then we will only run find and replace/delete commands on your files, so it’s a safer option if you find you have problems with code being changed.

Template notes (5): Here, you can write your reminder notes about the template you’re creating.

HTML Options

Options for all engines

Correct HTML structure before converting – With this option ticked, Doc Converter Pro will fix problems with code structure before converting with the template. Please use this option only if you know that the input HTML may have a structure problem; otherwise, do not tick this option.

Body content only – Useful for importing into a CMS. If you tick this option, Doc Converter Pro will remove the head section of the HTML and just leave the body tag content. This is useful if you want to paste HTML into a content management system (CMS) or a template.

Clean HTML Conversion – This will remove all the formatting, e.g. styles, font size, font type, etc. This is a good option if you want clean HTML or you intend to use your own CSS styles. Note it will not remove bold and italic formatting.

Convert bold and italic tags to strong and em – With this option ticked, Doc Converter Pro will convert <b> tags to <strong> and <i> to <em>. Strong and em are the new standard for bold and italic.

Delete empty HTML paragraphs (lines) – If you tick this option, Doc Converter Pro will remove any paragraphs <p…z>….</p> containing any white space chars (spaces, tabs, new lines etc) or &nbsp; or &#xa0;  entities.

Delete empty new lines from output – Doc Converter Pro will delete empty new lines (more than one new line in a row) found in the HTML or TXT files. Gives cleaner HTML output.

Ignore case – If you tick this option, Doc Converter Pro will ignore the case when looking for code. For example, if the ignore case is turned OFF, if you ask Doc Converter Pro to find the code <p class=”HEADING_1″>, it would only find <p class=”HEADING_1″>, not <p class=”heading_1″>. Note how in the second example, HEADING_1 is in lowercase.  Turning the ignore case on means that Doc Converter Pro will ignore that case of the code, and in our example, it would find <p class=”HEADING_1″> and the lowercase <p class=”heading_1″>

Compress or indent HTML – Compress (minify) HTML output (smaller but less readable HTML) or indent it (prettify, a bigger HTML output, but it’s easier to read HTML in the source editor). By default, Doc Converter Pro does not compress or indent HTML output.

Doc Converter Pro engine options

Convert web addresses and emails to links – Ticking this option will convert any web or email addresses to clickable hyperlinks. This option only works with the Doc Converter conversion engine. Please note that using this feature may cause longer conversion times.

Preserve table layout when saving as plain text – Ticking this option helps to preserve the table layout when saving to text format. e.g., data in columns will stay on the same row.

Convert field codes to plain text – Converts any document field codes into static text; otherwise, INPUT HTML elements.

Convert drop-down fields to text – when enabled, it exports drop-down form fields as normal text; otherwise exports drop-down form fields as a SELECT element in HTML.

Remove document comments – when enabled, all document comments will be removed from the output HTML.

Save text boxes with text as HTML – Doc Converter Pro will convert text boxes with text content as HTML. Please note that any border of the text box will be removed, but it can be added back via a custom CSS style rule in the template if needed. When turned off, text boxes will be saved as image files. Please note that it’s an experimental feature of Doc Converter Pro, and it may not produce good results for advanced text boxes.

Relative font size – Font sizes will be output in relative (em) units when saving to HTML. In many existing documents (HTML, EPUB), font sizes are specified in relative units. This allows applications to adjust text size when viewing/processing documents. When this option is enabled, document elements other than text will still have absolute sizes. Also, some text-related attributes might be expressed absolutely. In particular, line spacing specified with the “exactly” rule might produce unwanted results when scaling text.

Show page numbers in table of contents – When this option is on, Doc Converter Pro will show page numbers in table of contents links (TOC). By default, this option is turned off.

Show tracking changes – When this option is on, Doc Converter Pro will show any document tracking changes in the converted HTML.

Headers and footers – Control how the document header and footer are converted. You can set ‘None’, and headers and footers will not be exported. ‘Per section’ – primary headers and footers are exported at the beginning and the end of each section. ‘First and last’ – the primary header of the first section is exported at the beginning of the document, and the primary footer is at the end.

HTML list mode – Specifies how list labels are exported to HTML:

  • Auto – Outputs list labels in auto mode. Uses HTML native elements when possible.
  • HTML tags – Outputs all list labels as HTML native elements.
  • As text – Outputs all list labels as inline text.

Math equations mode – Specifies how math equations will be exported to HTML: as images, MathML, or text.

MS Word Engine Options

Clean MS Word HTML – With this option enabled, Doc Converter Pro will remove any unneeded Word-specific HTML code from your existing MS Word HTML file. You don’t have to use this option for the Doc Converter engine, or if you convert files in doc/docx/rtf/odt format.
 

Pdf Options

Selecting the PDF output option shows this PDF Options tab, where you can specify additional PDF input and output conversion options. Doc Converter Pro 4 has changed its PDF conversion engine to a new one, but you can use the old legacy one if you enable the ‘Use legacy PDF conversion engine’ option. Also, in DCP 4, you can select PDF 2.0 compliance.

Fixed HTML Options

Selecting the HTML FIXED output option shows this Fixed HTML Options tab, where you can specify additional conversion options.

Find and Replace/Delete

These options allow you to find and replace or delete any text or regular expression.  For instance, if you want to find all <p…> tags with all attributes in an HTML or text file and replace them with <p>, you have to use regular expressions: <p[^<>]*>. Regular expressions are a very powerful tool when doing find and replace in any text file. Doc Converter Pro 4 can find and replace text in documents directly. For example, you can add, change or remove text in Word documents directly. Please make a backup of the input documents if you are converting documents in the same folder. We recommend setting some other Output conversion folder (info below).

Regular Expressions Support

T:\Documents\websites\zapadoo-V2\helpfilev4.5\images\tip.gifWe support .NET Regular Expressions (RegEx) in find and replace commands. See this page for more information.

Output Folders

Output Folder Options

Place converted files in the same folder as the files to convert – Doc Converter Pro will save all converted files in the same folder as the files to be converted.

Place files in a specific folder – You can specify your output conversion folder. Click the Browse button to select the output folder or type/paste the relative (e.g.: ‘my converted files’) or absolute (e.g.: ‘D:/My converted files’) folder path in the text box for that option.

Image Folder options

Place images in the same folder as the converted files – this default option of Doc Converter Pro will save all images in the same folder as the converted output file. Each converted file will have a separate folder with images. Folder name and image file names are based on the converted file output file name.

Place images in their own folder in the same location as the converted files – set your own relative images folder name (e.g.: ‘images’). Please note that this folder will be used for all converted document image files.

Place images in this specific folder – set your own absolute images folder name (e.g.: ‘D:/images’). Please note that this folder will be used for all converted document image files.

Images absolute or relative URL – set a custom image URL or a relative prefix part of the URL for images in your HTML. It’s useful if you copy HTML into your website that has a custom folder for images.

File name images prefix – set a custom image file name prefix, for example: image, picture, etc. By default, output image file names are based on input document file names.

Image Options

Image options – if there are images in your Word File, you can select what image format you want to convert them to. The options are: PNG, JPG, WebP, GIF, BMP or WMF. There is also an option to control the JPG or WebP compression level; the higher it is, the better quality the image will be, but the file size rises in accordance. Generally, for photos, you should use JPG or WebP; for clipart and graphics, use PNG.

Highest image quality– generally, it should increase the quality of images. By default, DPI is set to 96 dpi, but you can change this in the drop-down selector. 96dpi is the recommended image quality level for web images; any higher and your images will be large and slow to load. The high-quality option will slow down conversion slightly, so if you are converting lots of files and image quality is not important to you, you can experiment with turning this option off.

Getting small images?  Try turning off the highest image quality option.

Keep <img> tag height/width attributes – this option will make Doc Converter Pro keep the height and width image attributes in the HTML. Un-ticking it will remove those attributes from the converted HTML.

Embed images – You can embed images directly into your HTML file, so you do not need separate image files – this is a great way to make files self-contained. Please note this feature is only supported by new browsers like Google Chrome, Safari, Firefox or Edge.

Tip: Consider experimenting with PNG or WebP, as it is now supported by all major browsers, e.g. Chrome, Edge, Firefox, Opera, Safari, etc.

CSS Options

No CSS – If you tick this option, no CSS will be used in the HTML file. Basic CSS formatting, like bold and em, will still be kept.

Inline CSS – Inline is where all CSS is put into the tag ‘style’ attribute of the HTML code, not in a <style> tag.

Normal CSS – The CSS is put into the head <style> tag section of the HTML file and sometimes in the tag style attribute.

Save CSS in a separate file – this will put all the CSS into a separate CSS file and link it to the HTML file.

Save CSS in a separate custom folder/file name – this will put all the CSS into a separate custom CSS file name that you will specify and link to the HTML file.

The ‘Delete CSS rules not being used in HTML’ option is useful in Normal and both Save CSS options to remove any CSS rules that are not used in the output HTML.

You can add your own CSS files to the converted HTML by entering each file name per line in the text box below:

In the box above, only enter the CSS file name and location, e.g. style.css or /css/style.css. Doc Converter Pro will automatically add the full CSS tag and link it to the HTML file. Note: For Save CSS in separate file option, Doc Converter Pro will already contain a CSS file link tag.

Also, you can enter CSS styles to keep or remove.

You can add your own CSS rules to the Custom CSS styles page:

CSS Find/Replace

CSS Customisation options allow you to find and replace, rename, or delete any CSS rule names in the HTML document that is being processed.

 

Step 1) Manually enter CSS rule names in the Find text box, or you can load rule names from a document by clicking the ‘Get CSS Rules From Document’ button. The dropdown list on the left side of that button will be filled with CSS rule names that you can select.

Step 2) Enter a new replace it with the CSS rule name, or leave it empty to delete it from the CSS rules. You can get CSS rules from an external CSS styles file or an HTML file that contains a <style> tag with CSS rules by clicking the ‘Get CSS Rules From CSS File’ button.

Step 3) Click the ‘Add to Find/Replace List’ button.

Page/Tag Splitting

 

Split per tag – This will split the page based on a tag, for example, h1. If you select h1, Doc Converter Pro will look for the h1 tag and place all the code from the h1 tag onwards into its file.

By default, we will name split files with the file name and the tag’s inner text. For example, if your file is called catalogue, files will be called catalogue_introduction.html, catalogue_products.html, etc. If you tick the numbered output file names, then the names would be catalogue_1.html, catalogue_2.html, etc. This feature sets the Custom page title option to #PAGESPLITTAGTEXT# constant under the Metadata / Page Title tab; you can add any custom text before or after this constant string.

Split per page – This will convert each page of your document to its HTML file. For example, if your text file has 4 pages, Doc Converter Pro will create 4 separate .html pages, one for each page.

Create an index file – You can create an index file with links to the files created using the split page option. This option is in the Template Overview tab – Converting format section.

 

Encoding

Load and Save file encoding – these options allow you to set the input and output file character encoding. If you don’t need to change the encoding, leave these options to the AUTO value.

Save files with UTF8 BOM marker’ – If you tick this option, Doc Converter Pro will save all files with a UTF8 special marker (special characters at the beginning of the text file) that is used to detect UTF8 file encoding.

Notify me if AUTO encoding cannot determine encoding from HTML file’ – If you tick this option, Doc Converter Pro will notify you if the input file encoding cannot be determined.

Convert special chars to HTML Entities – these options will convert the output file’s non-ASCII or special chars to their equivalent HTML entities. If we take as an example the copyright symbol: ©, as a numbered entity would be: &#169; and as a named entity it would be: &copy; . If you do not know what option to select, then just select do not convert.

By default, all Doc Converter Pro template files are encoded as UTF-8. Most English Web Pages are encoded in UTF-8. If you are cleaning existing HTML files that are encoded differently, e.g. ANSI, then you will need to change the template encoding setting to match the encoding of the file you are cleaning (the opened template encoding will be automatically changed to the selected Load Encoding).

Please do not modify Load Encoding in the Advanced Editor because the template code will not be converted to the new encoding – please use the Easy Editor Encoding section – Load Encoding option.

Add Tag Attributes

This section allows you to add attributes to any HTML tag.

Delete Tags/Attributes

Remove HTML Tags – this will delete all references to the tag in the file, but it will leave the content that was in that tag. To delete the content in the tag, tick the remove tag with content option.

Remove all tag attributes – If you added the tag p, it would remove all attributes of the p tag. For example: <p class=”aboutustxt”> would become <p>

Remove attributes globally – If you added the style attributes, then it would delete all references of the style attribute across all tags in the file.

Remove empty tags – This option allows you to remove any empty tags. For example, if you enter span, it will delete all empty span tags. Ticking the remove all empty tags option will automatically delete any empty tags in the file without you having to specify the tags.

Metadata/Page Title

Metadata options – allow you to add/edit the metadata information contained in the head section of the HTML file. Please note that if your document does not have any metadata, then we cannot add it automatically. For example, if you tick the author option and enter the text ‘Mark Smith’, then this will be inserted into the HTML as <meta name=”author” content=”Mark Smith />

Page title options – If you use it, Doc Converter Pro will change the <title>…</title> tag in the HTML. For example, if you enter about us, it will change the title to <title>about us</title>. You can enter a custom title, or you can get Doc Converter Pro to use the file name for the title text. For example, if your file is called ‘my file.doc’, then the title tag will be <title>my file</title>.

Please note that metadata variables can be used for the metadata section, on Find and Replace/Delete and in Advanced Editor. Variable names that can be used as parameters:

#TITLE#, #AUTHOR#, #SUBJECT#, #KEYWORDS#, #CATEGORY#, #COMMENTS#, #COMPANY#, #CREATIONDATE#, #LASTSAVETIME#, #MANAGER#, #PAGES#, #REVISIONNUMBER#

Example command:

add_html_after_opening_tag(‘HEAD’,'<meta name=”title” content=”#TITLE#”>\r\n’);

HTML Before/After Tags

Add any HTML before and after tags in converted files. For instance, you can add custom metadata, style links, and script links in the <head> tag or add some JavaScript code before the end of the </body> tag.

Please note that this feature is only available in the Doc Converter Pro Business version.

Replace Header/Footer

Specify your HTML header (from the HTML file start to the <body> tag) and footer (from the </body> tag till the end of the file) sections.

Please note that this feature is only available in the Doc Converter Pro Business version.

CSV Export Options

Doc Converter Pro can export converted files to the CSV format that you can then import into a database or Excel. For instance, you can configure template embed images in HTML and split by h1 tag and create a CSV file in WordPress posts table format.  You can import that CSV file with a WordPress CSV Import plugin.

Please note that this feature is only available in the Doc Converter Pro Business version.

Custom C# Code

Custom C# code can additionally process converted HTML or text in any way you want. It’s a very powerful feature in Doc Converter Pro for users with C# and .NET programming knowledge. For instance, you can use C# code if you have some special tags in your document that you would like to dynamically replace with your text or values (e.g.: current date/time, counter values, some generated text/strings, etc).

Please note that this feature is only available in the Doc Converter Pro Business version.

Password Options

In Doc Converter Pro 4, you can specify the input document password and/or set the output password for Word, PDF, and ODT documents.


Advanced Template editor screen

Need help? We can create your custom templates for you. Just tell us what you need it to do, and we can code it. Basic advice is free. For more complex work, there may be a fee. Contact us for details.

For advanced users, we have the advanced template editor. You access this by clicking the tab at the top of the template editor screen.

The first thing to be aware of is that creating templates is not as complicated as it first looks. We have created a custom template system that should cover the needs of most users.

At a basic level, the template system should be considered like a find-and-replace system. You can look for a specific code and then edit or delete it.

T:\Documents\websites\zapadoo-V2\helpfilev4.5\images\tip.gifWe support .NET Regular Expressions (RegEx) in find and replace commands. See this page for more information.

On the screen grab below, you can see the template editor screen, which has several main parts:

Command area: This is where you create the command you want to add to the template.

  1. The first step is to select a command from the drop-down list. For example, say we want to delete the span tag for a document. We select the delete_tag command.
  2. The second step is to add the parameters. For example, if we enter the span tag. You can enter the tag manually or select it from the drop-down tag/attribute list.
  3. The third step is to add the command to the template by clicking the Add Command button.

Edit/delete a command: To edit or delete a command, you should first click on it in the editor area, then click on the Edit or Delete Command button.

Template preview area: You can test out your template by selecting a test file in the Template Preview tab. This enables you to easily tweak and test your template until you are happy with it.

Editor area: Here, you can directly edit the template commands. Pressing control and space will show you a list of commands.

In the screengrab example below, there is a sample command: delete_tag(‘span’); – this will delete the span tag from your file.