Document Export

OmniOutliner supports the export of outlines to documents of various formats, such as to standard office, spreadsheet, text, and HTML formats.

This section examines how to create instances of the FileWrapper class in preparation for the export of documents and content.

Documentation regarding the other classes involved in the saving and export of OmniPlan documents can be found in FileTypes and FileSavers.


If you think of an outline as a set of data, then it’s easy to understand that an outline’s data can be packaged in a variety of ways. Each “data package” has a set of parameters that determine how the outline data is stored or presented.

For example, one package may store the data as tabbed data, while another may store the outline data in XML format. Each of the supported file packaging formats has its own set of parameters. In terms of Omni Automation, these file packages are referred to as FileWrappers.

Each instance of the FileWrapper class has a unique type identifier that identifies that wrapper. To get a list of the export types supported by OmniOutliner, write a simple script to access the value of the writableTypes property of the Document class. The result will be an array of the identifiers for the FileWrappers supported in OmniOutliner.

NOTE: a complete list of all readable and writeable filetypes supported by OmniOutliner is available here.

A writable type is used when creating a new FileWrapper instance by using the makeFileWrapper(…) function of the Document class:

fileTypeID = "com.omnigroup.OmniOutliner.CSVExport.CSV" baseName = wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ console.log(wrapper) //--> [object FileWrapper: file, 2729 bytes] }) wrapperPromise.catch(function(err){ console.error(err.message) })

 01  The file type identifier for the desired export format.

 02  The name that should be used for the exported document. Note that if a file saver dialog is used in the export script, the user may change the provided file name. Also note that if the export format is HTML, the provided name will be used to name the folder containing the main HTML file and supporting files.

 03  The makeFileWrapper(…) function of the Document class is used to create a file wrapper instance. Since it make take some time to complete the creation of a complex file wrapper, the result of this command is a JavaScript promise object, whose resulting content will be processed elsewhere in the export script. The file name and file type ID (optional) are provided as function parameters. Note that if the optional type ID is not provided, the default file format is used automatically.

 05-08  The then(…) method of the Promise class is used to process the contents of the JavaScript promise created earlier in the script. The file wrapper generated by the previous makeFileWrapper(…) function is passed into this function so that it may processed by those statements placed within the function.

 10-12  The catch(…) method of the Promise class is called in the event that there is a problem with the creation of the file wrapper.

Instance Properties

Each FileWrapper instance has a set of supported properties, most of which have values that are read-only, with the exception of the preferredFilename property whose value can be set in a script.

The value of the contents property is a representation of the outline data, which can be manipulated using class and instance functions from the Data class, such as the toBase64() function shown in the following example:

fileTypeID = "com.omnigroup.OmniOutliner.CSVExport.CSV" baseName = wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ encodedData = wrapper.contents.toBase64() }) wrapperPromise.catch(function(err){ console.error(err.message) })

Class Functions

The class functions for the FileWrapper class:

fileName = "Cow.txt" textData = Data.fromString("How now brown cow") wrapper = FileWrapper.withContents(fileName, textData)

It may be desired to perform multiple exports of a document to files in a variety of formats. The withChildren(…) class function can be used to create a folder containing one or more exported documents.

docName = var fileTypeID1 = "org.opml.opml" var fileTypeID2 = "com.omnigroup.OmniOutliner.CSVExport.CSV" wrapperPromise1 = document.makeFileWrapper(docName + ".opml", fileTypeID1) wrapperPromise2 = document.makeFileWrapper(docName + ".csv", fileTypeID2) promises = [wrapperPromise1,wrapperPromise2] Promise.all(promises).then(function(fileWrappers){ filesaver = new FileSaver() folderType = new FileType("public.folder") fileType1 = new FileType(fileTypeID1) fileType2 = new FileType(fileTypeID2) filesaver.types = [folderType, fileType1, fileType2] fldrwrapper = FileWrapper.withChildren("Export Folder",fileWrappers) fileSaverPromise = fileSaverPromise.then(function(urlObj){ console.log(urlObj.string) // file url to directory }) fileSaverPromise.catch(function(err){ console.log(err.message) }) }).catch(function(err){ console.log("Error", err.message) })

 01  Get the name of the current OmniOutliner document.

 03-04  The file type identifiers for the desired exports, in this example they are: OPML (Outline Processor Markup Language), and CSV (Comma-Separated Values)

 05  The makeFileWrapper(…) function of the Document class is used to generate the first file wrapper, by using the document name appending with the appropriate export file extension, and the corresponding file type ID. The result is a JavaScript promise object.

 06  The makeFileWrapper(…) function of the Document class is used to generate the second file wrapper, by using the document name appending with the appropriate export file extension, and the corresponding file type ID. The result is a JavaScript promise object.

 07  An array of the generated JavaScript promise objects is stored in the variable: promises

 09-27  The all(…) method of the Promise class is completed when all of the promises passed into the function are ready for processing. The then(…) function is appended to all(…) function in order to process the passed promises.

 11  This example script incorporates the use of a file saver dialog to allow the user to choose the name and location for the folder that will contain the exported documents. A new instance of the FileSaver class is created and stored in the variable: filesaver

 12  Generate a file type object for a folder.

 13-14  Generate file type objects for the desired export file type IDs.

 15  Set the file types of the file saver object to the array of generated file types. Note that the array should always begin with the folder type object.

 16  The withChildren(…) function of the FileWrapper class generates a file wrapper object for the export folder by passing in the folder name and array of export file wrappers as the function’s parameters.

 17  The show(…) method is used to display the file saver dialog, and the result of the method is a JavaScript promise object that will eventually contain the URL to the exported folder.

 19-21  The then(…) function of the Promise class is automatically called after the user has completed the file saver dialog, with a URL object reference to the export folder being passed into the function.

 23-25  The catch(…) function of the Promise class is called if the file saver dialog is canceled.

Instance Functions

The instance functions for the FileWrapper class:


The class properties of a FileWrapper.Type:

As mentioned previously, here is a full explanation of the FileWrapper.Types supported by OmniOutliner:

Here are the various export formats with their corresponding FileWrapper.Type:

When exporting a multi-column outline as CSV, OmniOutliner saves the .csv file using standard comma-separated values (CSV) conventions (i.e., each column is separated by a comma, and text with spaces is placed within quotations).
Excel 2010 Format
Creates a .xlsx spreadsheet document capable of being read in Microsoft Excel 2010 (and other versions of Excel that support the format). This export option maps most closely to multi-column data outside OmniOutliner, and does its best to replicate styles between the two (within the limits of Excel).
Creates a like-named folder that contains an index.html file along with the necessary images and attachments that make up your OmniOutliner file. All of the styles you’ve used in OmniOutliner are converted to CSS and included in the index.html file.
HTML (Dynamic)
This option gives you everything that comes with the basic HTML export, plus an added outliner.js file. This JavaScript file is what makes the file dynamic; you can open and close the sections of your document just as you would in OmniOutliner.
Microsoft Word (indented)
Creates a .docx file that opens in the default page layout view and retains the outline structure via indentation. This export option only includes the topic column, and is primarily useful for transitioning from an outline to a word processor (rather than duplicating OmniOutliner’s functionality in Word). Row level styles are converted to heading styles, and other styles are flattened and applied directly to text (Microsoft Word does not support OmniOutliner’s style model).
Microsoft Word (outline)
Creates a .docx file that opens by default in Microsoft Word’s Outline view. Choose this option to export an outline that can be readily expanded upon in Word. This export option only includes the topic column.
OmniOutliner Document
Exports a .ooutline file, the current default OmniOutliner file format (for OmniOutliner 5 and later).
OmniOutliner Template
Exports a .otemplate file which can be used as the base theme for other OmniOutliner outlines. This template format is not compatible with versions earlier than OmniOutliner 5.
OmniOutliner 3
Exports a .oo3 file which can be opened in either OmniOutliner 3 or 4 for Mac, and in OmniOutliner 1 for iPad and OmniOutliner 2 for iOS. These files are not compatible with OmniOutliner 2 for Mac and earlier. They can be opened in OmniOutliner 5, but must be updated to the newer .ooutline format before all editing features are available.
OmniOutliner 3 Template
Exports a .oo3template file which can be opened in either OmniOutliner 3 or 4. These files are not compatible with OmniOutliner 2 or earlier. They can be opened in OmniOutliner 5, but must be updated to the newer .otemplate format before they can be edited.
OPML (Outline Processor Markup Language)
Exports a .opml file, which retains the hierarchical structure of your outline. However, OPML files do not retain any of the styles or attachments you may have applied in OmniOutliner.
Plain Text (with tabs)
Exports a raw .txt file without any styles. Child rows and columns are aligned using tabs rather than spaces, making this type of export useful for importing into spreadsheet apps such as Numbers or Excel.
PowerPoint 2012 Format (pptx)
OmniOutliner exports the contents of your outline in an XML format that PowerPoint 2012 can interpret and render. After exporting your outline as .pptx, you can then import the PowerPoint file into Apple’s Keynote app.
Each Level 1 row becomes a separate slide in the PowerPoint presentation, with its children listed on that slide, and notes become presenter notes. Very little styling is carried over from OmniOutliner (styles don’t match well between the two formats, so we err on the side of removing them).
Image attachments are placed on slides corresponding to their level in the hierarchy, but must be manually repositioned to the desired location on the slide.
org.openxmlformats.presentationml.presentation.PowerPoint 2012 Format (pptx)
RTF (Rich Text Format)
Exports a .rtf file, which retains all of the styles you’ve applied in OmniOutliner. RTF is a standard document format that most word processors, such as Word and macOS’s TextEdit app can open. Export to RTF if your Outliner document contains only text and numbers.
RTFD (Rich Text Format with Attachments)
Exports a .rtfd file, which retains all of the styles you’ve applied in OmniOutliner. What sets RTFD apart from RTF is that an RTFD file can contain attachments, such as any images, audio clips, or anything else you attach to your OmniOutliner file. Most word processors, such as Word, Pages, and macOS’s TextEdit can open .rtfd files.

Export Examples

Here are some examples of using FileWrappers to export OmniOutliner documents.

Here’s an Omni Automation script for creating a new task in OmniFocus with the current OmniOutliner document as an attachment. The script uses the integrated URL support in OmniFocus to create and run a URL link for creating tasks:

wrapperPromise = document.makeFileWrapper( wrapperPromise.then(function(wrapper){ taskName = encodeURIComponent( attachmentName = encodeURIComponent(wrapper.preferredFilename) encodedData = wrapper.contents.toBase64() urlStr = "omnifocus://localhost/add?name=" + taskName + "&attachment=" + encodedData + "&attachment-name=" + attachmentName URL.fromString(urlStr).open() }) wrapperPromise.catch(function(err){ console.error(err.message) })

 1  Use the makeFileWrapper(…) function of the Document class to generate a file wrapper, passing-in the name of the document to be used as the name of the export file. Since no export file type has been specified as a second parameter, the default export file format will be used. The result of the function is an instance of a JavaScript promise.

 03-09  The then(…) function of the Promise class is used to process the file wrapper once it has been created, and is passed into the function.

 04  Encode the document name to be used as the name of the task.

 05  Encode the document file name to be used as the attachment name.

 06  Encode the contents of the document in Base64 encoding format, which results in a string of URL approved characters.

 07  Combine the encoded elements into the URL format supported by OmniFocus.

 08  Convert the URL string into a URL object and execute it using the call() method.

More information about implementing the previous script as an Omni Automation action can be found here.

The following example script utilize the built-in eMail support in OmniOutliner to add export copies of the current document to new outgoing mail messages:

fileTypeID = "public.plain-text" baseName = wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ var email = new Email() email.subject = "Plain-Text Version of “" + + "”" email.body = "Here is the plain-text version of the document for you!\n\n" email.fileWrappers = [wrapper] email.generate() }) wrapperPromise.catch(function(err){ console.error(err.message) })

You can use the contents property of the FileWrapper class to generate text content for an outgoing email message.

fileTypeID = "public.plain-text" baseName = wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ outlineText = wrapper.contents.toString() var email = new Email() email.subject = "Plain-Text Version of “" + + "”" email.body = outlineText email.generate() }) wrapperPromise.catch(function(err){ console.error(err.message) })

Here’s an action that uses the same export technique to send the current outline to the Drafts application as plain text:

/*{ "type": "action", "targets": ["omnioutliner"], "author": "Otto Automator", "identifier": "com.omni-automation.oo.export-outline-to-drafts-as-plain-text", "version": "1.0", "description": "This action will create a new document in the Drafts app with the contents of the outline in plain text format.", "label": "Drafts • Export to Drafts as Plain Text Outline", "shortLabel": "Export to Drafts" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ // action code // "" "org.opml.opml" "public.plain-text" var fileTypeID = "public.plain-text" var baseName = "Outline" var wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ var outlineText = wrapper.contents.toString() var encodedStr = encodeURIComponent(outlineText) var urlStr = "drafts5://x-callback-url/create?text=" + encodedStr var url = URL.fromString(urlStr){console.log(result)}) }) wrapperPromise.catch(function(err){ console.error(err.message) }) }); action.validate = function(selection, sender){ // validation code return (rootItem.descendants.length > 0) }; return action; })();

Export to HTML

The following Omni Automation plug-in will export the current outline to disk as a folder containing an HTML file with supporting files.

This plug-in uses an action form to prompt the user to select the export parameters to use. In addition, the action displays a file saver dialog from which the user determines the name and location to be used for the exported HTML folder.

The action code incorporates three uses of the JavaScript Promise class: 1) for form creation and display; 2) for generating the export file wrapper; and 3) for displaying and responding to the file saver dialog.

/*{ "type": "action", "targets": ["omnioutliner"], "author": "Otto Automator", "identifier": "com.omni-automation.oo-export-to-html", "version": "1.0", "description": "This action will export the current outline in either simple or dynamic HTML format.", "label": "Export to HTML", "shortLabel": "Export to HTML" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ // action code // selection options: columns, document, editor, items, nodes, outline, styles var inputForm = new Form() dynamicCheckbox = new Form.Field.Checkbox( "dynamicCheckbox", "Enable dynamic controls (disclosure triangles, checkboxes, etc.)", false ) openFileCheckbox = new Form.Field.Checkbox( "openFileCheckbox", "Display HTML after export", false ) inputForm.addField(dynamicCheckbox) inputForm.addField(openFileCheckbox) formPromise ="HTML Export:","Continue") formPromise.then(function(formObject){ var shouldExportAsDynamic = formObject.values['dynamicCheckbox'] if(shouldExportAsDynamic){ fileTypeID = "com.omnigroup.OmniOutliner.HTMLExport.HTMLDynamic" } else { fileTypeID = "com.omnigroup.OmniOutliner.SimpleHTMLExport.HTML" } var shouldDisplayAfterExport = formObject.values['openFileCheckbox'] var baseName = wrapperPromise = document.makeFileWrapper(baseName, fileTypeID) wrapperPromise.then(function(wrapper){ filesaver = new FileSaver() fileSaverPromise = fileSaverPromise.then(function(urlObj){ console.log(urlObj.string) if(shouldDisplayAfterExport){ urlStr = urlObj.string + "/index.html" URL.fromString(urlStr).open() } }) fileSaverPromise.catch(function(err){ console.log(err.message) }) }).catch(function(err){console.log(err.message)}) }) }); action.validate = function(selection, sender){ // validation code // selection options: columns, document, editor, items, nodes, outline, styles return true }; return action; })();

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.