![]() With GemBox.Document you can update the values separately in mapped XML ( CustomXmlPart.Data) and the content of Content Control ( BlockContentControl.Blocks or InlineContentControl.Inlines). New SpecialCharacter(document, SpecialCharacterType.LineBreak),Įnd Module Content Controls with XML MappingĬontent Controls can be mapped to XML nodes from DocumentModel.CustomXmlParts. New Run(document, "☒") )Ĭ = Trueĭim comboBoxControl As New InlineContentControl(document, ContentControlType.ComboBox,Ĭ(New ContentControlListItem("", "NONE"))Ĭ(New ContentControlListItem("GemBox.Spreadsheet", "GBS"))Ĭ(New ContentControlListItem("GemBox.Document", "GBD"))Ĭ(New ContentControlListItem("GemBox.Pdf", "GBA"))Ĭ(New ContentControlListItem("GemBox.Presentation", "GBP"))Ĭ(New ContentControlListItem("GemBox.Email", "GBE"))Ĭ(New ContentControlListItem("GemBox.Imaging", "GBI")) ![]() Var checkBoxControl = new InlineContentControl(document, ContentControlType.CheckBox, New Paragraph(document, "Plain Text Content Control with tag and title.")) ![]() Var plainTextControl = new BlockContentControl(document, ContentControlType.PlainText, Create named Plain Text Content Control. New Paragraph(document, "It cannot be deleted or edited.")) New Paragraph(document, "This text is inside Rich Text Content Control."), Var richTextControl = new BlockContentControl(document, ContentControlType.RichText, Create locked Rich Text Content Control. But if you only need stuff to work in Windows Word 2007 and later, content controls have some advantages.// If using the Professional version, put your serial key below.ĬomponentInfo.SetLicense("FREE-LIMITED-KEY") You'll find a good summary of various options for "repeating data" hereįWIW, if you need to use forms in Word, the most "compatible" type of form field is what are called "Legacy Form fields" in Windows Word, because these are the only type that also work in Mac Word. If you're using Content controls, you have to create your own Custom XML part to store the values, and connect the controls to that store. Again, you can modify the Title using the Developer tab.īeyond that, you have to use VBA or some such. I think these are Company Address, Company Email, COmpany Fax, Company Phone, and Publish Date. menu, but the values are stored in a different place, i.e. These are also available from the Document Property. If you don't want to use the traditional built-in properties such as Author etc., there is a set of five "properties" called Cover Page Properties that you can use instead. It's also usually helpful to make the controls non-deletable. Then you can copy/paste copies of the control with that title. Using the Developer tab, you can select the resulting content control and give it a new Title such as "Age". This is different from the pre-Word 2007 approach where you had to insert an field, then seleect it and update it. So when you change the value in one copy of the content control, the property value updates, then all other Author content controls are updated automatically. For example, if you insert the "Author" Document Property, Word inserts a content control that is connected to the built-in property. įor Windows Word 2007 and later, you can use some of the Content Controls that Word inserts from Insert->Quick Parts->Document Property. This article explains it can be done with a Template and Macros. As I said, not perfect, but hopefully a start! So, type some text into the first textbox, then right click on the second and select Update Fields. This is set up, but, you have to manually update the field. In the drop down box, select bookmarks and then find the book mark in question. Click on it and give it an appropriate name.Ĭlick on the second textbox, and do the same but this time, click on Cross Reference. When you have selected it, the Bookmark (under Links) should become enabled. Make sure you click on the 3 little dots on the left side so the entire textbox is selected. Now, click on the first textbox (the one where text is to be copied too). In word, add the developer toolbar to the ribbon.įrom the developer toolbar, drop in 2 text boxes from the controls tab. This isn't perfect but, it may be a good start! However, as an example of making it read content from else where, this may get you going. This also means some VBa but this tutorial covers it I think you'll have to use the Word Template and DocVariables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |