DocIO Bookmarks InsertText font change

Referring to the documentation on inserting-content-into-a-bookmark (https://help.syncfusion.com/file-formats/docio/working-with-bookmarks#inserting-content-into-a-bookmark)

I would like to know if there is an easy way to change the font of the inserted bookmark text.

The only way I found to do this is by:

            var textBodyPart = bookmarkNavigator.GetBookmarkContent();
            foreach (var childEntity in textBodyPart.BodyItems)
            {
                if (childEntity is WParagraph)
                {
                    var paragraph = childEntity as WParagraph;
                    IWTextRange firsttext = paragraph.AppendText("InsertedText");
                    firsttext.CharacterFormat.FontName = "Tahoma";
                }
            }
            bookmarkNavigator.ReplaceBookmarkContent(textBodyPart);



1 Reply

MR Manikandan Ravichandran Syncfusion Team April 9, 2020 03:49 PM UTC

Hi Ashimaz,

Thank you for contacting Syncfusion support.

From the given details, we suspect that your requirement is with “Set the font for the replaced Bookmark content”. To set font for the bookmark content we suggest to iterate the content and set the font each text range and also we recommend you to use the mentioned approach in last update for this.

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran


Loader.
Up arrow icon