sample document I have code like this
internal void GetShapesInParagraph(int paragraphIndex)
{
Application word = new Application();
object miss = System.Reflection.Missing.Value;
object path = @"A:\format1.docx";
object readOnly = true;
Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss,
ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref
miss, ref miss, ref miss, ref miss);
// get the paragraph we want to check
Paragraph para = docs.Paragraphs[paragraphIndex];
// validate the object
if (para != null)
{
// the InlineShapes collection exists in the Range of that paragraph
foreach (InlineShape ils in para.Range.InlineShapes)
{
// validate the object
if (ils != null)
{
// validate this is a picture
if (ils.Type == WdInlineShapeType.wdInlineShapePicture)
{
DataRow dr = dt.NewRow();
// now we have a shape in that paragraph, we can do what we want to it
int ShapeWidth = Convert.ToInt32(ils.Width);
int ShapeHeight = Convert.ToInt32(ils.Height);
dr[0] = ils.PictureFormat;
dt.Rows.Add(dr);
}
}
}
}
}
I am able to import text from a doc/docx file but I'm stuck for images to be imported in datatable first and then in the gridview.