AddLinkToContent

CustomDocumentProperties.AddLinkToContent method

İçerikle bağlantılı yeni bir özel belge özelliği oluşturur.

public DocumentProperty AddLinkToContent(string name, string linkSource)
ParametreTipTanım
nameStringMülkün adı.
linkSourceStringMülkün kaynağı.

Geri dönüş değeri

Yeni oluşturulan özellik nesnesi veyahükümsüz ne zamanlinkSource geçersizdir.

Örnekler

Özel bir belge özelliğinin bir yer imine nasıl bağlanacağını gösterir.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.StartBookmark("MyBookmark");
builder.Write("Hello world!");
builder.EndBookmark("MyBookmark");

// Yeni bir özel özelliği bir yer işaretine bağlayın. Bu özelliğin değeri
// "LinkSource" üyesinde referans verdiği yer iminin içeriği olacaktır.
CustomDocumentProperties customProperties = doc.CustomDocumentProperties;
DocumentProperty customProperty = customProperties.AddLinkToContent("Bookmark", "MyBookmark");

Assert.AreEqual(true, customProperty.IsLinkToContent);
Assert.AreEqual("MyBookmark", customProperty.LinkSource);
Assert.AreEqual("Hello world!", customProperty.Value);

doc.Save(ArtifactsDir + "DocumentProperties.LinkCustomDocumentPropertiesToBookmark.docx");

Ayrıca bakınız