I have a word document which has a table in it that should not be displayed if there is no data in the table.
I think the way to achieve this would be to put the table in a bookmark and then remove the data in the bookmark if there is nothing to display.
I have attached a document for reference.
Here is a sample of code I have in VB to remove the table.
Dim doc As Document = New Document(templatePath) doc.MailMerge.RemoveEmptyParagraphs = True doc.Range.Bookmarks("LipidBookmark").Text = "" doc.Range.Bookmarks("LipidBookmark").BookmarkStart.ParentNode.Remove() doc.MailMerge.Execute(dataset) 'Save the document doc.Save(LetterName, SaveFormat.Doc, SaveType.OpenInWord, Response)
However the table will always show in my resulting document.
The version of Words that I am using is 18.104.22.168
Any clues to where I have gone wrong would be greatly appreciated.