Free Support Forum - aspose.com

Working with Hyperlinks in Word

I need to convert from Word-XML-Word.

What is the best way to represent fields, well not all fields, but Hyperlinks and dates for now in xml.

I have extended the DocumentVisitor and am overriding the visitRun(Run run) method and the visitFieldStart(FieldStart fieldstart). The visitRun method visit's runs AND hyperlinks then prints HYPERLINK "http://www.google.com". Then i'm using the visitFieldStart method to visit fields which i can create a Hyperlink object and create the following xml.

Google

How can I avoid having the visitRun method not visit Fields OR can you suggest another way to do this ?

Michael



Hi

Thanks for your request. The field is represented as the following string fieldcodefieldvalue. Where fieldcode and fieldvalue are Runs, that’s why VisitRun method visits runs and hyperlinks. You should check is Run fieldcode or not and then visit it. (If Run is placed between and then your visitRun method will not visit this Run)

Best regards.