Using normal DocumentData logic, we are able to fetch data from XML parts and output data to XML parts.
Fetching data
You can use the Document XML Viewer to inspect and edit XML parts in a document. Using the Doc.CustomXml
prefix, you can insert through direct bindings in the document or define variables in DocumentData.
Example of usage
{"SkabelonDesign":{"type":"text","binding":"Doc.CustomXml._dlc_DocIdUrl.Description"}}
Open the document with 7-zip and select customXml folder:
<documentManagement>
...
<_dlc_DocIdUrl xmlns="1234-1234-1234-1234-1234">
<Url>https://clientNAme.sharepoint.com/_layouts/15/DocIdRedir.aspx?ID=1234-456789-123</Url>
<Description>1234-456789-123</Description>
</_dlc_DocIdUrl>
</documentManagement>
CMD for output
The following command can be used to write data from a DocumentData variable to a custom XML part:
<cmd case="SkabelonDesign.DocumentData:UpdateCustomXml"/>
Parameters
variableName
Define the variable name - this is the binding to the DocumentData variable holding the data to be written. This parameter is required.
xpath
Define the location of the XML part using the XPath syntax.
Example of usage
The following example will insert the value of the document property called test into the Line1 element of the documentManagement XML part.
<button label="Update CustomXML"> <cmd case="SkabelonDesign.DocumentData:EnablePendingChanges"/> <cmd case="SkabelonDesign.DocumentData:DefineData" variableName="test"> <Doc.Prop.Test/>
</cmd> <cmd case="SkabelonDesign.DocumentData:UpdateCustomXml" variableName="test" xpath="(//*[local-name() = 'documentManagement']/*[local-name() = 'Line1'])"/> </button>
Comments
0 comments
Article is closed for comments.