Word 中表格的偏移列

Word 中表格的偏移列

我想在 Word 中创建一个表格,其最后一列偏移量如下: 欣赏我的绘画技巧

有人能帮助我吗?

答案1

您可以使用 powershell 来自动创建表。

$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

答案2

最简单的方法是创建表Ab通过使用创建表函数,然后是表Cd用铅笔画出来。

答案3

可以通过使用“拆分单元格按钮”来偏移表格单元格,然后使用“合并单元格按钮”突出显示要创建的单元格。这有点奇怪,但一旦你开始操作就很容易理解了。

相关内容