[MSWordUtils] Insert Hyperlink in Word Document
Forge component by Stuart Harris
Application Type
Traditional Web

If I try to create a Hyperlink in a Word Document

 I get this

The Link is OK, but the style - color blue with underline is lost.


The style attributes are ok, if I create a text without HyperlinkUrl 

I get a text with that style

If I create a word document with two Hyperlinks like this

I get this error messeage from MS Word by opening the document

"Word found not readable content in ...doc. Do you want to recover the content. Click to Yes, if you trust the document source"

If I click Yes, Word open the document but if I click "activate ..." I get the message that this document could not opend by Microsoft Word and if I want to download a converter from Office.com to open the file.

I have this problem in our company outsystems development environment and in my private outsystems development environment.

Word is from Office 365, MSWordUtils is the actuell version from forge, the Outsystems Service Studio is also the actuell client.


Regards Martin

Hi Martin,

This looks to be a combination of defects in the forge component and in the underlying library.  I am not able to make changes to the underlying library, but will investigate the formatting for hyperlinks.

The underlying library is quite limited, so if you need full formatting (I know you are not actually asking for much!), this might not be the most reliable component for you.

I hope this helps.

Kind regards,

Stuart


Hi Martin,

I have investigated and I can confirm that formatting does not work when inserting hyperlinks in the underlying library.

I know this is not what you were hoping for, but I hope it saves you wasting time.

Kind regards,

Stuart.

That the formatting does not work when inserting hyperlinks is one issue (I could live with that). 

If you create a hyperlink, in the document.xml a hyperlink tag would be created with a r:id as reference to the document.xml.rels file where the urls are stored. The framework did not set this r:id=. So if you have one hyperlink in the document, Word opens because it use the one hyperlink that exist to that hyperlink tag. If you have more than one hyperlink in the document, word could not fix that and open the errormessage.

Also I see that the licence of the underlyinig "open source" library is not for commercial use.

Do you know a .net library (with or without buying a license) which you could create a word document based on a template by inserting paragraphs (and not replacement of bookmarks with other text) which you could use to create an extension like the docx extention you made.

I like the MSWordUtils component, It is easy to use and you could create a document from the scratch. I also write an action to convert HTML from a CKEditor (Color, Font, Fontsize, Bold, italic, underline, ...) to an mswordparagraph to insert but hyperlinks are inportant for my internal customers.


Other solutions always work with replace bookmarks and use the format from the bookmark. 

Hi Martin,

The version of the library in this component is allowed for commercial use, but that is why it cannot be upgraded.  After the version used in the component the library changed its license to not for commercial use.

Unfortunately, the inability to upgrade the library significantly limits my ability to fix bugs when the root cause is in the underlying library.

The inability to insert multiple hyperlinks makes the hyperlink functionality almost useless, I think its best to deprecate it.  Strangely, I was able to create a document that did not error when I opened it.  However, I used the same url for both hyperlinks.

There is the NPOA library but that does not seem to work well on the latest versions of MSWord.  That was the reason I created this component in the first place.

I have found that Aspose.Words, which is a paid library, provides more stable functionality.

I hope this helps.

Kind regards,

Stuart

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.