What am i doing wrong?[simple word automation C# 05]

G

giddy

Hi ,

could someone please tell me what im doing wrong here .. when i hit
button1 , word opens , the DATA shows up without a table.
This what it looks like - >
http://gidisrael.googlepages.com/wordAutomation.jpg

and heres my code: [C# 2005]
private void button1_Click(object sender, EventArgs e)
{

object objMissing = System.Reflection.Missing.Value;
object objTrue = true;
wd.ApplicationClass objWord = new wd.ApplicationClass();
objWord.Visible = true;
wd.Document objDoc = objWord.Documents.Add(ref objMissing,
ref objMissing,ref objMissing, ref objTrue);
wd.Range objRange = objDoc.Content;
wd.Table tbl = objDoc.Tables.Add(objRange, 4,4, ref
objDefaultBehaviorWord8, ref objAutoFitFixed);

int r = 1;
while (r<=4)
{

for (int nrCol = 1; nrCol <= 4; nrCol++)
{
// Now add the records.
tbl.Cell(r, nrCol).Range.Text =
Convert.ToString("Num" + nrCol);
}
r++;
}

}

Gideon
 
Top