[api-dev] Changing font and font size of comments in Calc

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[api-dev] Changing font and font size of comments in Calc

Regina Henschel
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Changing font and font size of comments in Calc

Daniel Rentz-3
Hi Regina,

Am 27.12.2010 22:27, schrieb Regina Henschel:

>
> 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?

Font settings in notes is broken somehow, see issue
http://qa.openoffice.org/issues/show_bug.cgi?id=96587

Regards
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Changing font and font size of comments in Calc

Armin Le Grand
Am 28.12.2010 09:48, schrieb Daniel Rentz:

> Hi Regina,
>
> Am 27.12.2010 22:27, schrieb Regina Henschel:
>>
>> 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?
>
> Font settings in notes is broken somehow, see issue
> http://qa.openoffice.org/issues/show_bug.cgi?id=96587
>

When You are about it, please consider using the new annotation shapes
from draw/Impress (in SVX), not the crumbled use of special incarnations
of SdrCaptionObj. Just my 2 cent...

> Regards
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Changing font and font size of comments in Calc

Regina Henschel
In reply to this post by Daniel Rentz-3
Hi Daniel,

Daniel Rentz schrieb:

> Hi Regina,
>
> Am 27.12.2010 22:27, schrieb Regina Henschel:
>>
>> 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?
>
> Font settings in notes is broken somehow, see issue
> http://qa.openoffice.org/issues/show_bug.cgi?id=96587

:(

Is the target 3.4 realistic?

Kind regards
Regina

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Changing font and font size of comments in Calc

Daniel Rentz-3
Am 28.12.2010 14:25, schrieb Regina Henschel:

> Hi Daniel,
>
> Daniel Rentz schrieb:
>> Hi Regina,
>>
>> Am 27.12.2010 22:27, schrieb Regina Henschel:
>>>
>>> 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?
>>
>> Font settings in notes is broken somehow, see issue
>> http://qa.openoffice.org/issues/show_bug.cgi?id=96587
>
> :(
>
> Is the target 3.4 realistic?

For the records - fixed in the 3.4 CWS "dr78". ;-)

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]