I'm trying to read the paragraph contents and shapes text from word file.
I have written following code:
foreach (Microsoft.Office.Interop.Word.Shape shape in document.Shapes)
{
ParaInfo.Add(new ParaInfo{Text = shape.TextFrame.TextRange.Text});
}
foreach (Microsoft.Office.Interop.Word.Paragraph para in document.Paragraphs)
{
ParaInfo.Add(new ParaInfo{Text = para.Range.Text});
}
But, this will change the sequence of paragraphs and shapes. I want to get them in the same sequence as they appear in the word document.
How can I achieve this using Interop word?