You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DocProperty.cs 887B

12345678910111213141516171819202122232425
  1. using System.Xml.Linq;
  2. using System.Text.RegularExpressions;
  3. namespace Novacode
  4. {
  5. /// <summary>
  6. /// Represents a field of type document property. This field displays the value stored in a custom property.
  7. /// </summary>
  8. public class DocProperty: DocXElement
  9. {
  10. internal Regex extractName = new Regex(@"DOCPROPERTY (?<name>.*) ");
  11. private string name;
  12. /// <summary>
  13. /// The custom property to display.
  14. /// </summary>
  15. public string Name { get { return name; } }
  16. internal DocProperty(DocX document, XElement xml):base(document, xml)
  17. {
  18. string instr = Xml.Attribute(XName.Get("instr", "http://schemas.openxmlformats.org/wordprocessingml/2006/main")).Value;
  19. this.name = extractName.Match(instr.Trim()).Groups["name"].Value;
  20. }
  21. }
  22. }