Libre:021 様々な種類の罫線を引く

セルの下辺に様々罫線を引きます。

罫線はSolid Single LineとSolid Double Line

があります。 

sub ksUnderLine

Dim objBorderLine1 As New com.sun.star.table.BorderLine
Dim objSheet As Object
Dim objCell As Object

With objBorderLine1
.Color = RGB(0, 0, 0)
.OuterLineWidth = 88
End With

objSheet = ThisComponent.CurrentController.ActiveSheet
objCell = objSheet.getCellRangeByName(“B2”)

objCell.BottomBorder = objBorderLine1

end sub

 

二重線にするには、OuterLineWidthと共にInnerLineWidthを設定してあげます。

Widthは以下のテーブルを参照してください。

http://hermione.s41.xrea.com/pukiwiki/index.php?OOoBasic%2FCalc%2Fborder 

からの引用です。

 

pt InnerLineWidth OuterLineWidth LineDistance
なし 0 0 0
0.05 0 2 0
1.00 0 35 0
2.50 0 88 0
4.00 0 141 0
5.00 0 176 0
二重線
pt InnerLineWidth OuterLineWidth LineDistance
1.10 2 2 35
2.60 2 2 88
3.00 35 35 35
7.50 88 88 88
3.55 2 35 88
5.05 2 88 88
6.55 2 141 88

 

 

 

 

参考1参考2

次にDotやDashを引く方法を紹介します。

LineStyle =>0 : Line / 1 : Dot( 点線 ) / 2 : Dash( 破線 )

Sub ksCellLine()


Dim objDoc As Object
Dim objCtrl as Object
Dim selRange as Object, cellRange as Object, objCell as Object
Dim Border as Object

objDoc = ThisComponent
objCtrl = objDoc.getCurrentController()
objCell = objCtrl.getActiveSheet().getCellRangeByName(“B2”)
objCtrl.select(objCell)
cellRange = objDoc.CurrentSelection(0)

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

‘ Set Border

cellRange.BottomBorder = Border

End Sub