Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Prasad More Prasad More is offline
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default 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   Report Post  
Posted to microsoft.public.word.tables
Prasad More Prasad More is offline
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding rows in RTF tables with merged cells? Chris Shearer Cooper Tables 4 March 13th 07 12:42 AM
'Tables'- 2 columns,4 rows. Can you merge one column into 3 rows? CalMac Captain Tables 1 May 19th 06 03:27 PM
How to determine the merged columns and rows in a table Anup Tables 4 February 13th 06 04:46 AM
Repeating rows within tables - not heading rows Eddie Tables 1 August 19th 05 03:24 PM
In table in Word, merged some rows into single row, unable to sor. DJsCPS Tables 1 March 5th 05 04:20 AM


All times are GMT +1. The time now is 03:50 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"