There is an issue with ampersands. When creating a simple xlsx sheet with just one $val$ cell, the following code creates a defective excel file.
$xlsxStructure = new XlsxStructure();
$xlsxStructure->parseXlsx($datasource);
$xlsx = new CreateXlsxFromTemplate($xlsxStructure);
$xlsx->replaceVariableText(array('val' => 'Hi & Welcome'));
$xlsx->saveXlsx($newXlsxFile);
The problem here is the ampersand.
Instead I need to use the following.
$xlsx->replaceVariableText(array('val1' => 'Hi & Welcome'));
There should be an appropriate replacement internally.