Tables in IF blocks returning empty row as opposed to nothing
Hi, this is my first post so apologies if I have mis-posted it.
Here's the issue I'm currently facing.
I have created a Word 2013 mailmerge file, which gets its fields from an Excel sheet. Then the resulting file is uploaded to a web server and a .NET application replaces the fields from the DB. The following structure is included in the file:
{ IF { MERGEFIELD FieldName1 } <> "" "<table><tr><td>ColName1</td><td>ColValue1</td></tr></table>" "" }
{ IF { MERGEFIELD FieldName2 } <> "" "<table><tr><td>ColName2</td><td>ColValue2</td></tr></table>" "" }
{ IF { MERGEFIELD FieldName3 } <> "" "<table><tr><td>ColName3</td><td>ColValue3</td></tr></table>" "" }
NOTE: I have used HTML tags to explain the layout, though the tables are created in Word.
Everything works great and the tables are stuck together, creating a contiguous block of text when all values are being returned. The problem is when one of the values (eg. FieldName2) does not get returned, so the conditional statement should not display the table at all and stick the next table underneath, but instead a new line is introduced. So the result is that there's an empty line between the tables. I'm trying to remove this line but have had no luck.
I viewed the source code of the received email, and it seems that there's an extra <p style="margin:0pt"></p> being inserted between the tables.
Let me know if you would need anything else from me...
Any help would be appreciated.
Thanks
d
|