none
How to access columns in a table that have different cell widths from MS Word in C#

    Question

  • I am trying to get the cells from 1st column in a table. Getting exception in the "Foreach(Cells c in rng.Tables[1].Columns[1].Cells)" because the table contains columns that have mixed cell widths.

    for eg: in first row, there are 4 cells and in second row, there are only 2 cells (2 cells merged together)

    Error Message: "Cannot access individual columns in this collection because the table has mixed cell widths."

    Document oDoc = open word document
    foreach (Paragraph p in oDoc.Paragraphs)
    {
    Range rng = p.Range;
    /*

    */
    foreach (Cell c in rng.Tables[1].Columns[1].Cells)
    {
    //....
    }
    }

    Tuesday, March 22, 2011 11:29 PM

Answers