Aspose.Words.FormField - How to find Runs?

Is it possible to find all paragraphs and runs inside the FormField?
(I need to find all formatted text inside like bold, italic,…)

“formField.Result” returns me simple text.

If I use:
foreach (Aspose.Words.Run run in wordParagraph.Runs) {
retFormat += GetsFormatTags(run,true);
retVal += run.Text.Trim();
}

This return me “FORMTEXTmytext…” and for dropdown form field only “FORMDROPDOWN” not value.
How can I skip these tags?




Please note that formfield definition consists of several nodes and FormField node is only one of them. Basically the order of nodes in formfield definition is as follows:

(FieldStart)
(BookmarkStart)
(Run: Run.Text = FORMTEXT) - FormField code text
(FormField)
(FieldSeparator)
(Run) - FormField result text
(FieldEnd)

You can see it visually using our DocumentExplorer source code demo.

What interests you is located between FieldSeparator and FieldEnd nodes. You can use the following code to iterate through FormField result text runs:

Node node = formField.NextSibling;

while (node.NodeType != NodeType.FieldEnd)

{

if (node.NodeType == NodeType.Run)

{

Run run = (Run)node;

if (run.Font.Bold)

{

// Do necessary actions here.

}

}

node = node.NextSibling;

}

Hope this helps,

Thanks.

parsing one document I founded that in one paragraph
I had two runs, in first one, run.text was “FOR”, and in second one was “MTEXT”. This is strage for me. Actually this is “FORMTEXT” tag divided into the two runs.