Sparx Systems Forum

Discussion => Automation Interface, Add-Ins and Tools => Topic started by: Uffe on December 12, 2017, 12:39:49 am

Title: Add watermark to generated document
Post by: Uffe on December 12, 2017, 12:39:49 am
Hi all,

I'd like to stamp "draft" (or whatever) watermarks on certain generated documents. RTF doesn't actually support those, but according to this MSDN article ( you can achieve the same effect using a \shp.

I tried creating a watermark in a Word document and saving that as RTF (which works, Word can render it correctly when reopening the file), then importing that into a linked document in EA (by creating the linked document, then in the RTF editor selecting File - Import), the idea being that I could use that document in a call to DocumentGenerator.InsertLinkedDocument() to get the watermark to show up on all pages.

The EA RTF editor did not display the watermark, but not to worry, the RTF specification says you're allowed to ignore content you can't handle, but if I export the document, the \shp is gone. I'm not sure the spec says you can do that, but anyway, that means this approach doesn't work.

But is there another way to create a watermark like this?

I can script it, sure. But I was looking for a way to have it incorporated into the template.

Title: Re: Add watermark to generated document
Post by: Geert Bellekens on December 12, 2017, 03:32:52 am

I don't see any options on the templates themselves, but there is an option to set a watermark on the Document generation dialog (F8).
Any reason why you aren't using that?

Title: Re: Add watermark to generated document
Post by: Uffe on December 12, 2017, 08:34:23 pm
Well the thing is I want to automate it so I can control which, if any, watermark gets put on a document without the user having to remember to a) select a watermark when appropriate, or b) deselect it when not (since EA remembers the selected watermark between generations).

I already have linked documents which I use in calls to DocumentGenerator.InsertLinkedDocument() in my document generation scripts to get headers and footers. My idea was to duplicate these and add "draft" watermarks to the duplicates, and then in the script to select one of them based on the status of the model for which the document is being generated.