Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.BuiltInDocumentProperties.Title = "This is a cool document created by Aspose.Words";
// Insert hyperlink with empty displayed text
Field hyperlink = builder.InsertHyperlink("", "https://www.aspose.com", false);
// Move document builder inside the hyperlink displayed value (between field separator and field end)
// Put all nodes from the target paragraph into the hyperlink value.
builder.MoveTo(hyperlink.End);
// Insert a field
builder.InsertField("DOCPROPERTY Title");
//doc.UpdateFields();
doc.Save(@"C:\Temp\out.docx");
@jjdoe Yes, you are absolutely right, it is required to set hyperlink style. But I would set hyperlink style before inserting the hyperlink field
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.BuiltInDocumentProperties.Title = "This is a cool document created by Aspose.Words";
// Insert hyperlink with empty displayed text
builder.Font.StyleIdentifier = StyleIdentifier.Hyperlink;
Field hyperlink = builder.InsertHyperlink("", "https://www.aspose.com", false);
// Move document builder inside the hyperlink displayed value (between field separator and field end)
// Put all nodes from the target paragraph into the hyperlink value.
builder.MoveTo(hyperlink.End);
// Insert a field
builder.InsertField("DOCPROPERTY Title");
builder.Font.ClearFormatting();
//doc.UpdateFields();
doc.Save(@"C:\Temp\out.docx");
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.