I use macro to create a hide spreadsheet document, enter data and make a grid. But the grid does not appear. When I do F8 through the macro I see that this part of code doen`t work: oBorder = CellRange.BottomBorder With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With CellRange.BottomBorder = oBorder CellRange.LeftBorder = oBorder CellRange.RightBorder = oBorder CellRange.TopBorder = oBorder
I was tested this macro in LibreOffice.org 3.3 and all works properly
Created attachment 47196 [details] Exemple
Reproducible with LibO 3.2 rc1 and rc2 (Linux, Windows Vista) OK with LibO 3.3.2, OOo-dev300m106, OOo 3.3.0 To reproduce: 1) Open Calc 2) Select a range 3) Run this macro: Sub Main Doc=ThisComponent CellRange = Doc.CurrentSelection oBorder = CellRange.BottomBorder With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With CellRange.BottomBorder = oBorder CellRange.LeftBorder = oBorder CellRange.RightBorder = oBorder CellRange.TopBorder = oBorder End Sub Result: Nothing happens.
dev master shows this regression against LibO 3.3.2 as well The failure occurs whether macro is run in the spreadsheet (no IDE) or from the open Basic IDE so dropped IDE from summary
RC2 is bit by bit identical with release version, so separate items in the version picker are useless. Changes have been discussed with Michael Meeks.
[This is an automated message.] This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it started right out as NEW without ever being explicitly confirmed. The bug is changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases. Details on how to test the 3.5.0 beta1 can be found at: http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1 more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
The following piece of code has no effect in master: Sub Main Doc=ThisComponent CellRange = Doc.CurrentSelection oBorder = CellRange.BottomBorder With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With CellRange.BottomBorder = oBorder CellRange.LeftBorder = oBorder CellRange.RightBorder = oBorder CellRange.TopBorder = oBorder End Sub
The following code works for Writer tables. Dim border As Object, ligne As new "com.sun.star.table.BorderLine" border = tbl.TableBorder ligne.OuterLineWidth = 1 border.HorizontalLine = ligne border.TopLine = ligne border.BottomLine = ligne border.RightLine = ligne border.LeftLine = ligne tbl.TableBorder = border Note the use of a *new* object that is assigned to where you want it instead of modifying directly the object you want to change.
So, it is regression or misused object in Basic?
(In reply to comment #9) > So, it is regression or misused object in Basic? Well, if it worked in previous versions, it is clearly a regression. The "other way" just gives a (clumsy) work-around. I'd have thought that this is just an occurence of bug 42819, but I get bug 42819 also in OO.org 3.2, so possibly there is something more subtle at play.
oBorder = CellRange.BottomBorder With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With CellRange.BottomBorder = oBorder the pattern above should work fine, oBorder is a copy of that css:table::BorderLine structure. And CellRange.BottomBorder = oBorder will set the BottomBorder property of the CellRange object. Infact I just slapped a debugger on the calc uno object, it does get the correct values from basic. So... this aint a basic problem but a calc uno object problem, not sure if this really is a regression, if this was reproducible in LibO 3.2 rc1 then I would strongly guess this is inherited from the old openoffice code. But... whatever it still is imo a bad bug ( I'll have a look at the calc code to see if anything jumps out as been awfully wrong ) note: it sortof mentioned in the some of the previous comments that modifying a member of a structure directly doesn't work. e.g even if CellRange.BottomBorder = oBorder worked correctly then CellRange.BottomBorder.InnerLineWidth = 10 will never work. This is not a limitation of Basic but rather down to UNO. CellRange has a property BottomBorder which is struct. Structures in UNO are returned by value, the line 'CellRange.BottomBorder.InnerLineWidth = 10' modifies the the returned ( maybe temporary is a better term ) structure
I'm going to close this, but first I have to say I spent quite some time with this out of sheer stupidity, first I didn't see any change in when running the macro Note I was using the dim oBorder as new com.sun.star.table.BorderLine With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With variant of the macro. After debugging for a while I could see no problem, then I noticed after moving the cursor the borders where in fact changed :-) the cursor which formed the selection the macro acted upon ) obscured the small increase ( for me at least ) of the changes to the linesize made by the macro. Anyway I came back for a final look to just recheck and this time I used the oBorder = CellRange.bottomBorder With oBorder .Color = 0 .InnerLineWidth = 10 .OuterLineWidth = 0 .LineDistance = 0 End With approach an noticed that indeed I wasn't getting any changes :-/ Turns out that the problem here is that CellRange.bottomBorder now returns http://api.libreoffice.org/docs/common/ref/com/sun/star/table/BorderLine2.html so the LineWidth there is picked up from 'oBorder = CellRange.bottomBorder' and it's value overwrites whatever changes were made to 'InnerLineWidth' etc. hope that makes sense
removed bug# 42819 from dependencies, it is unrelated
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.