Creating Nested tables without over-writing

A

Arun D

Hi,

I am in a situation where I need to create tables in the Cell of a table

And when I create the 2nd table, I over-write the first one or the program
crashes with this error:
"This method or property is not available because the object refers to the
end of a table row"


For your reference, here is my (non-working) code

Word.Table OuterTable = oDoc.Tables[1];
Word.Range oRng = OuterTable.Cell(2, 2).Range;
oRng.Text = "Some existing text \n";
oRng.Select();
Word.Selection oSelection = oWord.Selection;
object oCollapseDirection =
Word.WdCollapseDirection.wdCollapseEnd;
oSelection.Collapse(ref oCollapseDirection);

Word.Table InnerTable = OuterTable.Tables.Add(oSelection.Range,
1, 2, ref oMissing, ref oMissing);


I have tried searching google/MSDN/Bing, but no luck


Can anyone please tell me how to do it / what I am doing wrong?


Thank you :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top