Need Solution to replace text with image in word 2007 and save the file in .pdf format [modified]
-
How to replace text with image in word 2007 and save the file in .pdf format this is my code _wordapp.ActiveWindow.Selection.WholeStory(); _wordapp.ActiveWindow.Selection.Copy(); IDataObject data = Clipboard.GetDataObject(); string temp = ""; temp = data.GetData(DataFormats.Text).ToString(); temp = temp.Replace("\r", ""); string[] arrtemp = temp.Split(Environment.NewLine.ToCharArray()); int pos = 0; for (int t = 0; t < arrtemp.Length; t++) { if (arrtemp[t].Contains("Sign1")) { pos = t; string fileName = GetSignPath(); //the picture file to be inserted Object oMissed = _aDoc.Paragraphs[pos].Range; //the position you want to insert Object oLinkToFile = false; //default Object oSaveWithDocument = true;//default _aDoc.InlineShapes.AddPicture(fileName, ref oLinkToFile, ref oSaveWithDocument, ref oMissed); File.Delete(fileName); this.FindAndReplace("Sign1", ""); } } Its replacing at wrong place instead of where i wanted(i.e. in place of Sign1) Sign1 is the text given in the Word 2007 to find and replace it with image Instead it is placing sumwhere else only in the .pdf file Please suggest me the solution code if possible to solve it Its urgent Thanks, Harish
modified on Wednesday, August 4, 2010 10:21 AM