#1
|
|||
|
|||
Binding Custom XML-Based Items to Content Control Dropdown
Can you point me in the direction to learn how to bind multiple custom XML nodes to a drop-down content control?
I can see in custom XML from Word files that have been in a SharePoint document library with multi-selection list items that the drop-downs are functional in the Word file's doc properties. But the SharePoint-sourced XML is inscrutable to me, and I haven't been able to successfully emulate the structure. A video by former MS employee Eric White walks through the process but isn't getting me all the way there; an article and example doc are no longer on Microsoft's site and unavailable via archive.org. Microsoft's current instructions include using Visual Studio (which I have), but the method uses C#, so it's beyond me. |
#2
|
|||
|
|||
It is beyond me, as well. However you may want to look at:
|
#3
|
||||
|
||||
As far as I know you can only bind a single xml node to a content control.
I've had no problem binding a node to a dropdown CC and the method is no different to binding a node to a plain text CC. The only complexity with dropdown CCs is that each entry has a display name and a value. The value is what gets stored in the XML node. Are you trying to populate the dropdown CC options with multiple nodes? As far as I'm aware, that isn't dynamic and you would need to use code to clear the dropdown list and repopulate it from the xml data. This is not mapping.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
Quote:
|
#5
|
|||
|
|||
Quote:
I need to use custom XML because the template I'm working on already uses it extensively, and all data bound to content controls must reside in custom XML; a design requirement is that data can't be in built-in doc properties or the body of the doc. At one point while trying to create a dropdown content control mapped to a custom XML node, the dropdown items were showing up in document.xml. However, I was not including both names AND values, so it sounds like I need to go back and try that approach. Finally, the dropdown item nodes would be static: it's a list of ~50 items that will never change. |
#6
|
||||
|
||||
I just watched Eric's video and the method he uses is different to what I'm used to doing. Digging around that way relies on expert knowledge of what you can and can't do - it will be exceptionally easy to break a file if you add something invalid or remove a necessary node.
Sharepoint injects custom xml in a way that enables you to insert mapped Content Controls via Insert > Quick Parts > Document Property > xxx. Normally there are 15 entries to built-in properties in there but if your Sharepoint template has injected custom xml then you can pick some others which might be what you are looking for. Are you able to post a sample document that has come out of Sharepoint so we can experiment with the particular custom XML you are working with? Greg Maxey has done some great work on replicating the Sharepoint xml injections. That may be somewhat relevant to your question although it may just be a distraction if the properties (in para 2 above) are already in the file. Redirecting
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
|||
|
|||
Yes, I'd like to do exactly what you describe: add content controls via Insert > Quick Parts > Document Property.
I'm attaching a sample file that contains SharePoint-injected drop-downs. A little back story: I'm accustomed to re-purposing built-in doc properties to get repeating content controls. What I've been asked to do for a template I'm working on is, protect the content controls when users need to anonymize documents for external review. When they wipe doc properties via Doc Inspector, as you know, the content controls break. By instead mapping the content controls to custom XML, our users will be able to preserve the content controls even as they strip out author/firm and other identifying info (unless they put the file in a SharePoint doc library that has a column of names). I'll take a look at the link you provided -- thanks for that. |
#8
|
||||
|
||||
The document you attached doesn't contain any repeating xml content, nor any Sharepoint-injected xml. And the two dropdown CCs contained in the body aren't mapped to your custom XML (which also doesn't contain a node named to align with either Key Personnel or Support Staff). As a result it isn't clear where you think this list information is going to come from nor to what the user selection might map to.
I do see you have mapped CCs in the footer but these aren't dropdowns. Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><AQ_CustomProperties xmlns="http://schemas.aq.com/customDocProperties"> <AQ_ProjectName></AQ_ProjectName> <AQ_ProjectNameShortVersion></AQ_ProjectNameShortVersion> <AQ_ProjectNumber></AQ_ProjectNumber> <AQ_ReportTitle></AQ_ReportTitle> <AQ_ReportTitleShortVersion></AQ_ReportTitleShortVersion> <AQ_SpecDivision></AQ_SpecDivision> <AQ_SpecSectionName></AQ_SpecSectionName> <AQ_SpecSectionNumber></AQ_SpecSectionNumber> </AQ_CustomProperties>
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#9
|
|||
|
|||
I must have uploaded an incorrect version of the template way back in September. I unexpectedly had to set aside the work until now.
Thanks for the tip on rich-text CCs -- I'd actually run into issues with that and subsequently went with plain-text. Today I was messing around with dropdowns again, and I've got a work-around, though it's not exactly what I was looking to do: I'm using dropdown CCs bound to custom parts, which works. |
#10
|
|||
|
|||
Do look into Greg's Enhanced Document Properties AddIn.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change Value of a Content Control based on the value of another content Control | jsc_msoffice | Word VBA | 2 | 05-21-2021 09:51 PM |
Auto populate a text field based on Content Control Dropdown List | matthias92701 | Word VBA | 2 | 05-02-2019 03:54 PM |
Word VSTO Content Control binding to XML issue | phyrjc | Word | 0 | 03-25-2019 08:56 AM |
Dropdown content control and tables | hrzagi | Word | 1 | 12-17-2017 09:38 PM |
Content Control Dropdown Dependencies | asteinroeder | Word VBA | 5 | 10-28-2015 03:56 PM |