To add a content control at a specified range RichTextControl1.PlaceholderText = "Enter your first name" RichTextControl1 = Me.Controls.AddRichTextContentControl("richTextControl1") Private Sub AddRichTextControlAtSelection() RichTextControl1.PlaceholderText = "Enter your first name" ĭim richTextControl1 As .RichTextContentControl Private void AddRichTextControlAtSelection() Private .RichTextContentControl richTextControl1 For more information, see Add controls to Office documents at run time. You can recreate a content control that is based on a native content control the next time the document is opened. However, a native content control remains in the document. Each method has three overloads that you can use to add a content control in the following ways:Īdd a control that is based on a native content control in the document.ĭynamically created content controls are not persisted in the document when the document is closed. You can add content controls programmatically to your document at run time by using methods of the Controls property of the ThisDocument class in your project. In the Controls group, click the icon for the content control that you want to add. For more information, see How to: Show the Developer tab on the Ribbon. If the Developer tab is not visible, you must first show it. For more information, see How to: Populate documents with data from objects and How to: Populate documents with data from a database. This is useful when you want to bind the control to data when the control is created. There are several ways to add content controls to the document in a document-level project at design time:Īdd a content control from the Word Controls tab of the Toolbox.Īdd a content control to your document in the same manner you would add a native content control in Word.ĭrag a content control to your document from the Data Sources window. This topic describes the following tasks:Īdd content controls at run time in a document-level projectĪdd content controls at run time in a VSTO Add-in projectįor information about content controls, see Content controls. For more information, see Features available by Office application and project type. In Word VSTO Add-in projects, you can add content controls to any open document at run time.Īpplies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. All Rights Reserved.In document-level Word projects, you can add content controls to the document in your project at design time or at run time. Rich text box control must contain some text or a space Word cannot turn off design mode because placeholder text in a content control contains invalid items The tag property can be used to identify the content controls programmaticallyĪll eight content control types are represented by one object. When is design mode small tags will be displayed around any content controls This mapping has the limitation of only being able to map to leaf nodes or attributes This allows it to be stored as text node in a custom xml part XML is stored as flat OpenXML markup converted into a string LockContents - corresponds to contents cannot be edited LockContentControl - corresponds to contents cannot be deleted This tab is not displayed by default but can be displayed from (Options > Popular tab, "Show Developer tab in the Ribbon) The controls can be found on the Developer tab The border and title of the content control does not appear in printed versions of the document When content controls are added to a document, it is identified by a border, a title and optional temporary text Protected Sections - Restrict or prevent the changing of information in a particular area of the document or templateĭata Binding - Map data directly to a custom xml part Input Forms - Defining a labelled region in a template that can be easily updated and read These are sometimes referred to as "Custom XML" These are editable regions in a document that can contain specific types of content You can only use these in documents that are saved in the Open XMl file formatĬontent controls can be inserted into a document to provide more structure and more control. In application-level projects you can add content controls to any document at run timeĬontent Controls are the editable regions of Building Blocks and there are a number of different types. In document-level projects you can add content controls at design time or at run time NET managed objects, xml elements or other data sources You can bind content controls to database fields. For example document properties are mapped directly to content controls Content controls are editable regions within a documentĬontent controls are defined regions in a document that can be used to contain specific content.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |