Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Set Bold/Italic with AppleScript in Numbers?

I am using AppleScript to set the font of cells in a Numbers document. I can set the basic font (e.g., "Helvetica", "Times New Roman"), but I can't style the text (e.g., "Helvetica Bold", "Times New Roman Italic").


Is there a way to style Numbers cells with AppleScript as bold or italic? If so, how is it done? Thanks.

iMac, 27" Late 2013

Posted on Jan 30, 2018 8:32 PM

Reply
Question marked as Best reply

Posted on Jan 31, 2018 6:25 AM

This seems to work for me:


tell application "Numbers"

set font name of cell "B2" of table 1 of sheet 1 of document 1 to "HelveticaNeue-Bold"

end tell


The trick seems to be to use the condensed name of the font - the easiest way to do this is to set a cell to the font you want then use AppleScript to 'get font name of cell...' and examine the result, or use the Font Book application to get info on the font and use the 'Postscript name'.

1 reply
Question marked as Best reply

Jan 31, 2018 6:25 AM in response to Laguna Hiker

This seems to work for me:


tell application "Numbers"

set font name of cell "B2" of table 1 of sheet 1 of document 1 to "HelveticaNeue-Bold"

end tell


The trick seems to be to use the condensed name of the font - the easiest way to do this is to set a cell to the font you want then use AppleScript to 'get font name of cell...' and examine the result, or use the Font Book application to get info on the font and use the 'Postscript name'.

Set Bold/Italic with AppleScript in Numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.