'Add a table to a content control
This tutorial suggests nesting tables in content controls but every time I'm trying to do this I get an error saying 'Word cannot turn off design mode because placeholder text in a content control contains invalid items'. I've tried both Rich Text and Plain Text content controls. Office version is 2012.
How do I add a table to a content control?
Solution 1:[1]
From my own experimentation, and reading the VBA documentation. There are only a limited set of supported use-cases for where the start and end of a content control can appear in a document. With a related constant, control.Level so you can tell them apart.
wdContentControlLevelInline- Inline within a single paragraph.wdContentControlLevelParagraph- Some number of whole paragraphs.wdContentControlLevelRow- Linked to one row of a table.wdContentControlLevelCell- A single table cell.
There seems to be a 5th option. If you create a table first, then select it and add the control. No extra blank lines are inserted. However if you remove the table, the control will also be removed. If you use VBA to examine the Range.Start & Range.End of the table and control, you will see that the table encapsulates the Paragraph control.
It doesn't seem possible to paste an excel table into an existing content control, without creating extra paragraphs.
If you do insert a table into an existing control, it will first be converted to LevelParagraph. With a leading and trailing blank line. While you can remove the leading paragraph, word won't allow you to remove the trailing paragraph.
However you could selected it and change the font effect to "Hidden". At least then it won't be printed.
Or you must delete both the content control & table, then recreate them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
