I am using the OpenXML Power Tools to perform some transformations in Word. My goal is to combine some Word document templates, so I started looking into the BuildDocument
method. My code looks like this:
Dim SourceList As New List(Of Source)
For Each DocumentPath As String In DocumentPaths
SourceList.Add(New Source(New WmlDocument(DocumentPath), True))
Next
DocumentBuilder.BuildDocument(SourceList, NewFilePath)
The code initially failed because of the obsolete Close calls, but after removing them in the Power Tools code I am now getting an exception with this description:
Not an open XML Document
Am I missing something? It seems like I followed the author's instructions for how to set it up, pictured below from this blog post. The file paths were verified to be Word documents, and the same error is thrown with a single hard-coded file path as well.
I ended up figuring out the root issue. The newer versions of OpenXML seem to be incompatible with Power Tools. The simple way to fix it is to only bring in Power Tools and let it grab the version of OpenXML it prefers rather than installing OpenXML first.
This was using NuGet in Visual Studio.