Seite 1 von 1

[gelöst] Notizformatierung (Annotations) per Makro ändern

Verfasst: Fr, 07.09.2012 09:32
von der_Zerstreute
Hallo Leute ,

Nach langem recherchieren hab ich endlich einen Weg gefunden wie ich Notizen via Makro positionieren kann, sowie ihre Fenstergröße anpassen kann.
Jedoch ist mir aufgefallen das OOO anscheinend differenziert zwischen Hover-Modus und dauerhafter Anzeige.
Jetzt kommt ihr ins Spiel . Ich finde in den Eigenschaften der Annotations keine separate Einstellmöglichkeit für den Hover Modus (Mouse-over).

folgender Code kommt bei mir zum Einsatz :

Code: Alles auswählen

dim temp as variant
dim oCell as object
dim oTest as object
Dim sFrameRectNew as new com.sun.star.awt.Rectangle 

Tabelle = ThisComponent.Sheets(1)

oCell = Tabelle.getCellByPosition(8,1)
stCellAddress=oCell.CellAddress

oAnnotShape = oCell.Annotation.AnnotationShape 
oAnnotShape.CharHeight = 9
oAnnotShape.CharHeightAsian = 9            '<- Nutzen unklar
oAnnotShape.CharHeightComplex = 9        '<- Nutzen unklar
oAnnotShape.fillColor  = &HFFFFFF
oAnnotShape.ShadowXDistance = 0
oAnnotShape.ShadowYDistance = 0
sFrameRectNew.X = 20500 
sFrameRectNew.y = 0
sFrameRectNew.width  = 8000 
sFrameRectNew.height = 400

oAnnotShape.FrameRect = sFrameRectNew 
Wenn ich jetzt auf "Notiz anzeigen" klicke , wird mir das Fenster angezeigt mit passender Font-Größe, jedoch ohne Hintergrundfarbe - aber das ist nen anderes Problem , da fehlt wohl noch ein Parameter ..

Wenn ich aber mit der Maus drüberfahre über die Felder mit Notiz, wird mir der Notizinhalt mit ca Schriftgröße 24 angezeigt !

Hat einer von euch eine Idee wie ich den Schriftsatz auch anpassen kann ?

Danke schonmal vorweg ..

Re: Notizformatierung (Annotations) per Makro ändern

Verfasst: Mi, 19.09.2012 09:15
von der_Zerstreute
für alle die es interessiert , ich habe die Lösung gefunden :D.

Das Problem ist die Reihnenfolge und ob bereits eine Notiz vorhanden war ...

der funktionierende Code schaut dann so aus :

Code: Alles auswählen

Sub Not1
dim temp as variant
dim oCell as object
dim oTest as object
Dim sFrameRectNew as new com.sun.star.awt.Rectangle 

Tabelle = ThisComponent.Sheets(1)
i = 3                                                             ' im originalcode ist i eine Schleife ;)
oCell = Tabelle.getCellByPosition(2,i)
stCellAddress=oCell.CellAddress

' ...Inhalt der Notiz in Abhänigkeit vom Zelleninhalt von 2 Zellen ...
temp = (Tabelle.getCellbyPosition(2,i).value/Tabelle.getCellbyPosition(1,i).value)*60+0.5
temp = "Durchschnitt Zeit :"& str(int(temp)) & "Min"

'... erstmal eine leere Notiz erstellen ...
Tabelle.getAnnotations.insertNew(stCellAddress, " ")

' ... Format der Notiz festlegen ...
oAnnotShape = oCell.Annotation.AnnotationShape 
oAnnotShape.CharHeight = 7
oAnnotShape.CharFontPitch = 0
oAnnotShape.FillStyle = 0
oAnnotShape.CharHeightAsian = 9
oAnnotShape.CharHeightComplex = 9
oAnnotShape.fillColor  = &HFFFFFF   
oAnnotShape.LineStyle = 2
oAnnotShape.ShadowXDistance = 0
oAnnotShape.ShadowYDistance = 0

' ... und jetzt erst den endgültigen Text eintragen ...
Tabelle.getCellbyPosition(2,i).getannotation.string = temp

' ... und nu noch Position und Fenstergröße ...
sFrameRectNew.X =5000
sFrameRectNew.y =7000
sFrameRectNew.width = 8000 
sFrameRectNew.height = 400
oAnnotShape = oCell.Annotation.AnnotationShape
oAnnotShape.FrameRect = sFrameRectNew 

end sub
so , ich hoffe ich hab euch damit nicht zu sehr verwirrt mit meiner Frage ;) ..

Re: Notizformatierung (Annotations) per Makro ändern

Verfasst: Mi, 19.09.2012 16:06
von TrueColor
der_Zerstreute hat geschrieben:' ... und nu noch Position und Fenstergröße ...

Code: Alles auswählen

[...]
sFrameRectNew.width = 8000 
sFrameRectNew.height = 400
Fenstergröße fix... Was passiert, wenn der Inhalt nicht reinpasst? Wird das Fenster dann automatisch höher? Scrollbalken kann ich mir nicht vorstellen, lassen sich im Hover-Modus ja nicht bedienen.