We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting images and text contained in a file to a bookmark using Aspose Words

I am converting a word application that creates word documents that start with a template containing bookmarks. With ms word, i create a file and insert it using shape.textframe.textrange.select

and word.selection.insertfile

to get the file into the bookmark area

My question is, do you have a similar scheme in aspos, and can you insert images from the given file into the bookmark?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your interest in Aspose.Words. Yes you can insert image at bookmark. Please try using the following code:

//Open document and create DocumentBuilder

Document doc = new Document(@"Test164\in.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

//Uncommnet this line, if bookmark contains text and you would like to remove it

//doc.Range.Bookmarks["mybk"].Text = string.Empty;

//move DocumentBuilder cursor to a bookmark

builder.MoveToBookmark("mybk");

//Insert image in the document

builder.InsertImage(@"Common\test.jpg");

//Save output document

doc.Save(@"Test164\out.doc");

Hope this helps.

Best regards.