Forum


Replies: 1   Views: 475
Replacevariabletext
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpxlsx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpxlsx version and check the Documentation available.

Posted by mKent  · 30-06-2022 - 07:46

Another picture of how the xlsx template looks before using "replaceVariableText" would have been helpful.

This set the identifier for the Variables I want to replace:
$xlsx->setTemplateSymbol('#'); 

$xlsx->replaceVariableText(array('VAR_1' => 'New value 1', 'VAR_2' => 'New value 2''),
array('target' => 'sheets'));

Excel Template before the code (set in any Cell): 
#VAR_1#
#VAR_2#

Excel Template after the code:
New value 1
New value 2