Spire.Doc for .NET是一款专门对 Word 文档进行操作的 .NET 类库。在于帮助开发人员无需安装 Microsoft Word情况下,轻松快捷高效地创建、编辑、转换和打印 Microsoft Word 文档。拥有近10年专业开发经验Spire系列办公文档开发工具,专注于创建、编辑、转换和打印Word/PDF/Excel等格式文件处理,小巧便捷。

Word超链接可以引导用户获取内容的其他相关信息。它可以是电子邮件地址、网站链接甚至其他文件。插入超链接时,用户可以添加指定文本或直接输入链接地址。

Silverlight 的Spire.Doc 是使用 Silverlight操作 Word 文档的强大组件,使用户能够使用 Silverlight 在 Word 中插入超链接。本指南将展示在 Silverlight 中实现插入单词超链接的方法。用户可以直接调用Spire.Doc为Silverlight提供的paragraph.AppendHyperlink(link string, text string, hyperlink type)方法在Word中插入超链接。

下载 Silverlight 的 Spire.Doc。创建 Silverlight 应用程序。在 MainPage.xaml 中添加一个按钮,然后将其加倍以使用以下代码插入超链接。

以下屏幕截图演示了在 Silverlight 中插入 Word 的超链接后的结果。超链接位于图片底部。

示例代码:

【C#】

using System;
using System.Windows;
using System.Windows.Controls;
using System.IO;
using System.Reflection;
using Spire.Doc;
using Spire.Doc.Documents;namespace InsertHyperlink
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}private void button1_Click(object sender, RoutedEventArgs e)
{
//Declare SaveFileDialog
SaveFileDialog save = new SaveFileDialog();
save.Filter = "Word Document(*.docx)|*.docx";//Load Document
Document document = new Document();
Assembly assembly = this.GetType().Assembly;
foreach (String name in assembly.GetManifestResourceNames())
{
if (name.EndsWith("Spire.Doc for Silverlight.docx"))
{
using (Stream docStream = assembly.GetManifestResourceStream(name))
{
document = new Document(docStream, FileFormat.Docx);
}
}
}//Add Hyperlink
Section section = document.Sections[0];
Paragraph LinkPara = section.AddParagraph();
LinkPara.AppendHyperlink("http://www.e-iceblue.com/Introduce/word-for-silverlight-introduce.html", "Learn More about Spire.Doc for Siverlight", HyperlinkType.WebLink);//Set Paragrah Style
ParagraphStyle style = new ParagraphStyle(document);
style.Name = "LinkStyle";
style.CharacterFormat.FontName = "Britannic Bold";
style.CharacterFormat.FontSize = 13;
style.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple;
style.ParagraphFormat.LineSpacing = 15F;
document.Styles.Add(style);
LinkPara.ApplyStyle(style.Name);//Save Document
bool? result = save.ShowDialog();
if (result.HasValue && result.Value)
{
using (Stream stream = save.OpenFile())
{
document.SaveToStream(stream, FileFormat.Docx);
}
}
}
}
}

[VB.NET]

Imports System.IO
Imports System.Reflection
Imports System.Drawing
Imports Spire.Doc
Imports Spire.Doc.DocumentsPartial Public Class MainPage
Inherits UserControlPublic Sub New()
InitializeComponent()
End SubPrivate Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
'Declare SaveFileDialog
Dim save As New SaveFileDialog()
save.Filter = "Word Document(*.docx)|*.docx"'Load Document
Dim document As New Document()
Dim [assembly] As System.Reflection.Assembly = Me.GetType().Assembly
For Each name As String In [assembly].GetManifestResourceNames()
If name.EndsWith("Spire.Doc for Silverlight.docx") Then
Using docStream As Stream = [assembly].GetManifestResourceStream(name)
document = New Document(docStream, FileFormat.Docx)
End Using
End If
Next name'Add Hyperlink
Dim section As Section = document.Sections(0)
Dim LinkPara As Paragraph = section.AddParagraph()
LinkPara.AppendHyperlink("http://www.e-iceblue.com/Introduce/word-for-silverlight-introduce.html", "Learn More about Spire.Doc for Siverlight", HyperlinkType.WebLink)'Set Paragrah Style
Dim style As New ParagraphStyle(document)
style.Name = "LinkStyle"
style.CharacterFormat.FontName = "Britannic Bold"
style.CharacterFormat.FontSize = 13
style.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple
style.ParagraphFormat.LineSpacing = 15.0F
document.Styles.Add(style)
LinkPara.ApplyStyle(style.Name)'Save Document
Dim result? As Boolean = save.ShowDialog()
If result.HasValue AndAlso result.Value Then
Using stream As Stream = save.OpenFile()
document.SaveToStream(stream, FileFormat.Docx)
End Using
End If
End Sub
End Class

以上便是如何在C#中旋转word文档上的形状,如果您有其他问题也可以继续浏览本系列文章,获取相关教程,你还可以给我留言或者加入我们的官方技术交流群。

Word控件Spire.Doc 【超链接】教程(2):在 Silverlight 中插入 Word 超链接相关推荐

  1. Word控件Spire.Doc 转换教程(十二):如何将 Word 转换为 EPub、XPS、Emf

    本文将介绍一种通过名为 Spire.Doc 的强大且独立的Word .NET 组件将 Word 转换为 EPub.XPS.Emf的简单方法,无需在机器上安装 Microsoft Word.它还支持将 ...

  2. Word控件Spire.Doc 转换教程(二十八):将 Word 转换为 PCL

    PCL 文件是以打印机命令语言(通常称为 PCL)页面描述语言创建的数字打印文档.从v7.1.19 开始,Spire.Doc 支持将 word 文档转换为 PCL.PCL文件的标准有很多种:这里的 P ...

  3. Word控件Spire.Doc 转换教程(十三):在word文档和HTML中嵌入图像支持

    将 Word 文档转换为 HTML 很流行,并被程序员和开发人员广泛使用.借助Spire.Doc for .NET这个专业的word组件,无需安装MS Word,开发者只需两行C#关键代码即可将wor ...

  4. Word控件Spire.Doc 转换教程(二十三):保留或禁用从 Word 到 PDF 转换的超链接

    超链接为读者提供了更多的附加信息,它被广泛用于我们的 word 文档.Spire.Doc 具有强大的超链接文字元素操作功能.开发者可以在word文档中添加.修改和删除超链接.Spire.Doc for ...

  5. Word控件Spire.Doc 转换教程(十八): 将 RTF 转换为图像并重置图像分辨率

    Spire.Doc具有在 C# 和 VB.NET 中操作 RTF 文件格式的强大能力.通过使用 Spire.Doc,开发人员可以将 RTF 转换为 PDF.HTML和 .doc..docx 格式的 w ...

  6. Word控件Spire.Doc 转换教程(十一):如何将 HTML 转换为图像

    Spire.Doc 可以帮助用户使用 C#/VB.NET 将HTML 转换为 Image.该解决方案使用户可以随时随地通过手机.MP4播放器.PSP.iPad.iTouch等便携式设备阅读HTML.按 ...

  7. Word控件Spire.Doc 转换教程(七):如何将 Word 转换为 RTF

    为什么要将 Word 转换为 RTF? 自 1990 年代以来,Microsoft 开始为其一系列专有的文字处理格式使用 .doc 扩展名.Doc 格式通常与 Microsoft Office 应用程 ...

  8. Word控件Spire.Doc 转换教程(六):如何将 XML 转换为 Word

    为什么使用 C#/VB.NET 将 Office OpenXML 转换为 Word? 作为一种出色的编程语言,Office OpenXML 在其自然形式下很难导航和访问.将文件从 Office Ope ...

  9. Word控件Spire.Doc 转换教程(二十五):在 C#、VB.NET 中将 ODT 转换为 DOC

    具有 .ODT 文件扩展名的文件是 OpenDocument 文本文档文件.这些文件通常由免费的 OpenOffice Writer 文字处理器程序创建.ODT 文件类似于与 Microsoft Wo ...

  10. Word控件Spire.Doc 转换教程(二十六):在 C#、VB.NET 中将 Word 转换为 EPUB 时添加封面图片

    我们之前介绍如何将 Word 转换为 EPUB的文档.但是,在从 Word 文档创建 EPUB 图书时,您可能希望将封面图像添加到 EPUB.以下代码片段将演示相同的内容. Spire.Doc for ...

最新文章

  1. Oracle HowTo:如何解决Oracle10gR2 ORA-19554关于SBT_TAPE问题
  2. 老司机谈APK瘦身套路-项目优化篇
  3. google Guava包的ListenableFuture解析
  4. PAT1034 Head of a Gang (30)(并查集)
  5. swiper高度自适应_小程序自定义导航自适应高度
  6. Akka并发编程——第三节:Actor模型(二)
  7. 联想面试智力题,听说前面三道题必考(有部份解答)
  8. 岑溪高考成绩查询2021,2019岑溪高考成绩喜报(归义中学、筋竹中学、南
  9. 为caffe添加最简单的全通层AllPassLayer
  10. 冒险岛(MapleStory) × Re:从零开始的异世界生活 游戏联动人物素材(含提取方法)
  11. 软件工程之信息系统集成
  12. linux系统发育树的构建步骤,步一步教你如何做系统进化树
  13. 中南大学计算机复试分数线,2019年中南大学考研复试分数线
  14. Python小结<1>
  15. element audio 标签 不显示_不闪屏,HDR,带鱼屏全都有,LG 29WK600宽屏显示器测评...
  16. 大物设计性实验:电容、电感量的测量
  17. 网站侵权服务器在国外,中国电影史上最大泄露事故 侵权网站服务器在境外
  18. vue脚手架vue-cli的卸载与安装方式
  19. 【小飞象出海】怎么注册海外Google账户
  20. 大智慧365除权数据导出存通达信板块源码+工具

热门文章

  1. nbx2000安装教程
  2. (翻译)2022 年免费的 4 个最佳文本到语音在线工具
  3. 知识工程研究计算机,国际知识工程的研究可视化分析.doc
  4. spss citespace mysql_科学网-如何解读CiteSpace产生的图谱-陈超美的博文
  5. C语言文件缓冲区作用,C语言 文件操作4--文件结构体FILE的理解以及缓冲区再讲...
  6. uniapp开发安卓app 实现nfc读卡功能
  7. SAP的Smartform 自建页格式:SPAD
  8. JAVA醋坊定制销售平台计算机毕业设计Mybatis+系统+数据库+调试部署
  9. 如何自定义cad线型_百度经验.html,CAD如何修改系统已有线型或自定义新的线型
  10. 【linux】循序渐进学运维-CentOS7基本配置