Forum


Replies: 1   Views: 295
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

Posted by admin  · 02-07-2022 - 17:42

Hello,

Thanks for your feedback. Please note that the package includes the same sample (examples/Templates/replaceVariableText folder), including the template (examples/files folder).

Regards.