Hash (#) in hyperlink morphs

A hash character in a hyperlink becomes " \l " when run through a DocumentVisitor.

void Main()
{
    var doc = new Document("test.docx");
    var visitor = new TestVisitor();
    doc.Accept(visitor);
}

public class TestVisitor : DocumentVisitor
{
    public override VisitorAction VisitRun(Run run)
    {
        Console.WriteLine(run.Text);
        return VisitorAction.Continue;
    }
}

test.docx (30.0 KB)

@joe_lopez This is expected. In MS Word document hyperlinks are represented as HYPERLINK fields and bookmark name in hyperlink is specified using \l switch in it. You can see this by pressing Alt+F9 in MS Word to see field codes:
{ HYPERLINK "https://qa-pol.ms.tasb.org/PolicyOnline/PolicyDetails?key=116&code=AB" \l "localTabContent" }
Please see Microsoft documentation to learn more about HYPERLINK field codes.

I have learned something new. As always, thank you for your quick reply.

1 Like