Justin

Justin

  • NA
  • 1
  • 0

Ending a word table

Aug 18 2009 4:38 PM

So I am trying to generate a table in a word document.  This is what I have.
Microsoft.Office.Interop.Word.
Table oTable;
oTable = wordApp.Selection.Tables.Add(wordApp.Selection.Range, 1, 4,
ref missing, ref missing);
oTable.Range.ParagraphFormat.SpaceAfter = 4;
oTable.Rows.Add(
ref missing);
oTable.Cell(1, 1).Range.Text =
"text1";
oTable.Cell(1, 2).Range.Text =
"text2";
oTable.Cell(1, 3).Range.Text =
"text3";
oTable.Cell(1, 4).Range.Text =
"text4";
oTable.Borders.InsideLineStyle = Microsoft.Office.Interop.Word.
WdLineStyle.wdLineStyleSingle;
oTable.Borders.OutsideLineStyle = Microsoft.Office.Interop.Word.
WdLineStyle.wdLineStyleDouble;
 
This works fine except I can't seem to exit out of the table.  If I put:
wordApp.Selection.TypeText(
"some text");
It will put that into the last cell.  How do I close the table?  Right now, it is inside of a loop with other information but it will put everything into the table again and again.
 
How do I close the table.

Answers (1)