Hi,
I am using spire.doc .net version 3.5, I am trying to insert an image by finding a bookmark on word document and also I need to set the image vertical and horizontal position. How can I do this using spire doc.
Suman
Document document = new Document();
document.LoadFromFile("..\\..\\Test.docx");
BookmarksNavigator bn = new BookmarksNavigator(document);
//if name of bookmark is SpireDoc
bn.MoveToBookmark("SpireDoc", true, true);
Section section =document.AddSection();
Paragraph paragraph = section.AddParagraph();
Image image = Image.FromFile("..\\..\\image1.jpg");
DocPicture picture = paragraph.AppendPicture(image);
bn.InsertParagraph(paragraph);
document.Sections.Remove(section);
string output = "sample.docx";
document.SaveToFile(output,FileFormat.Docx);
navigator.MoveToBookmark("Signature");
var p = new Paragraph(navigator.Document);
DocPicture pic = p.AppendPicture(img);
navigator.InsertParagraph(p);
Signed: [Signature]
Name: [Name]
Date: [Date]
Signed:
<IMAGE>
Name: Test McTesterson
Date: 8/18/2014
Signed: <IMAGE>
Name: Test McTesterson
Date: 8/18/2014
Document document = new Document();
document.LoadFromFile("..\\..\\Test.docx");
Paragraph paragraph = new Paragraph(document);
Image image = Image.FromFile("..\\..\\pic.png");
DocPicture picture = paragraph.AppendPicture(image);
Bookmark bookmark = document.Bookmarks["Signature"];
Paragraph bookPra=bookmark.BookmarkStart.OwnerParagraph;
int index = bookPra.ChildObjects.IndexOf(bookmark.BookmarkStart);
bookPra.ChildObjects.Insert(index, picture);
string output = "sample.docx";
document.SaveToFile(output, FileFormat.Docx);
System.Diagnostics.Process.Start(output);