Word add data to a table
We created a table in a recent post. This time round we add some data to the table.
| 001 002 003 004 005 006 007 008 009
| function Add-TableData { param ( [int] $row = 1, [int] $col = 1, [string] $text ) $table.Cell($row,$col).Range.Text = $text } |
The row and column together with the text to enter into the cell are passed as parameters.
$table.Cell($row, $col).Range.Style = “style_name” can be used to set the style of the table cell contents. We can even set the style at the table level if required.