This is a C# app to create a Word doc. Here's where I created a table (3 cols 7 rows). When I debug it, it prints correctly (into a Word doc), but it will only print 3 rows . . it will write all rows, but overwrites the 4th thru 7ths row on the 3rd row.
Any ideas will be appreciated very much . . .
John
Word.Table oTable;
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, 3, 10, ref oMissing, ref oMissing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;
int r, c;
string strText = "";
string mTempFed;
string mTempSt1;
double dTempFed = dFedEst1 + dFedEst2 + dFedEst3 + dFedEst4;
double dTempSt1 = dStEst1[0] + dStEst2[0] +dStEst3[0] +dStEst4[0];
mTempFed = dTempFed.ToString("C0");
mTempSt1 = dTempSt1.ToString("C0");
for (r = 1; r <= 7; r++)
for (c = 1; c <= 3; c++)
{
if (c == 1 && r == 1) {strText = "Due Date"; oTable.Cell(r, c).Range.Text = strText;}
if (c == 1 && r == 2) { strText = "04/15/14"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 1 && r == 3) { strText = "06/15/14"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 1 && r == 4) { strText = "09/15/14"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 1 && r == 5) { strText = "01/15/15"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 1 && r == 6) { strText = " "; oTable.Cell(r, c).Range.Text = strText; }
if (c == 1 && r == 7) { strText = " "; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 1) { strText = "Federal"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 2) { strText = mFedEst1; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 3) { strText = mFedEst2; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 4) { strText = mFedEst3; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 5) { strText = mFedEst4; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 6) { strText = "----------"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 2 && r == 7) { strText = mTempFed; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 1) { strText = FullNameOfSt[0]; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 2) { strText = mStEst1[0]; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 3) { strText = mStEst2[0]; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 4) { strText = mStEst3[0]; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 5) { strText = mStEst4[0]; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 6) { strText = "----------"; oTable.Cell(r, c).Range.Text = strText; }
if (c == 3 && r == 7) { strText = mTempSt1; oTable.Cell(r, c).Range.Text = strText; }
}
oTable.Columns[1].Width = oWord.InchesToPoints(2);
oTable.Columns[2].Width = oWord.InchesToPoints(2);
oTable.Columns[3].Width = oWord.InchesToPoints(2);
oTable.Rows[1].Range.Font.Bold = 1;