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

Joined: 24 Jul 2007 Posts: 28
|
Posted: Sat Aug 04, 2007 3:09 am Post subject: How do I set a size of an annotation cell |
|
|
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 |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Sat Aug 04, 2007 5:35 am Post subject: |
|
|
| [Moved to Macros & API] |
|
| Back to top |
|
 |
vitcaro OOo Advocate


Joined: 20 Feb 2007 Posts: 256 Location: Italy
|
Posted: Sun Aug 05, 2007 11:52 pm Post subject: |
|
|
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 |
|
 |
|