[Solved]Can't Get the Cell Border Thinner

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

[Solved]Can't Get the Cell Border Thinner

Post by sokolowitzky »

Hi,
I can manage setting a cell's border, but I can't find a way to make it thinner.
Do you might have any suggestion?

Code: Select all

sub settheborder
dim acts, oCells, NewBorder, NewerBorder
acts = thiscomponent.currentcontroller.activesheet
oCells = acts.getCellRangeByName("G11:G11")
NewBorder = oCells.BottomBorder
NewBorder.OuterLineWidth = 288
oCells.BottomBorder = NewBorder
msgbox "now it must be set"
NewerBorder = oCells.BottomBorder
NewerBorder.OuterLineWidth = 8
oCells.BottomBorder = NewerBorder
msgbox "but now it's not changed"

end sub
Last edited by sokolowitzky on Sat Jun 26, 2021 2:18 pm, edited 2 times in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Can't Get the Cell Border Thinner

Post by JeJe »

Works for me. you get a 288 width line then an 8 width line.

Did you mean the 8 to be a zero?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

Re: Can't Get the Cell Border Thinner

Post by sokolowitzky »

No, I gave these numbers intentionally to emphasize both are not zero but there are a certain size difference.
Let's say Once the line becomes 100 it can't go back to 50, once it turns 200 it can't go back to 100.
So, I don't know why but the code you see can't get the border thinner for some reason. But it you try to make it thicker, it becomes thicker without a problem
I really can't understand.
Win10-OpenOffice 4.1/LibreOffice 7.4
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Can't Get the Cell Border Thinner

Post by JeJe »

Works for me, run your code I get the thinner line at the end of it. OO 4.1.6
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31270
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can't Get the Cell Border Thinner

Post by Villeroy »

Why, oh why don't you use templates and styles?

Code: Select all

oCells.CellStyle = "ThickBorder"
That's it. And when you want to change anything for this type of cell, just change the style.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply