I am adding an image to word document it is working but my main problem is as follows:
1) Insert image in the word document in a table at specific cell.
2) If there are many tables in the word document and if I want to insert in some specific table then what to do?
I am using Microsoft.Office.Interop.Word dll for doing operations on word. In code I have taken a static table, how to achieve dynamic?
My code is as follows:
Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(ref wordfilename, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Range rngPic = doc.Tables[1].Cell(1, 3).Range;
// we can even select a particular cell in the table
//Range rngPic = rng.Tables[1].Cell(2, 3).Range;
string logoLocation = ConfigurationManager.AppSettings["LogoLocation"];
var LogoPath = Path.Combine((HttpContext.Current.Server.MapPath(logoLocation)), fpnInfo.LogoPath);
Microsoft.Office.Interop.Word.InlineShape picture = rngPic.InlineShapes.AddPicture(LogoPath, Type.Missing, Type.Missing, Type.Missing);
picture.Height = 50;
picture.Width = 50;
Please help me thanks in advance.