Hi
Thanks for
your request. You can try to use the following code.
Document doc = new Document(@"236_96982_gavinsinai\in.doc");
NodeCollection starts = doc.GetChildNodes(NodeType.FieldStart,
true);
string fieldCode = string.Empty;
string fieldValue = string.Empty;
FieldStart fieldStart = null;
FieldSeparator fieldSeparator = null;
FieldEnd fieldEnd = null;
foreach (FieldStart start in starts)
{
// get field start
fieldStart =
start;
Node node = start.NextSibling;
// get field code
while (node.NodeType == NodeType.Run)
{
fieldCode
+= (node as Run).Text;
node =
node.NextSibling;
}
if (node.NodeType == NodeType.FieldSeparator)
{
// get field separator
fieldSeparator = (FieldSeparator)node;
node =
node.NextSibling;
// get field value
while (node.NodeType == NodeType.Run)
{
fieldValue += (node as Run).Text;
node
= node.NextSibling;
}
}
// get field end
fieldEnd = (FieldEnd)node;
}
I hope that
it will help you.
Best
regards.