Hi Alex,
Thanks for the additional information. I tested the scenario and have managed to reproduce the same problem on my side. We will improve the code mentioned in
this article in future, I have logged this issue in our issue tracking system as
WORDSNET-8656. We apologize for your inconvenience.
To workaround this problem, please try run the following code snippet:
Document doc = new
Document(@“C:\Temp\RenderingTest_OhneCustomXml.doc”);
foreach (FormField
field in doc.Range.FormFields)
{
if (field.Type == FieldType.FieldFormDropDown)
{
Run run = new Run(doc, field.Result);
Node currentNode = field;
while (currentNode != null
&& currentNode.NodeType != NodeType.FieldStart)
currentNode = currentNode.PreviousSibling;
field.ParentParagraph.InsertBefore(run, currentNode);
field.Remove();
}
}
doc.Save(@"C:\Temp\out.mhtml");
I hope, this helps.
Best regards,