ARIS Community - We Love BPM

Word Template, using docproperty tags

courtpl's picture
by Pascal COURT in Reports & Macros posted on 2017-09-26

I would like to replace word tags "{DOCPROPERTY XXXX \* MERGEFORMAT}" with information from arris during the creation of a report.

example:

var docTemplateData = Context.getFile ("Word Template.docm", Constants.LOCATION_SCRIPT);
var oOutput = Context.getOutputObject (getString ("REPORT_TITLE") + extension, docTemplateData);
oOutput.SetTitle (getString ("REPORT_TITLE"));

and here, replace my value XXXX with a value of an object.

For example :
{DOCPROPERTY Author \ * MERGEFORMAT}
{DOCPROPERTY Subject \ * MERGEFORMAT}
{DOCPROPERTY Title \ * MERGEFORMAT}

Do you have an idea ??

2694 Views
0 Likes
3 Comments
Sorry there are no tags
There are no attachments
Robert Goldenbaum posted on 2017-09-27

Yes, this is possible:

    Context.setProperty("use-new-output", true);
        oTemplateData = Context.getFile("Test.docx", Constants.LOCATION_SCRIPT);
        g_oOutFile = Context.getOutputObject("Output file name", oTemplateData);
...

    if (g_oOutFile.SetPositionToField("MergeFieldName", true)){
          ...
    }

MergeFieldName is the name of the Word Mergefield...

BR Robert

Pascal COURT posted on 2017-09-27

thank you for your reply

But I have unfortunately not expressed my need, I would like to modify the properties of the document that can be found under a type tag {DOCPROPERTY XXXX \ * MERGEFORMAT}, and not add new fields in my templates.

For example :
{DOCPROPERTY Author \ * MERGEFORMAT}
{DOCPROPERTY Subject \ * MERGEFORMAT}
{DOCPROPERTY Title \ * MERGEFORMAT}

Robert Goldenbaum posted on 2017-09-27

Ahm ok sorry, don't know about that...

BR Robert