Skip to content

Hyperlinks

Olivier Nizet edited this page Jun 29, 2024 · 2 revisions

External Links

Only absolute or relative Uri are processed. Javascript link are ignored.

These URI are valid

Anchors

Anchors are supported and you can turn off this option (enabled by default).

converter.ExcludeLinkAnchor = true;

There is a predefined anchor inside Word that refers to the top of the document : <a href="#_top">. This anchor is always respected despite the status of ExcludeLinkAnchor.

<h1>Table of Contents</h1>
<ul>
   <li><a href=""#anchor1"">Heading 1</a></li>
   <li><a href=""#anchor2"">Heading 2</a></li>
</ul>

<h1 id=""anchor1"">Heading 1</h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dictum leo quis ipsum tempor nec ultrices sapien elementum.

<h1 id=""anchor2"">Heading 2</h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dictum leo quis ipsum tempor nec ultrices sapien elementum.

<div style=""text-align: right"">
   <li><a href=""#_top"">Back to ToC</a></li>
</div>

internal anchors

Embed an image inside an anchor

<a href="https://github.com/onizet/html2openxml">HtmlToOpenXml</a>
 <br><br>
<a href="http://www.wikipedia.org">
    <img alt="Wikipedia, the Free Encyclopedia" src="wikipedia.png" />
</a>

image with link