[]
        
(Showing Draft Content)

GrapeCity.Documents.Word.XmlMapping

Class XmlMapping

Namespace
GrapeCity.Documents.Word
Assembly
GcDocs.Word.dll

Specifies the information which shall be used to establish a mapping between a content control and an XML node stored within a Custom XML Data part in the document.

public class XmlMapping
Inheritance
object
XmlMapping
Inherited Members
object.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
object.MemberwiseClone()

Properties

CustomXmlPartId

Gets the identifier of the CustomXmlPart which shall be used to evaluate the given XPath property. If specified, then the XPath expression specified in the XPath property shall only be evaluated against the custom XML part whose properties part has a matching identifier. If no custom XML part exists with a matching identifier, then the XML mapping shall not be connected. If value is null or empty, then the XPath expression shall be evaluated against each custom XML data part in turn until the given XPath expression is resolved to an XML node.

public string CustomXmlPartId { get; }

Property Value

string

IsMapped

Gets whether a mapping between a content control and an XML node stored within a Custom XML Data part in the document is established successfully.

public bool IsMapped { get; }

Property Value

bool

PrefixMappings

Gets the set of prefix mappings which shall be used to interpret the XPath expression specified on the XPath property when the XPath expression is evaluated against the custom XML data parts in the document. This property value shall be specified using the following syntax: xmlns:prefix='namespace', where prefix is the namespace prefix to be mapped, and namespace is the namespace to be mapped to the current prefix. Each prefix mapping shall be delimited by one or more whitespace characters.

public string PrefixMappings { get; }

Property Value

string

SupportRichTextControl

Gets whether the xml mapping supports a content control with RichText type. if false (default), the rich text content controls are not supported, so no data stored in the XML node is mapped for this kind of controls. if true, the data stored in the XML node will be an escaped string comprised of a flattened document representing the formatted data in the content control range.

public bool SupportRichTextControl { get; }

Property Value

bool

XPath

Gets the XPath expression which shall be evaluated to find the custom XML node which is mapped to the content control. This XPath expression shall be specified using the syntax defined in the XML Path Language (XPath) Version 1.0 specification.

public string XPath { get; }

Property Value

string

Methods

Clear()

Removes mapping between a content control and an XML node stored within a Custom XML Data part in the document.

public void Clear()

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

SetMapping(string, string, string, bool)

Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.

public string SetMapping(string xPath, string prefixMappings = null, string customXmlPartId = null, bool supportRichTextControl = false)

Parameters

xPath string

The XPath expression which shall be evaluated to find the custom XML node which is mapped to the content control.

prefixMappings string

The set of prefix mappings which shall be used to interpret the XPath expression when the XPath expression is evaluated against the custom XML data parts in the document.

customXmlPartId string

The CustomXmlPart identifier which shall be used to evaluate the given XPath expression.

supportRichTextControl bool

Whether the xml mapping supports a content control with RichText type.

Returns

string

Inner xml of the mapped node stored within a XmlDocument in the document.

SetMapping(XmlNode, string, bool)

Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.

public string SetMapping(XmlNode node, string customXmlPartId = null, bool supportRichTextControl = false)

Parameters

node System.Xml.XmlNode

The System.Xml.XmlNode which is mapped to the content control.

customXmlPartId string

The CustomXmlPart identifier which shall be used to evaluate the given XPath expression.

supportRichTextControl bool

Whether the xml mapping supports a content control with RichText type.

Returns

string

Inner xml of the mapped node stored within a XmlDocument in the document.

SetMapping<T>(Expression<Func<T>>, bool)

Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.

public string SetMapping<T>(Expression<Func<T>> builtInDocumentProperty, bool supportRichTextControl = false)

Parameters

builtInDocumentProperty System.Linq.Expressions.Expression<TDelegate><Func<T>>

The expression of a property from the BuiltInPropertyCollection which is mapped to the content control. Use it like this: SetMapping(() => document.Settings.BuiltInProperties.Author);

supportRichTextControl bool

Whether the xml mapping supports a content control with RichText type.

Returns

string

Inner xml of the mapped node stored within a XmlDocument in the document.

Type Parameters

T

TryGetValue(out string)

Tries get inner xml of the mapped node stored within a XmlDocument in the document.

public bool TryGetValue(out string value)

Parameters

value string

Returns inner xml of the mapped node stored within a XmlDocument in the document if mapping is established successfully, otherwise null.

Returns

bool

true if mapping is established successfully, otherwise false.

TrySetValue(string)

Tries set inner xml to the mapped node stored within a XmlDocument in the document.

public bool TrySetValue(string value)

Parameters

value string

The new inner xml for the mapped node stored within a XmlDocument in the document.

Returns

bool

true if new inner xml was set successfully, otherwise false.