Hi,
I want to break all links in a Word document automatically.
Instead of the slow way below:
- Open a Word file.
- Break all links(see my attachment).
- Click save.
- Close the file.
- Open another file.
- …
Hi,
I want to break all links in a Word document automatically.
Instead of the slow way below:
Hi Doris,
Thanks for your inquiry. You can convert all Hyperlink fields in a Word document to static texts by using the following code snippet:
Document doc = new Document(MyDir + "in.docx");
// Pass the appropriate parameters to convert all Hyperlink fields encountered in the document (including headers and footers) to static text.
FieldsHelper.ConvertFieldsToStaticText(doc, FieldType.FieldHyperlink);
// Save the document with fields transformed to disk.
doc.Save(MyDir + "Out.docx");
You can find the implementation of “FieldsHelper.ConvertFieldsToStaticText” method in the following page:
https://docs.aspose.com/words/net/updating-and-removing-a-field/
Please let me know if I can be of any further assistance.