HowTo: Create or Edit DocX without Word - AHK & OOXML



This is a basic how-to and a plug for getting DocumentFormat.OpenXML activities. OfficeOpenXML gets a lot of flak for being hard to work with, but you can do a lot with it - maybe enough to justify adding it to UiPath. Even if it never gets added, you can use it. I’m only scratching the surface here, and this is Word-specific.
The attached workflow has a single activity - Run Auto Hot Key Script. There are five files included in the archive:

DocumentFormat.OpenXml.dll (This is version 2.5. I include this because 2.7.2 doesn’t work for me yet)

The AutoHotkey script uses the CLR_H library to run VB.Net code. It can also run C#.
The VB.Net code imports System.IO, DocumentFormat.OpenXml.Packaging, and DocumentFormat.OpenXml.Wordprocessing.
I didn’t have to add any Import statements in the workflow, at least not here where I have the DLL in the same directory.

Here’s a screenshot of the document that was generated without using Word at all, and no “Word Application Scope”:

You can also use PowerShell or Invoke Code to work with OOXML.

burque505 (1.4 MB)