Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Tables[1].Rows.Add returns null if table has vertically merged cel
The following line of code in my application insert a new row after the last
row in table. Row tRow = range.Tables[1].Rows.Add(ref missingValue); Where 1. tRow is object of Microsoft.Office.Interop.Word.Row class 2. range is object of Microsoft.Office.Interop.Word.Range This code works fine when table contains no vertically merged cells. If the table contains vertically merged cells, Rows.Add returns null value. Any idea "Why Rows.Add returns null when table contains vertically merged cells"?. Thanks, Prasad |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
Tables[1].Rows.Add returns null if table has vertically merged cel
Why? is a difficult question to answer. It is, however, not possible to
directly address individual rows of tables with vertically merged cells, even though there may be no merged cells in the row in question. One workaround would be to address the first cell of the new row and then expand the range: range.Tables(1).Rows.Add Set tRow = range.Tables(1).Cell(range.Tables(1).Rows.Count, 1).Range tRow.Expand wdRow (this assumes the row is added at the end of the table) (this is also VBA so you'll need to tweak it slightly) -- Enjoy, Tony "Prasad More" wrote in message ... The following line of code in my application insert a new row after the last row in table. Row tRow = range.Tables[1].Rows.Add(ref missingValue); Where 1. tRow is object of Microsoft.Office.Interop.Word.Row class 2. range is object of Microsoft.Office.Interop.Word.Range This code works fine when table contains no vertically merged cells. If the table contains vertically merged cells, Rows.Add returns null value. Any idea "Why Rows.Add returns null when table contains vertically merged cells"?. Thanks, Prasad |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
Tables[1].Rows.Add returns null if table has vertically merged
Hi Tony,
Thank you for reply. The issues that I am facing is I cannot access individual rows of a table when there are vertically merged cells into it and the second issue is Add method fails. So when the Add method fails to return the reference to added row, there is no way I can access first cells and expand the range. Best Regards, Prasad "Tony Jollans" wrote: Why? is a difficult question to answer. It is, however, not possible to directly address individual rows of tables with vertically merged cells, even though there may be no merged cells in the row in question. One workaround would be to address the first cell of the new row and then expand the range: range.Tables(1).Rows.Add Set tRow = range.Tables(1).Cell(range.Tables(1).Rows.Count, 1).Range tRow.Expand wdRow (this assumes the row is added at the end of the table) (this is also VBA so you'll need to tweak it slightly) -- Enjoy, Tony "Prasad More" wrote in message ... The following line of code in my application insert a new row after the last row in table. Row tRow = range.Tables[1].Rows.Add(ref missingValue); Where 1. tRow is object of Microsoft.Office.Interop.Word.Row class 2. range is object of Microsoft.Office.Interop.Word.Range This code works fine when table contains no vertically merged cells. If the table contains vertically merged cells, Rows.Add returns null value. Any idea "Why Rows.Add returns null when table contains vertically merged cells"?. Thanks, Prasad |
#4
Posted to microsoft.public.word.tables
|
|||
|
|||
Tables[1].Rows.Add returns null if table has vertically merged
Sorry, but I don't know why the Add should fail. What error code does it
give? -- Enjoy, Tony "Prasad More" wrote in message ... Hi Tony, Thank you for reply. The issues that I am facing is I cannot access individual rows of a table when there are vertically merged cells into it and the second issue is Add method fails. So when the Add method fails to return the reference to added row, there is no way I can access first cells and expand the range. Best Regards, Prasad "Tony Jollans" wrote: Why? is a difficult question to answer. It is, however, not possible to directly address individual rows of tables with vertically merged cells, even though there may be no merged cells in the row in question. One workaround would be to address the first cell of the new row and then expand the range: range.Tables(1).Rows.Add Set tRow = range.Tables(1).Cell(range.Tables(1).Rows.Count, 1).Range tRow.Expand wdRow (this assumes the row is added at the end of the table) (this is also VBA so you'll need to tweak it slightly) -- Enjoy, Tony "Prasad More" wrote in message ... The following line of code in my application insert a new row after the last row in table. Row tRow = range.Tables[1].Rows.Add(ref missingValue); Where 1. tRow is object of Microsoft.Office.Interop.Word.Row class 2. range is object of Microsoft.Office.Interop.Word.Range This code works fine when table contains no vertically merged cells. If the table contains vertically merged cells, Rows.Add returns null value. Any idea "Why Rows.Add returns null when table contains vertically merged cells"?. Thanks, Prasad |
Reply |
Thread Tools | |
Display Modes | |
|
|