Page 1 of 1

binding text which contains hyperlinks

PostPosted: Tue Aug 30, 2011 1:37 am
by jason
With if a content control is bound to text which contains http://, docx4j's BindingHandler will make a w:hyperlink out of that bit.

sample-docs/word/databinding/hyperlink-binding-test.docx can be used to test this functionality.

There's a catch though.

Word 2007 can't open the result, unless you remove the w:databinding and w:text elements from the w:sdtPr.

If you use the RemovalHandler to remove the content controls entirely, this issue won't arise.

But if you don't, you risk a broken docx.

What shall we do? I'm favouring performing the hyperlink handling, only if you explicitly enable it. And if you enable it, you should use the Removal Handler, or take other appropriate action. Word itself doesn't create hyperlinks when binding, so that's another reason for making this an optional extra.

cheers .. Jason