Automation Action: Convert Document
Convert Word, Open Document, Excel, PDF, Richtext, Text, Markdown Text, CSV or HTML documents or attachments to PDF, Word, HTML, image or text.
Converts a Microsoft Word, Microsoft Excel, PDF, Open Document, Richtext, Text, Markdown Text, CSV or HTML, file to various formats.
The document to convert can be a local file (or a file saved from a previous action) or incoming Attachments.
Select a Document To Convert - this can be any local file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached documents matching the Matching Mask. Enter *.* to convert all supported attachments.
Select the Convert To type. You can convert to the following formats:
- DOCX (Microsoft Word)
- ODT (Open Document)
- XLSX (Microsoft Excel)
- Images (PNG, GIF, BMP, JPEG, TIFF)
When converting PDF to image files, each page in the PDF document will be converted to a separate image file. The page number will be added to the filename, eg: document_1.tiff, document_2.tiff.
When converting to Excel, the document to convert can be CSV, XLS or text only.
In the Rename Converted Files To entry you can optionally specify a new name for the converted file. You can use %fieldname% replacements - for example: order%OrderNumber%.pdf would rename the attachment order1234.pdf if the %OrderNumber% field contained '1234'.
You can use the special variable replacement %filename% to use the original file name as part of the renamed file. For example, suppose the document to convert was called "orderdata.docx" and the %OrderNumber% variable was set to '1234' - renaming to: %filename%-%OrderNumber%.pdf would rename the file 'orderdata-1234.pdf'.
If your rename string doesn't contain a file extension then the Convert To type extension will be used.
In the Save To Path entry, enter or select the local folder to save the converted document to. If no Save To Path is specified then the converted files will be saved in the same folder as the file being converted.
If the converted file already exists it will be overwritten.
You can assign the saved path & filename(s) to a variable by selecting the variable from the Assign Filename(s) To list. You can then use this variable in the Attachments entry on Send Email actions or in any other way.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Converting HTML To PDF Or Word Formats
Converting HTML files to other formats will only work if the HTML contains absolute links (image files, stylesheets etc), and the those links are accessible. If you want to convert an online web page to PDF you can use the Save As PDF action instead - which allows any URL to be rendered to PDF.
You can also use the HTTP Get action to get HTML from a URL with Convert option set to Convert Relative Links To Absolute Links. Save the HTML to a file using the Read/Write Text File action and then convert this.
Markdown text files ('.md') will be converted to HTML first before being converted to the Convert To file type.