Hi Guys,
I'm evaluating the software and have a quick question.
I'm sure there is an easy way to do this but I can't figure it out.
Say I have an address like so
$Address1$
$Address2$
$Address3$
$Address4$
$Address5$
$PostCode$
I'm trying to get it to remove the empty lines if address5 or address4 is an empty string. So far my code looks like the below but it doesn't seem to work.
foreach($variables as $VarToCheckRemove => $varValue)
{
if(strlen($varValue) == 0)
{
$docx->removeTemplateVariable($VarToCheckRemove, 'block');
}
}
$docx->clearBlocks();
$docx->replaceVariableByText($variables);
$docx->createDocxAndDownload(resource_path('letters/letter'));