using System.Xml.Linq; using System.Text.RegularExpressions; namespace Novacode { /// /// Represents a field of type document property. This field displays the value stored in a custom property. /// public class DocProperty: DocXElement { internal Regex extractName = new Regex(@"DOCPROPERTY (?.*) "); private string name; /// /// The custom property to display. /// public string Name { get { return name; } } internal DocProperty(DocX document, XElement xml):base(document, xml) { string instr = Xml.Attribute(XName.Get("instr", "http://schemas.openxmlformats.org/wordprocessingml/2006/main")).Value; this.name = extractName.Match(instr.Trim()).Groups["name"].Value; } } }