TextStyle.HyperlinkAddress
Contents
[
Hide
]TextStyle.HyperlinkAddress property
Gets or sets the hyperlink address. Must be set if the value of the IsHyperlink
property is true.
public string HyperlinkAddress { get; set; }
Examples
Shows how to bind a hyperlink to a text.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Tasks();
// Create an object of the Document class
Document doc = new Document();
RichText titleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append("Title!");
Outline outline = new Outline()
{
MaxWidth = 200,
MaxHeight = 200,
VerticalOffset = 100,
HorizontalOffset = 100
};
TextStyle textStyleRed = new TextStyle
{
FontColor = Color.Red,
FontName = "Arial",
FontSize = 10,
};
TextStyle textStyleHyperlink = new TextStyle
{
IsHyperlink = true,
HyperlinkAddress = "www.google.com"
};
RichText text = new RichText() { ParagraphStyle = ParagraphStyle.Default }
.Append("This is ", textStyleRed)
.Append("hyperlink", textStyleHyperlink)
.Append(". This text is not a hyperlink.", TextStyle.Default);
OutlineElement outlineElem = new OutlineElement();
outlineElem.AppendChildLast(text);
// Add outline elements
outline.AppendChildLast(outlineElem);
// Initialize Title class object
Title title = new Title() { TitleText = titleText };
// Initialize Page class object
Page page = new Note.Page() { Title = title };
// Add Outline node
page.AppendChildLast(outline);
// Add Page node
doc.AppendChildLast(page);
// Save OneNote document
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
See Also
- class TextStyle
- namespace Aspose.Note
- assembly Aspose.Note