Libre:022 位置を指定して罫線を引く

罫線を引く位置は、CellRangeオブジェクトの

BottomBorder、TopBorder, LeftBorder, RightBorderプロパティを

それぞれしてしてあげます。

 

Sub ksRangelLine()
Dim objDoc As Object
Dim objCtrl as Object
Dim selRange as Object, cellRange as Object
Dim Border as Object

objDoc = ThisComponent
objCtrl = objDoc.getCurrentController()
selRange = objCtrl.getActiveSheet().getCellRangeByName( “B3:D5” )
objCtrl.select( selRange )


cellRange = objDoc.CurrentSelection(0)

‘ Border1 Property
Border = cellRange.LeftBorder
Border.Color = RGB(255, 0, 0)
Border.InnerLineWidth = 30
Border.LineStyle = 1


‘ Set Border
with cellRange
.BottomBorder = Border
.LeftBorder = Border
‘.TopBorder = Border
‘.RightBorder = Border

end with

End Sub