OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Borders doesn't show

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
carebear
General User
General User


Joined: 18 Aug 2004
Posts: 7

PostPosted: Mon Aug 30, 2004 7:39 pm    Post subject: Borders doesn't show Reply with quote

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
View user's profile Send private message
webpac
General User
General User


Joined: 18 Sep 2005
Posts: 18

PostPosted: Tue Sep 27, 2005 1:50 am    Post subject: Reply with quote

I got the same problem.
I don't find a solution. Have you got the solution ?
Back to top
View user's profile Send private message
uros
Super User
Super User


Joined: 22 May 2003
Posts: 601
Location: Slovenia

PostPosted: Wed Sep 28, 2005 4:47 am    Post subject: Reply with quote

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
View user's profile Send private message
webpac
General User
General User


Joined: 18 Sep 2005
Posts: 18

PostPosted: Wed Sep 28, 2005 7:35 am    Post subject: Reply with quote

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
View user's profile Send private message
webpac
General User
General User


Joined: 18 Sep 2005
Posts: 18

PostPosted: Wed Sep 28, 2005 7:36 am    Post subject: Reply with quote

Scuse, I didn't say I'm using API via Delphi code. Embarassed

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
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Thu Sep 29, 2005 12:09 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
webpac
General User
General User


Joined: 18 Sep 2005
Posts: 18

PostPosted: Thu Sep 29, 2005 12:54 am    Post subject: Reply with quote

Thank you very much, it works very well.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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