该网页将解释用户如何在他们自己的 .NET 应用程序中动态插入指向他们的报告、电子邮件消息和各种文档类型的超链接。 超链接是万维网的支柱,可用于链接不同的页面、文档或单击以跳转到当前文档中的新部分。 GroupDocs.Assembly .NET 是一个非常强大的 API,它可以帮助软件开发人员通过几行代码在他们的文档或报告中动态添加超链接。 它包括对一些非常流行的文档类型的支持,例如 PDF、HTML、Outlook 电子邮件、Microsoft Office Word、Excel 工作表、PowerPoint 演示文稿等等。 它支持一些高级功能,例如插入文档页面的链接、插入单元格的链接、编辑超链接、显示文本而不是超链接、动态插入书签中的链接、插入演示幻灯片的超链接等等。
GroupDocs.Assembly .NET API 为在各种类型的文档中插入和编辑超链接提供了完整的支持。 以下 C# .NET 代码示例展示了如何在 Word 文档中轻松添加超链接。
// Supported file formats: https://docs.groupdocs.com/watermark/java/supported-document-formats/ | |
const String strDocumentTemplate = "Word Templates/Dynamic Hyperlink.docx"; | |
const String strDocumentReport = "Word Reports/Dynamic Hyperlink.docx"; | |
const String uriExpression = "https://www.groupdocs.com/"; | |
const String displayTextExpression = "GroupDocs"; | |
try | |
{ | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate), CommonUtilities.SetDestinationDocument(strDocumentReport), | |
new DataSourceInfo(uriExpression,"uriExpression"), new DataSourceInfo(displayTextExpression,"displayTextExpression")); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |
GroupDocs.Assembly .NET API 完全支持在电子表格文件中添加和处理超链接。 您可以轻松地编辑它的位置或将其替换为新位置。 下面的 C# 代码显示了用户在他们自己的 .NET 应用程序中的电子表格文件中插入超链接是多么容易。
// Supported file formats: https://docs.groupdocs.com/watermark/java/supported-document-formats/ | |
const String strDocumentTemplate = "Spreadsheet Templates/Dynamic Hyperlink.xlsx"; | |
const String strDocumentReport = "Spreadsheet Reports/Dynamic Hyperlink.xlsx"; | |
const String uriExpression = "https://www.groupdocs.com/"; | |
const String displayTextExpression = "GroupDocs"; | |
try | |
{ | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate), CommonUtilities.SetDestinationDocument(strDocumentReport), | |
new DataSourceInfo(uriExpression,"uriExpression"), new DataSourceInfo(displayTextExpression,"displayTextExpression")); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |
GroupDocs.Assembly for .NET 帮助软件专业人员构建用于管理各种类型文档的应用程序。 下面的代码示例演示了软件开发人员如何在其 PowerPoint 演示文稿文档中添加超链接。
// Supported file formats: https://docs.groupdocs.com/watermark/java/supported-document-formats/ | |
const String strDocumentTemplate = "Presentation Templates/Dynamic Hyperlink.pptx"; | |
const String strDocumentReport = "Presentation Reports/Dynamic Hyperlink.pptx"; | |
const String uriExpression = "https://www.groupdocs.com/"; | |
const String displayTextExpression = "GroupDocs"; | |
try | |
{ | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate), CommonUtilities.SetDestinationDocument(strDocumentReport), | |
new DataSourceInfo(uriExpression,"uriExpression"), new DataSourceInfo(displayTextExpression,"displayTextExpression")); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |
GroupDocs.Assembly .NET API 允许软件专业人员在他们的电子邮件文档中插入超链接。 下面的 .NET 代码演示了程序员如何轻松地将超链接添加到他们的电子邮件消息并从他们自己的 .NET 应用程序中发送给其他用户。
// Supported file formats: https://docs.groupdocs.com/assembly/net/supported-document-formats/ | |
const String strDocumentTemplate = "Email Templates/Dynamic Hyperlink.msg"; | |
const String strDocumentReport = "Email Reports/Dynamic Hyperlink.msg"; | |
const String uriExpression = "https://www.groupdocs.com/"; | |
const String displayTextExpression = "GroupDocs"; | |
try | |
{ | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(CommonUtilities.GetSourceDocument(strDocumentTemplate), CommonUtilities.SetDestinationDocument(strDocumentReport), | |
new DataSourceInfo(uriExpression,"uriExpression"), new DataSourceInfo(displayTextExpression,"displayTextExpression")); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |
所有主要平台和操作系统都支持 GroupDocs.Assembly .NET API。 如需完整的系统要求指南,请访问 系统要求 在执行以下代码之前,请确保您已安装以下先决条件 系统:
(Portable Document Format)
(Hyper Text Markup Language)
(XML Paper Specifications)
(Tagged Image File Format)
(Web Page Archive Format)
(Text Document)
(XAML File)
(Open eBook File)
(Scalar Vector Graphics)
(PostScript File)
(Printer Command Language Document)
(XML File)
(OpenDocument Standard Format)
(OpenXPS File)
(Markdown Language)
(Microsoft PowerPoint Template Files)
(OpenDocument Standard Format)
(Microsoft Word Binary Format)
(Office 2007+ Word Document)
(Microsoft Word 2007 Marco File)
(Microsoft Word Template Files)
(Microsoft Word Template File )
(Microsoft Word 2007+ Template File)
(Rich Text Format)
(OpenDocument Text File Format)
(OpenDocument Standard Format)
(Microsoft Excel Spreadsheet (Legacy))
(Excel 97 - 2003 Template)
(Open XML Workbook)
(Macro-enabled Spreadsheet)
(Excel Template)
(Excel Macro-Enabled Template)
(Excel Binary Workbook)
(Open XML presentation Format)
(Macro-enabled Presentation File)
(PowerPoint Slide Show)
(PowerPoint Slide Show)
(Macro-enabled Slide Show)
(Microsoft PowerPoint Template Presentation)
(Microsoft PowerPoint Template File)
(OpenDocument Presentation Format)
(E-Mail Message)
(Apple Mail Message)
(Outlook Message Item File)