public void setWordShapeDataTask(int id, DataGridView data)
{
try
{
int tableRowNumber = data.RowCount + 1;
Microsoft.Office.Interop.Word.Table wordTable;
foreach (Microsoft.Office.Interop.Word.Shape shape in wordDoc.Shapes)
if (shape.ID == wordShapeIndexes[id])
{
Microsoft.Office.Interop.Word.Range wordRange = shape.TextFrame.ContainingRange;
wordTable = wordDoc.Tables.Add(wordRange, tableRowNumber, 5);
wordTable.Range.Font.Size = 8;
wordTable.set_Style("Table Grid 8");
wordTable.Cell(1, 1).Range.Text = "Num";
wordTable.Cell(1, 2).Range.Text = "Task";
wordTable.Cell(1, 3).Range.Text = "Recipiens";
wordTable.Cell(1, 4).Range.Text = "Time";
wordTable.Cell(1, 5).Range.Text = "Status";
for (int i = 2, j = 0; i <= tableRowNumber; i++, j++)
{
wordTable.Cell(i, 1).Range.Text = (i-1).ToString();
wordTable.Cell(i, 2).Range.Text = data.Rows[j].Cells["TaskBody"].Value.ToString();
wordTable.Cell(i, 3).Range.Text = data.Rows[j].Cells["Recipiens"].Value.ToString();
wordTable.Cell(i, 4).Range.Text = data.Rows[j].Cells["DueDate"].Value.ToString();
wordTable.Cell(i, 5).Range.Text = data.Rows[j].Cells["Status"].Value.ToString();
}
}
}
catch (Exception)
{
}
}