Hi,
Is it possible to add image data into a bookmark content using ReplaceBookmarkContent method?
Document document = new Document(FilePath + "Bookmark.docx");
Section section = document.AddSection();
//create a temp section to add image.
Section tempSection = document.AddSection();
tempSection.AddParagraph().AppendPicture(Image.FromFile(@"E:\image\image1.jpg"));
ParagraphBase replacementFirstItem = tempSection.Paragraphs[0].Items.FirstItem as ParagraphBase;
ParagraphBase replacementLastItem = tempSection.Paragraphs[tempSection.Paragraphs.Count - 1].Items.LastItem as ParagraphBase;
TextBodySelection selection = new TextBodySelection(replacementFirstItem, replacementLastItem);
TextBodyPart part = new TextBodyPart(selection);
BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
//locate the bookmark
bookmarkNavigator.MoveToBookmark("bookmark3");
//replace the content of bookmark
bookmarkNavigator.ReplaceBookmarkContent(part);
//remove temp section
document.Sections.Remove(tempSection);
document.SaveToFile(@"18097.docx", FileFormat.Docx);