| View previous topic :: View next topic |
| Author |
Message |
carebear General User

Joined: 18 Aug 2004 Posts: 7
|
Posted: Mon Aug 30, 2004 7:39 pm Post subject: Borders doesn't show |
|
|
I've used this line to try to create a border for the top of cell F6 however, no border is shown when I ran the automation.
| Code: |
oSheet.getCellByPosition(5,5).TopBorder.OuterLineWidth := 35;
oSheet.getCellByPosition(5,5).TopBorder.Color := RGB (0,0,0);
|
|
|
| Back to top |
|
 |
webpac General User

Joined: 18 Sep 2005 Posts: 18
|
Posted: Tue Sep 27, 2005 1:50 am Post subject: |
|
|
I got the same problem.
I don't find a solution. Have you got the solution ? |
|
| Back to top |
|
 |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
Posted: Wed Sep 28, 2005 4:47 am Post subject: |
|
|
Hi webpac!
I found this solution somewhere here on forum:
| Code: | Sub CellBorder
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument = ThisComponent
oSheet = oDocument.Sheets.getByIndex(0)
oRange = oSheet.getCellRangeByPosition(1,1,1,1)
oRange.BottomBorder = MakeCellBorderLine(0,0,50,75)
oRange.TopBorder = MakeCellBorderLine(0,0,50,75)
oRange.LeftBorder = MakeCellBorderLine(0,0,50,75)
oRange.RightBorder = MakeCellBorderLine(0,0,50,75)
End Sub
Function MakeCellBorderLine( nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance ) As com.sun.star.table.BorderLine
oBorderLine = createUnoStruct( "com.sun.star.table.BorderLine" )
With oBorderLine
.Color = nColor
.InnerLineWidth = nInnerLineWidth
.OuterLineWidth = nOuterLineWidth
.LineDistance = nLineDistance
End With
MakeCellBorderLine = oBorderLine
End Function |
Hope it helps...
Uros |
|
| Back to top |
|
 |
webpac General User

Joined: 18 Sep 2005 Posts: 18
|
Posted: Wed Sep 28, 2005 7:35 am Post subject: |
|
|
Hi Uros, I tried to change the property TopLine, LeftLine, RightLine, BottomLine, HorizontalLine, VerticalLine, IsTopLineValid, IsLeftLineValid, IsRightLineValid, IsBottomLineValid, IsHorizontalLineValid, IsVerticalLineValid, Disance, IsDistanceValid.
I tried also to change the color, InnerLineWidth, OuterLineWidth, LineDistance but no changes in Calc.
With Delphi code, I can't make directly a createUnoStruct, I didn't find how I can do it but it's not the problem because using the structure oBorderLine is just an shortcut to make a code more readable.
I think the real problem is using API via Delphi code not permits change the Borders. |
|
| Back to top |
|
 |
webpac General User

Joined: 18 Sep 2005 Posts: 18
|
Posted: Wed Sep 28, 2005 7:36 am Post subject: |
|
|
Scuse, I didn't say I'm using API via Delphi code.
This is my code :
| Code: | FooRange.TableBorder.LeftLine.Color := CouleurOO( clBlack );
FooRange.TableBorder.VerticalLine.Color := CouleurOO( clBlack );
FooRange.TableBorder.RightLine.Color := CouleurOO( clBlack );
FooRange.TableBorder.TopLine.OuterLineWidth := 20;
FooRange.TableBorder.HorizontalLine.OuterLineWidth := 50;
FooRange.TableBorder.BottomLine.OuterLineWidth := 40;
FooRange.TableBorder.LeftLine.OuterLineWidth := 30;
FooRange.TableBorder.VerticalLine.OuterLineWidth := 60;
FooRange.TableBorder.RightLine.OuterLineWidth := 100;
FooRange.TableBorder.IsTopLineValid := True;
FooRange.TableBorder.IsLeftLineValid := True;
// .... |
|
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Thu Sep 29, 2005 12:09 am Post subject: |
|
|
The problem is not specific to Delphi, it appears with a structure of structure. You have to do it step by step.
| Code: | Var allBorders, aBorder: Variant;
allBorders := FooRange.TableBorder;
aBorder := allBorders.VerticalLine;
aBorder.Color := CouleurOO( clBlack );
aBorder.OuterLineWidth := 60;
allBorders.VerticalLine := aBorder;
aBorder := allBorders.RightLine;
aBorder.Color := CouleurOO( clBlack );
aBorder.OuterLineWidth := 100;
allBorders.RightLine := aBorder;
// etc
allBorders.IsTopLineValid := True;
allBorders.IsLeftLineValid := True;
// etc
FooRange.TableBorder:= allBorders; |
| Quote: | | With Delphi code, I can't make directly a createUnoStruct |
Yes you can. See Delphi_OOo http://ooomacros.org/dev.php#133853 or french version at http://fr.openoffice.org/Documentation/How-to/indexht.html
Bernard |
|
| Back to top |
|
 |
webpac General User

Joined: 18 Sep 2005 Posts: 18
|
Posted: Thu Sep 29, 2005 12:54 am Post subject: |
|
|
| Thank you very much, it works very well. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|