SHARE
TWEET

Add tables

a guest Feb 28th, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Add-Table()
  2. {
  3.     $EthergroupTable = $objSelection.Tables.add(
  4.     [EthergroupTable],($ethergroup.Count + 1),3,
  5.     [Microsoft.Office.Interop.Word.WdDefaultTableBehavior]::wdWord9TableBehavior,
  6.     [Microsoft.Office.Interop.Word.WdAutoFitBehavior]::wdAutoFitContent)
  7.  
  8.     $EthergroupTable.cell(1,1).range.Bold=1
  9.     $EthergroupTable.cell(1,1).range.text = 'Mode'
  10.     $EthergroupTable.cell(1,2).range.Bold=1
  11.     $EthergroupTable.cell(1,2).range.text = 'Member 1'
  12.     $EthergroupTable.cell(1,3).range.Bold=1
  13.     $EthergroupTable.cell(1,3).range.text = 'Member 2'
  14.  
  15.     for ($i=0; $i -lt ($ethergroup.Count); $i++)
  16.     {
  17.         $group = $ethergroup[$i] -split ','
  18.         $EthergroupTable.cell(($i+2),1).range.Bold = 0
  19.         $EthergroupTable.cell(($i+2),1).range.text = $group[0]
  20.         $EthergroupTable.cell(($i+2),2).range.Bold = 0
  21.         $EthergroupTable.cell(($i+2),2).range.text = $group[1]
  22.         $EthergroupTable.cell(($i+2),3).range.Bold = 0
  23.         $EthergroupTable.cell(($i+2),3).range.text = $group[2]
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top