-
Notifications
You must be signed in to change notification settings - Fork 0
/
DocProperty.vb
28 lines (25 loc) · 1001 Bytes
/
DocProperty.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Imports 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
Inherits DocXElement
Friend extractName As New Regex("DOCPROPERTY (?<name>.*) ")
'INSTANT VB NOTE: The variable name was renamed since Visual Basic does not allow class members with the same name:
Private name_Renamed As String
''' <summary>
''' The custom property to display.
''' </summary>
Public ReadOnly Property Name() As String
Get
Return name_Renamed
End Get
End Property
Friend Sub New(ByVal document As DocX, ByVal xml As XElement)
MyBase.New(document, xml)
Dim instr As String = Me.Xml.Attribute(XName.Get("instr", "http://schemas.openxmlformats.org/wordprocessingml/2006/main")).Value
Me.name_Renamed = extractName.Match(instr.Trim()).Groups("name").Value
End Sub
End Class
End Namespace