I'm going crazy trying to find how to insert pictures in my bookmarks...
For the moment I have no problems with insert text or tables: I find bookmarks and insert in that position like John's way: Replace bookmark text in Word file using Open XML SDK
Now I want to send images to this bookmarks. I'm reading articles like:
http://msdn.microsoft.com/en-us/library/bb497430(office.14).aspx
http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/6d9066db-a154-475d-9731-944c8ce13e67/
...but I can't do it work with my template dotx and my bookmarks. Some ideas?
Here is the code I am using to insert the paragraph in my bookmark:
Run runImg = new Run();
runImg.Append(element);
Paragraph parImg = new Paragraph();
parImg.Append(runImg);
foreach (BookmarkStart bookmarkStart in bookmarkMap.Values)
{
if (bookmarkStart.Name.Value == _nomBM)
{
bookmarkStart.FirstChild.PrependChild(parImg);
}
}
Thanks!