Text hyperlink issue

hello team,
As when we are inserting below text using old aspose version (16.1.0.0)

 var WatchListSummary = "<p style='font-size:13px; text-align:Justify;line-height:1.25em;margin-bottom:0pt;'><b>Manish Sharma</b>&nbsp;<b>PN 1</b>&nbsp;<a href=\"javascript:void(0)\">ENTITY has been included by the Bureau of Industry and Security in the Entity List, which identifies entities reasonably believed to be involved, or to pose a significant risk of being or becoming involved, in activities contrary to the national security or foreign policy interests of the United States. Additional license requirements are imposed on, and the availability of most license exceptions is limited for, exports, reexports, and transfers to listed entities.</a>\v\v\v\v</p><br/>";
 documentBuilder.InsertHtml(WatchListSummary,true);

But it does not create hyperlink and text color is not changed and appear as shown in below screen shot.

while when we are inserting same text using new aspose version it generate hyperlink and text color is changed. So, please suggest how can fix this issue.

@RiteshK10

DocumentBuilder.InsertHtml parses the supplied HTML and converts every element – including <a> tags and the CSS‑defined colour – into the corresponding Word formatting [3].

In Aspose.Words for .NET 16.1.0.0 the HTML parser did not apply the hyperlink style (the link was inserted as plain text and the colour was ignored). This behaviour was corrected in later releases, which is why the same fragment renders correctly with the current version [5].

Fix

  1. Upgrade to a newer Aspose.Words version (the current release). The hyperlink and its colour are rendered automatically after the upgrade.

  2. If upgrading is not possible, create the link manually:

// build the paragraph up to the link text
documentBuilder.Writeln("<p style='font-size:13px; text-align:justify; line-height:1.25em; margin-bottom:0pt;'>"
                        + "<b>Manish Sharma</b>&nbsp;<b>PN 1</b>&nbsp;");

// insert the hyperlink
documentBuilder.InsertHyperlink(
    "ENTITY has been included by the Bureau of Industry and Security …",
    "javascript:void(0)",   // target URL
    false);                  // isMailLink

// apply the same colour as the default hyperlink colour
documentBuilder.Font.Color = System.Drawing.Color.Blue;   // or any colour you need
documentBuilder.Font.Underline = Underline.Single;

// close the paragraph
documentBuilder.Writeln("</p><br/>");

The manual approach reproduces the visual result that the newer InsertHtml provides.

Summary – the missing hyperlink in version 16.1.0.0 is a known limitation that was fixed in subsequent releases; upgrading is the recommended solution, otherwise use InsertHyperlink with appropriate font styling as a workaround. [3][5]

@RiteshK10 As I can see the text is wrapped into <a> tag, so it is expected it is represented as HYPERLINK fields with the appropriate style in the resulting document:

You can unlink hyperlink fields to convert hyperlinks to simple text:

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

string WatchListSummary = "<p style='font-size:13px; text-align:Justify;line-height:1.25em;margin-bottom:0pt;'><b>Manish Sharma</b>&nbsp;<b>PN 1</b>&nbsp;<a href=\"javascript:void(0)\">ENTITY has been included by the Bureau of Industry and Security in the Entity List, which identifies entities reasonably believed to be involved, or to pose a significant risk of being or becoming involved, in activities contrary to the national security or foreign policy interests of the United States. Additional license requirements are imposed on, and the availability of most license exceptions is limited for, exports, reexports, and transfers to listed entities.</a>\v\v\v\v</p><br/>";
builder.InsertHtml(WatchListSummary, true);

foreach (Field f in doc.Range.Fields)
{
    if (f.Type == FieldType.FieldHyperlink)
        f.Unlink();
}

doc.Save(@"C:\Temp\out.docx");