JSON API - replaceVariableByWordML

replaceVariableByWordML

PREMIUM TRIAL / ADVANCED

Replaces placeholder variables by plain WordML code.

Note

You are reading the JSON API documentation. For the PHP API method please go to replaceVariableByWordML.

JSON data
Key Description
variables The names of the placeholder template variables as keys and the plain text that should replace them as values.
firstMatch If the variable appears more than once within the Word document and firstMatch is set to true, phpdocx will only replace the first occurrence of the variable within the Word document.
type Possible values are:
  • block (default): replaces the variable and removes its containing paragraph.
  • inline: only replaces the variable by the WordFragment inline content (it may be used to replace a variable by formatted text).
target Possible values are: document. This option sets the scope of the replacement procedure.
Code samples

Example #1

A template can be a local file, a Base64 string, or a remote file.

Release notes
  • phpdocx 18.0:
    • new action.