Page 1 of 1

Spaces in Hyperlinks

PostPosted: Fri Nov 20, 2015 6:15 am
by micealg
Hey all,

Just wanted to drop in an tell you to be weary of spaces in your hyperlinks. Especially in Word 2007.

I was getting the following message:
Code: Select all
The file blah.docx cannot be opened because there are problems with the contents.
The file is corrupt and cannot be opened.
Word found unreadable content in blah.docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes.

Typically you specify hyperlink locations as a Relationship target like so:
Code: Select all
Relationship relationship = factory.createRelationship();

Office 2007 will report a corrupt file (although it repairs successfully), if there are spaces in the URL. Simply delete the whitespace.
Code: Select all

Happy coding all!

Re: Spaces in Hyperlinks

PostPosted: Fri Nov 20, 2015 6:52 am
by jason
or URL encode?

thanks for the heads up :-)