How can one set the borders of a cell range via python scripting framework?

Lets say I want to alter the border state of a cell range that is 7-columns wide and 50-rows high. I get the border object with:

someborder = theSheet.getCellRangeByPosition(0,0,6,49).TableBorder   

by Karolus : here someborder is already a object of type Tableborder

I am hoping to access the border elements with something like:

someborder.TopBorder.LineWidth = 0  

by Karolus : mri return ↓↓↓ these ↓↓↓ Properties for someborder:

BottomLine             .table.BorderLine  -STRUCT- 
Distance               short              0        
HorizontalLine         .table.BorderLine  -STRUCT- 
IsBottomLineValid      boolean            True     
IsDistanceValid        boolean            True     
IsHorizontalLineValid  boolean            True     
IsLeftLineValid        boolean            True     
IsRightLineValid       boolean            True     
IsTopLineValid         boolean            True     
IsVerticalLineValid    boolean            True     
LeftLine               .table.BorderLine  -STRUCT- 
RightLine              .table.BorderLine  -STRUCT- 
TopLine                .table.BorderLine  -STRUCT- 
VerticalLine           .table.BorderLine  -STRUCT- 

by Karolus: End of InlineComment

but then I get this error message:

(<class 'AttributeError'>: someborder  /usr/lib64/python3.4/site-packages/uno.py:365 in function _uno_struct__getattr__() [return __builtin__.getattr(self.__dict__["value"],name)

The properties are structs. Any ideas?

Wondering if its possible to at least copy a range its border properties and transfer that (paste) to another range of equal size (with the borders intact … need to experiment with this)

Of course!
Something like:

bordersettings = one_range.TableBorder2
another_range.TableBorder2 = bordersettings

another_range must not have the same size as one_range

Karolus

Hallo

I’ve inserted some Comments inline you post, hope it helps.

absolutely