Defina todas as bordas antes da mesclagem, não apenas as bordas externas:
Seaprimeiracélulanãomescladanãotiverumabordainferioroudireita,nenhumadelasseráacélulamesclada:
EDITAR:
Parafacilitaraexecuçãodestaaçãorepetidamente,graveiamacroaseguir.PodeseratribuídoaumbotãodeatalhooubarradeferramentaspormeiodeTools->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