如何在FlowDocument中启用超链接?

时间:2022-02-03 07:25:04

I have .htm files in my database, which are converted to FlowDocument and placed into FlowDocumentReader for viewing. The .htm files have hyperlinks inside them: 1)internal(to other fragments of document) 2)external(to other .htm documents in my database by name of the document). After converting and placing in FlowDocumentReader the hyperlinks are blue-colored and underlined, but there is no reaction when I click on them. The simplified .htm code which contains mentioned above hyperlinks is below:

我的数据库中有.htm文件,这些文件被转换为FlowDocument并放入FlowDocumentReader进行查看。 .htm文件中包含超链接:1)内部(对于文档的其他片段)2)外部(对于我的数据库中的其他.htm文档,按文档名称)。转换并放入FlowDocumentReader后,超链接为蓝色并带下划线,但点击它们时没有任何反应。包含上述超链接的简化.htm代码如下:

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="81.files/filelist.xml">
<title>Hadasd</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>user</o:LastAuthor>
  <o:Revision>10</o:Revision>
  <o:TotalTime>118</o:TotalTime>
  <o:Created>2003-08-06T03:40:00Z</o:Created>
  <o:LastSaved>2006-11-03T10:34:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>20736</o:Words>
  <o:Characters>118199</o:Characters>
  <o:Company>NPC OGRT</o:Company>
  <o:Lines>984</o:Lines>
  <o:Paragraphs>277</o:Paragraphs>
  <o:CharactersWithSpaces>138658</o:CharactersWithSpaces>
  <o:Version>11.5606</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:Zoom>90</w:Zoom>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
    {font-family:"MS Mincho";
    panose-1:2 2 6 9 4 2 5 8 3 4;
    mso-font-alt:"\FF2D\FF33 \660E\671D";
    mso-font-charset:128;
    mso-generic-font-family:roman;
    mso-font-format:other;
    mso-font-pitch:fixed;
    mso-font-signature:1 134676480 16 0 131072 0;}
@font-face
    {font-family:"\@MS Mincho";
    panose-1:0 0 0 0 0 0 0 0 0 0;
    mso-font-charset:128;
    mso-generic-font-family:roman;
    mso-font-format:other;
    mso-font-pitch:fixed;
    mso-font-signature:1 134676480 16 0 131072 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
    {mso-style-parent:"";
    margin:0cm;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:12.0pt;
    font-family:"Times New Roman";
    mso-fareast-font-family:"Times New Roman";}
h1
    {mso-style-next:Обычный;
    margin-top:12.0pt;
    margin-right:0cm;
    margin-bottom:3.0pt;
    margin-left:0cm;
    mso-pagination:widow-orphan;
    page-break-after:avoid;
    mso-outline-level:1;
    font-size:16.0pt;
    font-family:Arial;
    mso-font-kerning:16.0pt;}
a:link, span.MsoHyperlink
    {color:blue;
    text-decoration:underline;
    text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
    {color:purple;
    text-decoration:underline;
    text-underline:single;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
    {margin:0cm;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Courier New";
    mso-fareast-font-family:"Times New Roman";}
@page Section1
    {size:595.3pt 841.9pt;
    margin:2.0cm 57.6pt 2.0cm 57.6pt;
    mso-header-margin:35.4pt;
    mso-footer-margin:35.4pt;
    mso-paper-source:0;}
div.Section1
    {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
    {
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=RU link=blue vlink=purple style='tab-interval:35.4pt'>

<div class=Section1>



<p class=MsoPlainText style='text-align:justify'><span style='font-size:12.0pt;
font-family:Arial;mso-fareast-font-family:"MS Mincho"'><o:p>&nbsp;</o:p></span></p>


<p class=MsoPlainText style='text-align:justify;text-indent:27.0pt'><span
style='font-size:12.0pt;font-family:Arial;mso-fareast-font-family:"MS Mincho"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText style='text-align:justify;text-indent:27.0pt'><span
style='font-size:12.0pt;font-family:Arial;mso-fareast-font-family:"MS Mincho"'>dfasfdsafsdfasdfasdfasdfasdf<span style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>

</div>

</body>

</html>

And the generated code for FlowDocument placed in FlowDocumentReader looks like:

并且在FlowDocumentReader中放置的FlowDocument生成的代码如下所示:

<?xml version="1.0" encoding="utf-8"?>
<FlowDocument xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Paragraph TextAlignment="center">
    <Span FontWeight="bold">
      <Run FontFamily="arial" FontSize="12.0pt">dasdasdasdas</Run>
    </Span>
  </Paragraph>
  <Paragraph Margin="26.95pt,2.0pt,0,0">
    <Run FontFamily="arial" FontSize="12.0pt"> </Run>
  </Paragraph>
  <Paragraph FontSize="16.0pt" FontFamily="arial" Margin="26.95pt,2.0pt,0,0">
    <Span FontWeight="normal" FontSize="12.0pt">

  <Paragraph TextAlignment="justify" TextIndent="27.0pt">
    <Span FontFamily="arial" FontSize="12.0pt">13 ноября 1998 года<Run>  </Run></Span>
  </Paragraph>
</FlowDocument>

What should I do in order to "awake" the hyperlinks within my FlowDocumentReader? Any help is appreciated! Thank you in advance!

我应该怎么做才能“唤醒”我的FlowDocumentReader中的超链接?任何帮助表示赞赏!先谢谢你!

1 个解决方案

#1


0  

you might try the answer on these links:

你可以试试这些链接上的答案:

http://social.msdn.microsoft.com/Forums/da-DK/wpf/thread/e805c8e2-1905-459d-86b4-b14a7d7456b9

or the * answer: How can I get a FlowDocument Hyperlink to launch browser and go to URL in a WPF app?

或*答案:如何让FlowDocument超链接启动浏览器并转到WPF应用程序中的URL?

#1


0  

you might try the answer on these links:

你可以试试这些链接上的答案:

http://social.msdn.microsoft.com/Forums/da-DK/wpf/thread/e805c8e2-1905-459d-86b4-b14a7d7456b9

or the * answer: How can I get a FlowDocument Hyperlink to launch browser and go to URL in a WPF app?

或*答案:如何让FlowDocument超链接启动浏览器并转到WPF应用程序中的URL?