Removing blank elements

Feb 10, 2012 at 9:05 AM


I am loading letter templates like this, my problem is if some of the entries are empty in my database it just leaves a blank line in my letter (word docuemtn), any idea how I can get around this please?

$document = $PHPWord->loadTemplate("$CFG->templatesdir/letters/$le");

$document->setValue('date', date("jS F Y"));
$document->setValue('pm', $pm);
$document->setValue('position', $position);
$document->setValue('location', $sa->practice->location);
$document->setValue('address1', $sa->practice->address1);
$document->setValue('address2', $sa->practice->address2);
$document->setValue('address3', $sa->practice->address3);