Unlinking fields except form fields

I would like to know the logic being used by the Document.UnlinkFields() method.

When I use this, I get exactly the result I want except that I do not want FieldFormxxx fields unlinked.

If I enumerate and unlink all fields except the field types I want left, I do not get the same result (particularly footers resulting from if fileds are removed). So there must be something around the order of removal or some other magic I am not aware of.

Can you help?

@ptoit

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.