[OfficeUtils] Unpredictable substitution for Word

[OfficeUtils] Unpredictable substitution for Word

  
Forge Component
(17)
Published on 2017-04-26 by Elena Novozhilova
17 votes
Published on 2017-04-26 by Elena Novozhilova

Hi,

I'm struggling to get the Word substitution to work consistently.  Maybe I'm missing something about how it works, or there is a bug?

I have a simple template file (attached) that has the text: This is a sample document.  

I have a Screen Action that has a Word_Export_SetText with the placeholder set to "document" and the text parameter set to "fish".  It assigns the output to the WordFile local variable, sets the template to the SampleTemplate.docx resource, calls the Word_Export_SetTemplate and assigns the output to WordFile, and finally calls the Word_Export_GenerateFile action.  It downloads the resulting binary.

Here is what happens when I do the following in the SetText and template files, in this order:

  • SetText: Placeholder: "document", Text: "fish"
  • Template: This is a sample document.
  • Output: This is a sample fish.

That's as expected.  Then,

  • SetText: Placeholder: "{document}", Text: "fish"
  • Template: This is a sample {document}.
  • Output: This is a sample {document}.

Oops, it didn't work.  Let's try setting it back to the original.

  • SetText: Placeholder: "document", Text: "fish"
  • Template: This is a sample document.
  • Output: This is a sample fish.

Ok, that worked.  Maybe it doesn't like the special character?  Let's try capitalization:

  • SetText: Placeholder: "Document", Text: "fish"
  • Template: This is a sample Document.
  • Output: This is a sample Document.

That didn't work either.  Let's try going back to the original substitution again.

  • SetText: Placeholder: "document", Text: "fish"
  • Template: This is a sample document.
  • Output: This is a sample document.

Now that's not working any more either, even though it worked before.


Any ideas of whether I'm missing something about how to specify the replacement text?  I also wonder if there's some cleanup in the extension that isn't happening to remove previous substitution text matches.  We're hoping to use this component to generate letters, but I'm unable to reliably produce them because of this issue.  

Many thanks for any help you can provide!

     Scott McD.