-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocProperty.cs
More file actions
24 lines (21 loc) · 812 Bytes
/
DocProperty.cs
File metadata and controls
24 lines (21 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System.Xml.Linq;
using System.Text.RegularExpressions;
namespace Novacode
{
/// <summary>
/// Represents a field of type document property. This field displays the value stored in a custom property.
/// </summary>
public class DocProperty: DocXElement
{
internal Regex extractName = new Regex(@"DOCPROPERTY (?<name>.*) ");
/// <summary>
/// The custom property to display.
/// </summary>
public string Name { get; }
internal DocProperty(DocX document, XElement xml):base(document, xml)
{
string instr = Xml.Attribute(XName.Get("instr", "http://schemas.openxmlformats.org/wordprocessingml/2006/main")).Value;
Name = extractName.Match(instr.Trim()).Groups["name"].Value;
}
}
}