CustomDocumentPropertiesAddLinkToContent Method

Creates a new linked to content custom document property.

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public DocumentProperty AddLinkToContent(
	string name,
	string linkSource
)

Parameters

name
Type: SystemString
The name of the property.
linkSource
Type: SystemString
The source of the property.

Return Value

Type: DocumentProperty
The newly created property object or null when the linkSource is invalid.
Examples
Shows how to add linked custom document property.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartBookmark("MyBookmark");
builder.Writeln("Text inside a bookmark.");
builder.EndBookmark("MyBookmark");

// Add linked to content property
CustomDocumentProperties customProperties = doc.CustomDocumentProperties;
DocumentProperty customProperty = customProperties.AddLinkToContent("Bookmark", "MyBookmark");

// Check whether the property is linked to content
Assert.AreEqual(true, customProperty.IsLinkToContent);
// Get the source of the property
Assert.AreEqual("MyBookmark", customProperty.LinkSource);
// Get the value of the property
Assert.AreEqual("Text inside a bookmark.\r", customProperty.Value);

doc.Save(ArtifactsDir + "Properties.LinkCustomDocumentPropertiesToBookmark.docx");
See Also