How to store different view in a single Microsoft Word document?

55 Views Asked by At

I would like to create an application that allow users to add user-readable text in word document and at the back end maintain complex text (syntax) like MergeField or Velocity code. e.g. Simple text: Hello Mr. Bob. Complex syntax: Hello «#if($gender == 'Male' Mr. #{else} Ms. #end» Bob

Is this achievable to maintain both simple text view and complex syntax view in single word document?

Thanks

1

There are 1 best solutions below

1
Ori Marko On

First, you can't have dot in variable name, so let's assume it's saved in $gendervariable.

Second, you can have complex syntax with default of "Hello Mr. Bob" if no gender variable:

Hello #if( $gender == "Female" ) Ms.#{else} Mr.#end Bob

Notice that Mr. is the default text