Lossing font in bookmarks

I am using the following line of code to update content in the pre-defined bookmarks


doc.Range.Bookmarks(intCount).Text = strContent(intCount)

the content is changed, however, the font is changed as well.

Is there a way I keep the original font defined in the bookmark?


Hi Jason,

Thanks for your inquiry. After an initial test with Aspose.Words for .NET 13.1.0, I was unable to reproduce this issue on my side. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Best regards,

attached is the word document template.

take a look at bookmarks F5, F6, F7,F8, the font is Wingdings in the DOT document.

the font is changed to Monotype Sorts afterwards.

I used the following line of code to save the document.

doc.Save(GeneratedFileName,

SaveFormat.Doc)

Hi Jason,

Thanks for the additional information.

While using the latest version of Aspose.Words i.e. 13.2.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-8027. Your request has also been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best regards,

the following workaround worked for me.

Dim builder As New DocumentBuilder(doc)
builder.MoveTo(doc.Range.Bookmarks(strBookmarkName).BookmarkEnd)
doc.Range.Bookmarks(strBookmarkName).Text = ""
builder.Write(strContent)Dim builder As New DocumentBuilder(doc)
builder.MoveTo(doc.Range.Bookmarks(strBookmarkName).BookmarkEnd)
doc.Range.Bookmarks(strBookmarkName).Text = ""
builder.Write(strContent)

Hi Jason,


Thanks for the additional information. It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,