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

How do I set a size of an annotation cell

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


Joined: 24 Jul 2007
Posts: 28

PostPosted: Sat Aug 04, 2007 3:09 am    Post subject: How do I set a size of an annotation cell Reply with quote

I create dynamically an annotation of some cell and want to control the size of the cell.
The code below creates some annotation with specific size but the size is not set.
After creation the annotation gets some default size.

oCell = ThisComponent.sheets.getByName("Sheet1").getCellRangeByName("A4:A4")
' Xray oCell

oCell.Annotation.String =""
oCell.Annotation.AnnotationShape.FillBackground =true
oCell.Annotation.AnnotationShape.FillColor = RGB(93,104,199)
oCell.Annotation.AnnotationShape.FillStyle = 1
oCell.Annotation.AnnotationShape.FillTransparence = 0

oCell.Annotation.AnnotationShape.TextLeftDistance =100
oCell.Annotation.AnnotationShape.TextLowerDistance =100
oCell.Annotation.AnnotationShape.TextRightDistance =100
oCell.Annotation.AnnotationShape.TextUpperDistance =100

oCell.Annotation.AnnotationShape.Size.Width = 500
oCell.Annotation.AnnotationShape.Size.Height = 500



Somebody can help me?
Thank you,
Yevgeni
Back to top
View user's profile Send private message
acknak
Moderator
Moderator


Joined: 13 Aug 2004
Posts: 4295
Location: ~ 40°N,75°W

PostPosted: Sat Aug 04, 2007 5:35 am    Post subject: Reply with quote

[Moved to Macros & API]
Back to top
View user's profile Send private message
vitcaro
OOo Advocate
OOo Advocate


Joined: 20 Feb 2007
Posts: 256
Location: Italy

PostPosted: Sun Aug 05, 2007 11:52 pm    Post subject: Reply with quote

Please try to set the size with this code:
Code:

oAnnotationShape.Size = asize
oAnnotationShape.SizeProtect = False


This is an example which is working:

Code:

sub Main
Set oSheet = ThisComponent.getSheets.getByName("Sheet1")
Set oCell = oSheet.getCellByPosition(2, 5)
oCell.clearContents 8
Set oCellAddr = oCell.getCellAddress
Set oAnnotations = oSheet.getAnnotations

oAnnotations.insertNew oCellAddr, "This is an annotation example"
Set oAnnotation = oCell.getAnnotation
oAnnotation.setIsVisible True
Set oAnnotationShape = oAnnotation.getAnnotationShape
oAnnotationShape.FillBackground = True
oAnnotationShape.FillColor = RGB(93, 104, 199)
oAnnotationShape.FillStyle = 1
oAnnotationShape.FillTransparence = 0

oAnnotationShape.TextLeftDistance = 100
oAnnotationShape.TextLowerDistance = 100
oAnnotationShape.TextRightDistance = 100
oAnnotationShape.TextUpperDistance = 100
Dim aSize As New com.sun.star.awt.Size
asize.Height = 1000
asize.Width = 4000

oAnnotationShape.Size = asize
oAnnotationShape.SizeProtect = False
Dim apoint As New com.sun.star.awt.Point
apoint.x = 1000
apoint.y = 1000

oAnnotationShape.setPosition apoint

end sub


Regards
vitcaro
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