This project has moved. For the latest updates, please go here.

How to find paragraph just before start of Table

Jan 23 at 9:50 PM
Hi,

I need to find all tables in a word document. Each table is preceded by a header that has info about the table. How can I find that header?

In the Word Object Model, I can do the following:

int tableCount = sourceDoc.Tables.Count;
        for (int j = 1; j <= tableCount; j++)
        {
            Table tbl = sourceDoc.Tables[j];
            int rowCount = tbl.Rows.Count;
            int colCount = tbl.Columns.Count;
            Range tableRange = tbl.Range;
            para = tableRange.Paragraphs[1].Previous(ref one);
            string tableText = tableRange.Text;
            string tableCaption = para.Range.Text;
            tableCaption = tableCaption.TrimEnd(new char[] { '\r' });
            .....
Is there any way to do something similar with DocX?

Thanks!