跳转链接转到HTML至Word转换的页面顶部

时间:2019-06-26 14:38:05

标签: html vb.net visual-studio-2013 ms-word anchor

我们正在Vb.Net中将HTML转换为Word文档,并希望使用跳转链接跳转到Word文档的特定部分。我为此行为使用锚标记。但是,当用户单击链接时,它总是跳到页面顶部。有人遇到过这个问题吗?

跳转链接锚标记- <sup><a href="#popRef1">Comment1</a></sup>

目标锚标记- <a id="popRef1">Comment 1.</a>&nbsp;&nbsp;"The above superscript doesn't get linked to me instead jumps to the top of the document!!!"</p>

这是转换后的word文档中的外观- 上标“ 1”(左侧)应与右侧脚注下的“ 1”链接。

image here

<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body style="font-family:arial;font-size:16px;"><p style="font-size:10px;"></p><p style="color:#000080;font-weight:bold;font-size:18px;">** New Section **</p><p>The below text is used only for testing purpose and this post.</p>

<p>In&nbsp;<a href="https://en.wikipedia.org/wiki/Computing" title="Computing">computing</a>, a&nbsp;<b>hyperlink</b>, or simply a&nbsp;<b>link</b>, is a reference to&nbsp;<a href="https://en.wikipedia.org/wiki/Data_(computing)" title="Data (computing)">data</a>&nbsp;that the reader can follow by clicking or tapping.<sup id="cite_ref-1"><a href="https://en.wikipedia.org/wiki/Hyperlink#cite_note-1">[1]</a></sup>&nbsp;A hyperlink points to a whole document or to a specific element within a document.&nbsp;<a href="https://en.wikipedia.org/wiki/Hypertext" title="Hypertext">Hypertext</a>&nbsp;is text with hyperlinks. The text that is linked from is called&nbsp;<a href="https://en.wikipedia.org/wiki/Anchor_text" title="Anchor text">anchor text</a>. A software system that is used for viewing and creating hypertext is a&nbsp;<i>hypertext system</i>, and to create a hyperlink is&nbsp;<i>to hyperlink</i>&nbsp;(or simply&nbsp;<i>to link</i>). A user following hyperlinks is said to&nbsp;<i>navigate</i>&nbsp;or&nbsp;<i>browse</i>&nbsp;the hypertext.&nbsp;<sup><a href="#popnoteRef1">1</a></sup> <a contenteditable="false" data-track-changes-ignore="ignore" onclick="doPopup(this);"><object><p>This informarion is all used just for testing and this example -</p>

<p>The syntax and appearance of wikilinks may vary.&nbsp;<a href="https://en.wikipedia.org/wiki/Ward_Cunningham" title="Ward Cunningham">Ward Cunningham</a>'s original&nbsp;<a href="https://en.wikipedia.org/wiki/Wiki_software" title="Wiki software">wiki software</a>, the&nbsp;<a href="https://en.wikipedia.org/wiki/WikiWikiWeb" title="WikiWikiWeb">WikiWikiWeb</a>&nbsp;used&nbsp;<a href="https://en.wikipedia.org/wiki/CamelCase" title="CamelCase">CamelCase</a>&nbsp;for this purpose. CamelCase was also used in the early version of&nbsp;<a href="https://en.wikipedia.org/wiki/Wikipedia" title="Wikipedia">Wikipedia</a>&nbsp;and is still used in some wikis, such as&nbsp;<a href="https://en.wikipedia.org/wiki/TiddlyWiki" title="TiddlyWiki">TiddlyWiki</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Trac" title="Trac">Trac</a>, and&nbsp;<a href="https://en.wikipedia.org/wiki/PmWiki" title="PmWiki">PmWiki</a>. A common markup syntax is the use of double square brackets around the term to be wikilinked. For example, the input &quot;[[zebras]]&quot; is converted by wiki software using this markup syntax to a link to a&nbsp;<a href="https://en.wikipedia.org/wiki/Zebras" title="Zebras">zebras</a>&nbsp;article. Hyperlinks used in wikis are commonly classified as follows:</p>

<ul>
	<li><b>Internal wikilinks</b>&nbsp;or&nbsp;<b>intrawiki links</b>&nbsp;lead to pages within the same wiki website.</li>
	<li><b><a href="https://en.wikipedia.org/wiki/Interwiki_links" title="Interwiki links">Interwiki links</a></b>&nbsp;are simplified markup hyperlinks that lead to pages of other wikis that are associated with the first.</li>
	<li><b>External links</b>&nbsp;lead to other webpages (those not covered in the above two cases, wiki or not wiki).</li>
</ul>
</object></a></p>

<p>The document containing a hyperlink is known as its source document. For example, in an online reference work such as&nbsp;<a href="https://en.wikipedia.org/wiki/Wikipedia" title="Wikipedia">Wikipedia</a>, or&nbsp;<a href="https://en.wikipedia.org/wiki/Google" title="Google">Google</a>, many words and terms in the text are hyperlinked to definitions of those terms. Hyperlinks are often used to implement reference&nbsp;<a href="https://en.wikipedia.org/wiki/Mechanism_(engineering)" title="Mechanism (engineering)">mechanisms</a>&nbsp;such as tables of contents,&nbsp;<a href="https://en.wikipedia.org/wiki/Footnotes" title="Footnotes">footnotes</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Bibliographies" title="Bibliographies">bibliographies</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Index_(publishing)" title="Index (publishing)">indexes</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Letter_(message)" title="Letter (message)">letters</a>&nbsp;and&nbsp;<a href="https://en.wikipedia.org/wiki/Glossaries" title="Glossaries">glossaries</a>.&nbsp;<sup><a href="#popnoteRef2">2</a></sup> </p>

<p>In some hypertext hyperlinks can be bidirectional: they can be followed in two directions, so both ends act as&nbsp;<a href="https://en.wikipedia.org/wiki/HTML_element#Anchor" title="HTML element">anchors</a>&nbsp;and as targets. More complex arrangements exist, such as many-to-many links.</p>

<p>The effect of following a hyperlink may vary with the hypertext system and may sometimes depend on the link itself; for instance, on the&nbsp;<a href="https://en.wikipedia.org/wiki/World_Wide_Web" title="World Wide Web">World Wide Web</a>&nbsp;most hyperlinks cause the target document to replace the document being displayed, but some are marked to cause the target document to open in a new window. Another possibility is&nbsp;<a href="https://en.wikipedia.org/wiki/Transclusion" title="Transclusion">transclusion</a>, for which the link target is a document&nbsp;<a href="https://en.wiktionary.org/wiki/fragment" title="wikt:fragment">fragment</a>&nbsp;that replaces the link anchor within the source document. Not only persons browsing the document follow hyperlinks. These hyperlinks may also be followed automatically by programs. A program that traverses the hypertext, following each hyperlink and gathering all the retrieved documents is known as a Web&nbsp;<i>spider</i>&nbsp;or&nbsp;<a href="https://en.wikipedia.org/wiki/Web_crawler" title="Web crawler">crawler</a>.</p>
<hr /><p style="font-weight:bold;"> </p><p style="font-weight:bold;">Footnotes </p><br /><a id="popnoteRef1">1.</a>&nbsp;&nbsp;This informarion is all used just for testing and this example -</p>

<p>The syntax and appearance of wikilinks may vary.&nbsp;<a href="https://en.wikipedia.org/wiki/Ward_Cunningham" title="Ward Cunningham">Ward Cunningham</a>'s original&nbsp;<a href="https://en.wikipedia.org/wiki/Wiki_software" title="Wiki software">wiki software</a>, the&nbsp;<a href="https://en.wikipedia.org/wiki/WikiWikiWeb" title="WikiWikiWeb">WikiWikiWeb</a>&nbsp;used&nbsp;<a href="https://en.wikipedia.org/wiki/CamelCase" title="CamelCase">CamelCase</a>&nbsp;for this purpose. CamelCase was also used in the early version of&nbsp;<a href="https://en.wikipedia.org/wiki/Wikipedia" title="Wikipedia">Wikipedia</a>&nbsp;and is still used in some wikis, such as&nbsp;<a href="https://en.wikipedia.org/wiki/TiddlyWiki" title="TiddlyWiki">TiddlyWiki</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Trac" title="Trac">Trac</a>, and&nbsp;<a href="https://en.wikipedia.org/wiki/PmWiki" title="PmWiki">PmWiki</a>. A common markup syntax is the use of double square brackets around the term to be wikilinked. For example, the input &quot;[[zebras]]&quot; is converted by wiki software using this markup syntax to a link to a&nbsp;<a href="https://en.wikipedia.org/wiki/Zebras" title="Zebras">zebras</a>&nbsp;article. Hyperlinks used in wikis are commonly classified as follows:</p>

<ul>
	<li><b>Internal wikilinks</b>&nbsp;or&nbsp;<b>intrawiki links</b>&nbsp;lead to pages within the same wiki website.</li>
	<li><b><a href="https://en.wikipedia.org/wiki/Interwiki_links" title="Interwiki links">Interwiki links</a></b>&nbsp;are simplified markup hyperlinks that lead to pages of other wikis that are associated with the first.</li>
	<li><b>External links</b>&nbsp;lead to other webpages (those not covered in the above two cases, wiki or not wiki).</li>
</ul>
<br /><a id="popnoteRef2">2.</a>&nbsp;&nbsp;This information is all used just for testing and this example -</p>

<p>The syntax and appearance of wikilinks may vary.&nbsp;<a href="https://en.wikipedia.org/wiki/Ward_Cunningham" title="Ward Cunningham">Ward Cunningham</a>'s original&nbsp;<a href="https://en.wikipedia.org/wiki/Wiki_software" title="Wiki software">wiki software</a>, the&nbsp;<a href="https://en.wikipedia.org/wiki/WikiWikiWeb" title="WikiWikiWeb">WikiWikiWeb</a>&nbsp;used&nbsp;<a href="https://en.wikipedia.org/wiki/CamelCase" title="CamelCase">CamelCase</a>&nbsp;for this purpose. CamelCase was also used in the early version of&nbsp;<a href="https://en.wikipedia.org/wiki/Wikipedia" title="Wikipedia">Wikipedia</a>&nbsp;and is still used in some wikis, such as&nbsp;<a href="https://en.wikipedia.org/wiki/TiddlyWiki" title="TiddlyWiki">TiddlyWiki</a>,&nbsp;<a href="https://en.wikipedia.org/wiki/Trac" title="Trac">Trac</a>, and&nbsp;<a href="https://en.wikipedia.org/wiki/PmWiki" title="PmWiki">PmWiki</a>. A common markup syntax is the use of double square brackets around the term to be wikilinked. For example, the input &quot;[[zebras]]&quot; is converted by wiki software using this markup syntax to a link to a&nbsp;<a href="https://en.wikipedia.org/wiki/Zebras" title="Zebras">zebras</a>&nbsp;article. Hyperlinks used in wikis are commonly classified as follows:</p>

<ul>
	<li><b>Internal wikilinks</b>&nbsp;or&nbsp;<b>intrawiki links</b>&nbsp;lead to pages within the same wiki website.</li>
	<li><b><a href="https://en.wikipedia.org/wiki/Interwiki_links" title="Interwiki links">Interwiki links</a></b>&nbsp;are simplified markup hyperlinks that lead to pages of other wikis that are associated with the first.</li>
	<li><b>External links</b>&nbsp;lead to other webpages (those not covered in the above two cases, wiki or not wiki).</li>
</ul>
<br /></body></html>

0 个答案:

没有答案