Hi there,
I recenty began writing my first macro and i have been able to work everithing out except setting borders. Can somebody please help me with this?
Here is my Code:
REM ***** BASIC *****
Option Explicit
Sub Main
Dim BasicBorder as New com.sun.star.table.BorderLine
Dim oBorder As Object
oBorder = ThisComponent.Sheets.getByName( "Sheet" ).getCellRangeByPosition(1,1,2,2).TableBorder
rem Werte für einen einfachen Rand
BasicBorder.Color = RGB(255, 0, 0)
BasicBorder.InnerLineWidth = 0
BasicBorder.OuterLineWidth = 2
BasicBorder.LineDistance = 0
oBorder.LeftLine = BasicBorder
oBorder.TopLine = BasicBorder
oBorder.RightLine = BasicBorder
oBorder.BottomLine = BasicBorder
ThisComponent.Sheets.getByName( "Sheet" ).getCellRangeByPosition(1,1,2,2).TableBorder = oBorder
End Sub
It should make a border in red around the cells b2 to c3 (outer border only) but it only draws the bottom and right border. Can somebody explain to me what i am doing wrong?
Thanks in advance and excuse my bad english
Last edited by ansuransax on Sun Jul 10, 2011 1:19 pm, edited 1 time in total.
I tried your code with no modifications and it works as expected. Perhaps this is a bug in LibreOffice.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Your macro works fine in an empty, new file in my LibreOffice3.3.2
1.: What about your screen resolution? Maybe the marco can draw those line, but they are not visible...
2.: What about the borders and border color and border distances of the neighboring cells? Maybe they are covered the red border lines. If this is the reason, use internal frame with a small distance.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Zizi64:
1) No, that can not be it because if i export the document to a pdf it still only displays the bottom and right border
2) how can i do this?
I used your attached file and get the same error, only bottom and right borders. I tried the same file on a windows 7 machine with libreoffice 3.4.1 but with the same results, so it seems its a bug in libreoffice...
I tried the same file on a windows 7 machine with libreoffice 3.4.1 but with the same results, so it seems its a bug in libreoffice...
My example file shows how a borderline cover an anothe borderline.
Just delete the format of yellow cells, and you will see the perfect red borderlines.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Zizi64 wrote:
My example file shows how a borderline cover an anothe borderline.
Just delete the format of yellow cells, and you will see the perfect red borderlines.
Ah, i see what you mean, but even if i delete the borders of the yellow cells i still only get a border on buttom and right... i supose when you do this it displays the other two borders (top and left) as well.
So, should i fill in a bug report? or do you have other ideas i could try?
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Strange, with your last post i dont see any borders at all...
But well, I downgraded to libreoffice 3.3.3 an now everything works as expected, i get all borders. So it seems to be a bug in version 3.4
But before i fill out a bug report about this i think it would be better if somebody can confirm this, installing libreoffice 3.4.x and see if the borders work correctly or not. Just to be sure its not a problem with my configuration or something similar.