Enterprise Architect allows you to create custom document templates to be used in your reports. Internally EA uses the oldie-goldie RTF document format for these templates. When exporting these templates […]
Enterprise Architect allows you to create custom document templates to be used in your reports. Internally EA uses the oldie-goldie RTF document format for these templates. When exporting these templates via Export Reference Data they are included as base64 encoded zipped RTF documents which in turn are again base64 encoded. For the untrained eye it therefore can become tedious to instantly spot the actual contents of these XMI documents. However with a couple of lines of PowerShell we can easily extract those templates to native RTF format. And here is how:
Export RTF as XMI reference data
Extract the desired document templates from EA as shown in the following screenshot: Export Reference Data
Contents of the generated XMI file
Each RFT document is stored in an XMI file resides in a DataSet set of DataRow elements which in turn hold Columnss with the actual data as depicted in the following figure: XMI Base64 Encoded ZIP
To extract the data we only need to load the xmi and decode it:
The output is a ZIP file which holds a single file called str.dat. This file really is an XML fragment in SSDocument format (as shown in the following figure). An SSDocument contains an element SSDocument.Document which in turn holds the base64 encoded data: