.NET and MS Word

  • Thread starter Thread starter Christian Cambier
  • Start date Start date
C

Christian Cambier

Hi,

I try to create 2 tables in a Word document from a C# application :

Creating the first table works fine :

object startPosition = 0;
object endPosition = 0;
object missing = Type.Missing;

// m_doc refers to the word-object
Word.Range range0 = m_doc.Range(ref startPosition, ref endPosition);
Word.Table table1 = m_doc.Tables.Add(range0, 1, 3, ref missing, ref
missing);

Then creating a second table :
startPosition = ??? see remark below
endPosition = ??? see remark below
Word.Range range2 = m_doc.Range(ref startPosition, ref endPosition);
Word.Table table2 = range2.Tables.Add(range2, 1, 3, ref missing, ref
missing);

??? remark : Whatever value I specify for startPosition and endPosition I
never manage to create the table under the first one. He always creates it
in the first one.

So, how do I create a 2nd table under the 1st one ?


thanks
Chris
 
Hi,

I try to create 2 tables in a Word document from a C# application :

Creating the first table works fine :
Code:
??? remark : Whatever value I specify for startPosition and endPosition I
never manage to create the table under the first one. He always creates it
in the first one.

So, how do I create a 2nd table under the 1st one ?


thanks
Chris
[/QUOTE]

Chris,

are you using your own template for this? If so, you could try to
create tables on bookmarks -> in that case you'll always know on which
position you are (and that you're not creating the table within the
first table)

Leon
 
Back
Top