HighTechTalks DotNet Forums  

creating multiple tables in a word doc

Dotnet Framework (WinForms) microsoft.public.dotnet.framework.windowsforms


Discuss creating multiple tables in a word doc in the Dotnet Framework (WinForms) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Vincent Vinet
 
Posts: n/a

Default creating multiple tables in a word doc - 07-07-2005 , 11:11 AM






Hi, I have an windows application that "can" log entries into a word
document for printing or storing...
each log entry is supposed to look like this:

Text
----------------------------------
Quote:
Table 1 | Columns |
----------------------------------
Info | Info |
----------------------------------
Text
----------------------------------
Quote:
Table 2 | Columns |
----------------------------------
Info | Info |
----------------------------------
Info | Info |
----------------------------------
Separator

But only ends up displaying from the Table 2 down, so

----------------------------------
Quote:
Table 2 | Columns |
----------------------------------
Info | Info |
----------------------------------
Info | Info |
----------------------------------
Text
Separator


Here is an abregged version of the code:

Dim oWord As New Word.Application
Dim oDoc As New Word.Document
oDoc = oWord.Documents.Add()
With oDoc.Range
.InsertAfter("Text")
.InsertParagraphAfter()
With .Tables.Add(oDoc.Range, 2, 4)
.Cell(1, 1).Column.Width = oWord.CentimetersToPoints(9.21)
'etc... other columns
.Cell(1, 1).Range.Text = "Dernière tâche"
'etc...other cells
End With
.InsertAfter("Text")
.InsertParagraphAfter()
With .Tables.Add(oDoc.Range, 3, 4)
.Cell(1, 1).Column.Width = oWord.CentimetersToPoints(2.54)
'etc... all columns
.Cell(1, 1).Range.Text = "Usager"
'etc... all cells
End With
..InsertAfter("------------------------------------------------------")
..InsertParagraphAfter()
End With

What is causing only the second table to show, and what should I do to fix
it?




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.