Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-24-2015, 12:46 PM
deegital deegital is offline Tables in IF blocks returning empty row as opposed to nothing Windows 8 Tables in IF blocks returning empty row as opposed to nothing Office 2013
Novice
Tables in IF blocks returning empty row as opposed to nothing
 
Join Date: Nov 2015
Posts: 1
deegital is on a distinguished road
Question 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
Reply With Quote
  #2  
Old 11-24-2015, 03:04 PM
macropod's Avatar
macropod macropod is offline Tables in IF blocks returning empty row as opposed to nothing Windows 7 64bit Tables in IF blocks returning empty row as opposed to nothing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It appears from your code that you have line/paragraph breaks between each of the field sets. Instead of:
{ 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>" "" }¶
you should have:
{ 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>" "" }¶
where ¶ is your line/paragraph break.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tables in IF blocks returning empty row as opposed to nothing Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
Tables in IF blocks returning empty row as opposed to nothing What is purpose of slide master, as opposed to slide layout meileetan PowerPoint 3 01-10-2014 02:20 AM
Can you create a bibliography (as opposed to a table of authorities) in Word 2003? New Daddy Word 1 11-06-2012 02:37 AM
Apparently empty (blank) cells aren't empty daymaker Excel 3 03-08-2012 03:41 PM
compatibility mode VS saving to doc as opposed to docx airtas Word 7 05-30-2010 02:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft