Shape.HRef is selecting the entire Bookmark section

Hi, I have a requirement to add an image and On click of that image jump to particular Bookmarked section. I have below code which serves the purpose but when jumping to bookmark it is selecting the entire Bookmark text.

Could you please let me know if there is a way to unselect the selected text after jumping to bookmark section OR any way to just jump to bookmark start position on click of Image?

string imagePath = "DocFile/HeadnoteDown.png";
Shape shape = builder.InsertImage(imagePath);
shape.ScreenTip = hyperlinkScreenTip;
shape.HRef = string.Format("#{0}", bookmarkName);

Thanks.

@KCSR Unfortunately, there is no way to configure this behavior neither using MS Word nor using Aspose.Words. As a workaround, you can place an another bookmark at the start of your bookmark and use this newly created bookmark as a target for hyperlink. Document structure will like like this:

Thanks, that helped!

1 Like