答案1
合并之前设置所有边框,而不仅仅是外部边框:
如果第一个未合并的单元格没有底部或右边框,则合并的单元格也没有:
编辑:
为了方便重复执行此操作,我录制了以下宏。可以通过 将其分配给热键或工具栏按钮Tools -> Customize
。
sub SetAllBordersAndMerge
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(12) as new com.sun.star.beans.PropertyValue
args1(0).Name = "OuterBorder.LeftBorder"
args1(0).Value = Array(0,0,2,0,0,2)
args1(1).Name = "OuterBorder.LeftDistance"
args1(1).Value = 0
args1(2).Name = "OuterBorder.RightBorder"
args1(2).Value = Array(0,0,2,0,0,2)
args1(3).Name = "OuterBorder.RightDistance"
args1(3).Value = 0
args1(4).Name = "OuterBorder.TopBorder"
args1(4).Value = Array(0,0,2,0,0,2)
args1(5).Name = "OuterBorder.TopDistance"
args1(5).Value = 0
args1(6).Name = "OuterBorder.BottomBorder"
args1(6).Value = Array(0,0,2,0,0,2)
args1(7).Name = "OuterBorder.BottomDistance"
args1(7).Value = 0
args1(8).Name = "InnerBorder.Horizontal"
args1(8).Value = Array(0,0,2,0,0,2)
args1(9).Name = "InnerBorder.Vertical"
args1(9).Value = Array(0,0,2,0,0,2)
args1(10).Name = "InnerBorder.Flags"
args1(10).Value = 0
args1(11).Name = "InnerBorder.ValidFlags"
args1(11).Value = 127
args1(12).Name = "InnerBorder.DefaultDistance"
args1(12).Value = 0
dispatcher.executeDispatch(document, ".uno:SetBorderStyle", "", 0, args1())
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "MoveContents"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:ToggleMergeCells", "", 0, args2())
end sub