Hi all,
I want to change the font and its size for all comments in a Calc sheet.
See below my Basic macro.
1. Take a Calc document and insert two new comments on the first sheet.
2. Run the macro. Watch, that the font and its size are changed to the
new values you entered in the input box.
3. Save the document, close and reopen it.
4. Run the macro again. Use a different font name and font size in the
input box. Watch, that the displayed font and font size in the comments
do not change.
But if you examine the annotation shape of the comments with xray, you
can see, that the new values are set.
Click on one comment, then use PaintBrush tool and click on the other
comment. Watch, that not the shown font settings are copied but the
second comment now shows the font values you have entered in the input
box. I don't know whether they are copied or the second shape gets some
kind of reset.
Question: What do I miss, that though the new font settings are saved in
the annotation shape, they are not shown for 'old' comments but only for
'new' ones?
Kind regards
Regina
My macro:
sub FormatAllComments
dim oDoc as variant: oDoc=thisComponent
dim sDocType as string: sDocType = oDoc.Identifier
If sDocType <> "com.sun.star.sheet.SpreadsheetDocument" Then
msgbox "Makro arbeitet nur mit Tabellendokumenten"
exit sub
end if
dim oSheets as variant: oSheets=oDoc.Sheets
dim oSheet as variant: oSheet=oSheets.getByIndex(0)
dim oAllAnnotations as variant: oAllAnnotations = oSheet.getAnnotations()
oAllAnnotations.CreateEnumeration()
dim nAnzahl as long: nAnzahl = oAllAnnotations.Count
dim nIndex as long
dim oAnnotation as variant
dim sFontName as string: sFontName = InputBox("Schriftname","Makro
Schriftart aller Kommentare ändern","Garamond")
dim sFontSize as string: SFontSize = InputBox("Schriftgröße","Makro
Schriftart aller Kommentare ändern","18")
dim fFontSize as double: fFontSize = val(sFontSize)
for nIndex = 0 to nAnzahl-1
oAnnotation = oAllAnnotations.getByIndex(nIndex)
'xray oAnnotation
oAnnotation.AnnotationShape.CharFontName = sFontName
oAnnotation.AnnotationShape.CharHeight = fFontSize
'xray oAnnotation
next nIndex
end sub
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org