SetCalcBorder OOME 4.1 Listing 415. p.467 doesn't give me the same picture

SetCalcBorder OOME 4.1 Listing 415. p.467 doesn’t give me the same picture of cells when run.

I’m running:
Version: 7.4.7.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 4; OS: Linux 6.1; UI render: default; VCL: x11
Locale: en-US (C); UI: en-US
Raspbian package version: 4:7.4.7-1+rpi1+deb12u5
Calc: threaded

I’m wondering if others see the same two vertical lines or is my system settings such that I don’t see what Pitonyak saw.

All sugestions welcome.
Thanks,
Mike

I only can see two vertical red (left) lines in b2 > b6 and c2 > c6

I think that:

  • Libreoffice has made changes to the API and the borders are treated differently,

Modifying a macro (by Bernard Marcelly) I have managed to draw all the borders, but something is missing.

Sub BorduresDeCellule() 'CellBorders

 Dim oDoc As Object, oShets As Object
 Dim oShet As Object, oCell As Object
 Dim oBorder As New com.sun.star.table.BorderLine
'   oDoc = ThisComponent
   oDoc = StarDesktop.loadComponentFromURL("private:factory/scalc", "_default", 0, Array())
   oShets = oDoc.Sheets
   oShet = oShets.getByName("Sheet1")
   oCell = oShet.getCellRangeByName("C2")
'  xray oCell
   With oBorder 
     .Color = RGB(200,0,0)
     .InnerLineWidth = 0 'For vertical borders must be = 0
     .OuterLineWidth = 30 ' Can set for vertical borders 
     oCell.LeftBorder = oBorder' ligne simple, rouge
     .OuterLineWidth = 100
     oCell.RightBorder = oBorder ' ligne simple, rouge
     .OuterLineWidth = 0 ' for Horizontal lines must be = 0
     .InnerLineWidth = 60 
    ' .LineDistance = 0 ' for horizontal or vertical lines must be 0 
     .Color = RGB(0,120,0)
     oCell.TopBorder = oBorder ' ligne double, verte
     .Color = RGB(0,0,120)
     oCell.BottomBorder = oBorder ' ligne double, bleue
     .InnerLineWidth = 0
     .OuterLineWidth = 50
     .LineDistance = 0
     .Color = RGB(100,100,100)
     oCell.DiagonalBLTR = oBorder ' ligne simple, grise
   End With
End Sub

Later I have found another macro in the help of LibreOffice
https://help.libreoffice.org/latest/en-us/text/sbasic/guide/calc_borders.html

Starting with LO 3.4 the BorderLine2 structure should be used

Thank you bantoniof for your input.
If you see the same thing I do then your thinking about LO API changes are likely correct.
I’ve not tried changing line width and color settings of a single cell border but your example shows me the way.
In my explorations I’ve not found a way to use doubled lines in a BorderLine.
What I have found is that all four sides will be shown the same if only one of .InnerLineWidth and .OuterLineWidth are greater than zero but not both and .LineDistance must be zero for anything to be displayed in the spreadsheet.
Again, thanks for sharing.
Mike

Hi sokol92 and thanks for sharing your thoughts.
While I quite agree that BorderLine2 is much more powerful than BorderLine, I’ve not seen anything in the docs suggesting that BorderLine’s definition has changed nor that it should not be used.
If you have, please post a link to same.
Thanks,
Mike

We see that the above-mentioned macro by A. Pitonyak gives different results than those shown in his famous book.
Below, A. Pitonyak points out (p. 471):

How does OOo decide which border should be used right or left, top or bottom? Although the behavior is not documented, the following precedence was observed…

I haven’t studied this specifically, but I suspect that the undocumented behavior may have changed since the book was written (over 10 years ago).
I use the BorderLine2 structure regularly.