I'm wanting to create a table in word which has the last column offset like so: appreciate my drawing skills

Would anybody be able to help me?


Solution 1:

You could use powershell to automate table creation.

$word = New-Object -ComObject word.application

$word.visible = $true
$word.application.DisplayAlerts = 0
$document = $word.documents.add()
$selection = $word.selection
$selection.Font.Name = "Arial"
$selection.Font.Size = 14
$selection.Font.Bold = $true;

$number_Of_Rows = 10
$number_Of_Columns = 4
$paragraph = $document.Content.Paragraphs.Add()
$Range = $paragraph.Range
$Table = $document.Tables.Add($Range,$number_Of_Rows,$number_Of_Columns)
$Table.Borders.Enable = 1
$BorderTop = "-1"
$BorderLeft = "-2"
$BorderBottom = "-3"
$BorderRight = "-4"
$Table = $document.Tables.item(1)
$Table.Rows.Height = 40

$Table.Cell(1, 1).Merge($Table.Cell(2, 1))
$Table.Cell(1,1).Range.Text = "a"
$Table.Cell(3, 1).Merge($Table.Cell(4, 1))
$Table.Cell(5, 1).Merge($Table.Cell(6, 1))
$Table.Cell(7, 1).Merge($Table.Cell(8, 1))
$Table.Cell(9, 1).Merge($Table.Cell(10, 1))

$Table.Cell(1, 2).Merge($Table.Cell(2, 2))
$Table.Cell(1, 2).Range.Text = "b"
$Table.Cell(3, 2).Merge($Table.Cell(4, 2))
$Table.Cell(5, 2).Merge($Table.Cell(6, 2))
$Table.Cell(7, 2).Merge($Table.Cell(8, 2))
$Table.Cell(9, 2).Merge($Table.Cell(10, 2))

$Table.Cell(2, 3).Merge($Table.Cell(3, 3))
$Table.Cell(2, 3).Range.Text = "c"
$Table.Cell(4, 3).Merge($Table.Cell(5, 3))
$Table.Cell(6, 3).Merge($Table.Cell(7, 3))
$Table.Cell(8, 3).Merge($Table.Cell(9, 3))

$Table.Cell(3, 4).Merge($Table.Cell(4, 4))
$Table.Cell(3, 4).Range.Text = "d"
$Table.Cell(5, 4).Merge($Table.Cell(6, 4))
$Table.Cell(7, 4).Merge($Table.Cell(8, 4))

$Table.cell(1, 3).Range.Borders.item($BorderTop).LineStyle = 0
$Table.cell(1, 3).Range.Borders.item($BorderRight).LineStyle = 0
$Table.cell(1, 4).Range.Borders.item($BorderTop).LineStyle = 0
$Table.cell(1, 4).Range.Borders.item($BorderRight).LineStyle = 0
$Table.cell(2, 4).Range.Borders.item($BorderTop).LineStyle = 0
$Table.cell(2, 4).Range.Borders.item($BorderRight).LineStyle = 0

$Table.cell(9, 4).Range.Borders.item($BorderRight).LineStyle = 0
$Table.cell(9, 4).Range.Borders.item($BorderBottom).LineStyle = 0
$Table.cell(10, 4).Range.Borders.item($BorderRight).LineStyle = 0
$Table.cell(10, 4).Range.Borders.item($BorderBottom).LineStyle = 0
$Table.cell(10, 3).Range.Borders.item($BorderRight).LineStyle = 0
$Table.cell(10, 3).Range.Borders.item($BorderBottom).LineStyle = 0