Additionally, Group tagging elements might multiply, while If tagging elements might hide table rows. The resulting tables in the generated document can have considerably different size compared to the template tables. When our report is rendered, all the objects from the template follow numerous layout settings regarding their size, position, text wrapping and anchoring options.Īt run-time, when dynamic report data replaces tagging elements and the final report document is generated, table rows in List tagging elements will multiply and a change of size of these objects is likely to happen. The reason behind that is precisely the fact that some of these tables were formatted as floating objects.
Consider an example where the tables (highlighted in blue, green, and orange) change places as the report is printed: We have already encountered some cases where the objects from the template seemingly switched positions. When you are dealing with tables that should appear one after another in your report, it is best to avoid formatting the tables as floating objects. Positioning of the tables in the template Let us take a look at some of the practical consequences of this setting for the template designs and some possible cases. Every object is formatted either as an Inline object (Text wrapping = None) or as a Floating object (Text wrapping = Around). You can check the status of this setting if you right-click on a table, then open Table properties > Table Options and check the Text wrapping setting. This is the main reason why this setting is so easily overlooked, but it can have a significant impact on your document’s layout. After all, we are all used to the drag and drop functionality, but it is good to know that the change of this important setting is done without notifying the user. Of course, there is nothing wrong with this handy Word feature. However, this setting often automatically changes to Floating when you drag and drop an object. The same logic of formatting rules applies to all of them, but in this article, we will focus on tables primarily.Įach new object that you insert directly in a Word document body is initially placed as an Inline object. There are several different MS Word objects that can be made floating: Shapes, Pictures, Tables and Charts. The topic of this article is one of the most important object formatting settings that is often overlooked: the difference between an Inline object and a Floating object. = are all used to working a lot with tables when designing report templates. For Each section As Word.Section In Me.įoreach (Word.Section section in )
This code example uses the active document. The following code example adds a field to show the page number in each header in the document, and then sets the paragraph alignment so that the text aligns to the right of the header. For Each section As Word.Section In Me.įoreach (Word.Section wordSection in ) The following code example sets the font of the text to be inserted into the primary footer of each section of the document, and then inserts text into the footer. To use the following code examples, run them from the ThisAddIn class in your project. = įoreach (Word.Section section in this.Sections) For Each section As Word.Section In Me.Sectionsĭim headerRange As Word.Range = section.Headers().Range For Each section As Word.Section In Me.Sectionsĭim footerRange As Word.Range = section.Footers().Rangeį = įoreach (Word.Section wordSection in this.Sections) To use the following code examples, run them from the ThisDocument class in your project. For more information, see Features available by Office application and project type.
The procedures are different for document-level customizations and VSTO Add-ins.Īpplies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. Each section of a document contains three headers and footers: You can add text to headers and footers in your document by using the Headers property and Footers property of the Section.
Applies to: Visual Studio Visual Studio for Mac