Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

Is it possible to rotate text in a cel. (really in the cel!!)

Hello,


I am using numbers 09.

is it possible to rotate text 90 degrees in a cell.

Of course I can make a textbox but that is not what i mean.


greetz

MacBook, iOS 5.0.1, numbers i work 09

Posted on Jan 30, 2012 12:43 PM

Reply
10 replies

Jan 31, 2012 6:21 AM in response to bosg

Here is a revised version of a script posted some months ago.

Now, it may be used under Lion or older operating systems supporting Numbers '09.


--{code}

--[SCRIPT rotate_cell_contents]

(*

Enregistrer le script en tant que Script : rotate_cell_contents.scpt

déplacer le fichier ainsi créé dans le dossier

<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:

Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.


Sélectionner une cellule dont le texte doit être tourné de 90 degrés.

Aller au menu Scripts , choisir Numbers puis choisir “rotate_cell_contents”


--=====


L’aide du Finder explique:

L’Utilitaire AppleScript permet d’activer le Menu des scripts :

Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.

Cochez la case “Afficher le menu des scripts dans la barre de menus”.

Sous 10.6.x,

aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript

puis cocher la case “Afficher le menu des scripts dans la barre des menus”.


--=====


Save the script as a Script: rotate_cell_contents.scpt


Move the newly created file into the folder:

<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:

Maybe you would have to create the folder Numbers and even the folder Applications by yourself.


Select a cell whose contents must be rotated for 90 degrees.

Go to the Scripts Menu, choose Numbers, then choose “rotate_cell_contents”


--=====


The Finder’s Help explains:

To make the Script menu appear:

Open the AppleScript utility located in Applications/AppleScript.

Select the “Show Script Menu in menu bar” checkbox.

Under 10.6.x,

go to the General panel of AppleScript Editor’s Preferences dialog box

and check the “Show Script menu in menu bar” option.


--=====


Yvan KOENIG (VALLAURIS, France)

2011/06/23

2011/06/26 -- No longer use an auxiliary text box. Now keep the text attributes.

2012/01/31 -- edited for Lion

*)

--=====


on run

local dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2

local le_texte, la_largeur, la_hauteur, myNewDoc


my activateGUIscripting()


(*

Extract properties of the source/target cell *)

set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()


tell application "Numbers" to tell document dName to tell sheet sName to tell table tName

set selection range to range (name of column colNum1 & name of row rowNum1)

end tell


(*

Cut*)

my raccourci("Numbers", "x", "c")


(*

Trigger Preview *)

tell application "System Events"

if "Preview" is not in (name of every application process) then launch application "Preview"

end tell


delay 0.2 -- required


(*

New document from the clipboard *)

my raccourci("Preview", "n", "c")


(*

Rotate to left *)

my raccourci("Preview", "l", "c")


(*

Copy *)

my raccourci("Preview", "c", "c")


(*

Quit *)

my raccourci("Preview", "q", "c")

(system attribute "sys2") < 7

if result then


(*

Click the [Don't Save] button in the warning sheet *)

tell application "Preview" to activate

tell application "System Events" to tell application process "Preview" to tell window 1

name of buttons

repeat 50 times

delay 0.1

if exists sheet 1 then exit repeat

end repeat

tell sheet 1 to click button 2

end tell

end if


(*

Back to Numbers *)

tell application "Numbers" to tell document dName to tell sheet sName to tell table tName


-- just reset the focus on the table

end tell


(*

Paste in the cell *)

my raccourci("Numbers", "v", "c")

end run


--=====

(*

set { dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()

tell application "Numbers" to tell document dName to tell sheet sName to tell table tName

*)

on get_SelParams()

local d_name, s_name, t_name, row_num1, col_num1, row_num2, col_num2

tell application "Numbers" to tell document 1

set d_name to its name

set s_name to ""

repeat with i from 1 to the count of sheets

tell sheet i to set maybe to the count of (tables whose selection range is not missing value)

if maybe is not 0 then

set s_name to name of sheet i

exit repeat

end if -- maybe is not 0

end repeat

if s_name is "" then

if my parleAnglais() then

error "No sheet has a selected table embedding at least one selected cell !"

else

error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"

end if

end if

tell sheet s_name to tell (first table where selection range is not missing value)

tell selection range

set {top_left, bottom_right} to {name of first cell, name of last cell}

end tell

set t_name to its name

tell cell top_left to set {row_num1, col_num1} to {address of its row, address of its column}

if top_left is bottom_right then

set {row_num2, col_num2} to {row_num1, col_num1}

else

tell cell bottom_right to set {row_num2, col_num2} to {address of its row, address of its column}

end if

end tell -- sheet…

return {d_name, s_name, t_name, row_num1, col_num1, row_num2, col_num2}

end tell -- Numbers

end get_SelParams


--=====


on parleAnglais()

local z

try

tell application "Numbers" to set z to localized string "Cancel"

on error

set z to "Cancel"

end try

return (z is not "Annuler")

end parleAnglais


--=====


on decoupe(t, d)

local oTIDs, l

set oTIDs to AppleScript's text item delimiters

set AppleScript's text item delimiters to d

set l to text items of t

set AppleScript's text item delimiters to oTIDs

return l

end decoupe


--=====

(*

Creates a new iWork document from the Blank template and returns its name.

example:

set myNewDoc to my makeAnIworkDoc(theApp)

*)

on makeAnIworkDoc(the_app)

local maybe, path_to_the_App, nb_doc, doc_name

if the_app is "Pages" then

tell application "Pages"

set nb_doc to count of documents


makenewdocumentwith properties {template name:item 1 of templates}

end tell

else if the_app is "Numbers" then

tell application "System Events" to set maybe to the_app is in title of every application process

if not maybe then tell application theApp to activate

tell application "System Events"

set path_to_the_App to get application file of application processthe_app

end tell

tell application "Numbers"

set nb_doc to count of documents

open ((path_to_the_App as text) & "Contents:Resources:Templates:Blank.nmbtemplate:")

end tell

else

if my parleAnglais(theApp) then

error "The application “" & the_app & "“ is not accepted !"

else

error "l’application « " & the_app & " » n’est pas gérée !"

end if

end if


tell applicationthe_app

repeat until (count of documents) > nb_doc

delay 0.1

end repeat

set doc_name to name of document 1

end tell -- the_App

return doc_name

end makeAnIworkDoc


--=====


on activateGUIscripting()


(* to be sure than GUI scripting will be active *)

tell application "System Events"

if not (UI elements enabled) then set (UI elements enabled) to true

end tell

end activateGUIscripting


--=====

(*

==== Uses GUIscripting ====

*)

(*

This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.

It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.


I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.

*)

on raccourci(a, t, d)

local k

tell applicationa to activate

tell application "System Events" to tell application process a

set frontmost to true

try

t * 1

if d is "" then


key codet

else if d is "c" then


key codetusing {command down}

else if d is "a" then


key codetusing {option down}

else if d is "k" then


key codetusing {control down}

else if d is "s" then


key codetusing {shift down}

else if d is in {"ac", "ca"} then


key codetusing {command down, option down}

else if d is in {"as", "sa"} then


key codetusing {shift down, option down}

else if d is in {"sc", "cs"} then


key codetusing {command down, shift down}

else if d is in {"kc", "ck"} then


key codetusing {command down, control down}

else if d is in {"ks", "sk"} then


key codetusing {shift down, control down}

else if (d contains "c") and (d contains "s") and d contains "k" then


key codetusing {command down, shift down, control down}

else if (d contains "c") and (d contains "s") and d contains "a" then


key codetusing {command down, shift down, option down}

end if

on error

repeat with k in t

if d is "" then


keystroke (k as text)

else if d is "c" then


keystroke (k as text) using {command down}

else if d is "a" then


keystrokekusing {option down}

else if d is "k" then


keystroke (k as text) using {control down}

else if d is "s" then


keystrokekusing {shift down}

else if d is in {"ac", "ca"} then


keystroke (k as text) using {command down, option down}

else if d is in {"as", "sa"} then


keystroke (k as text) using {shift down, option down}

else if d is in {"sc", "cs"} then


keystroke (k as text) using {command down, shift down}

else if d is in {"kc", "ck"} then


keystroke (k as text) using {command down, control down}

else if d is in {"ks", "sk"} then


keystroke (k as text) using {shift down, control down}

else if (d contains "c") and (d contains "s") and d contains "k" then


keystroke (k as text) using {command down, shift down, control down}

else if (d contains "c") and (d contains "s") and d contains "a" then


keystroke (k as text) using {command down, shift down, option down}

end if

end repeat

end try

end tell

end raccourci


--=====

--[/SCRIPT]

--{code}


Don't forget to resize the cell after running the script.

User uploaded file


Yvan KOENIG (VALLAURIS, France) mardi 31 janvier 2012

iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2

My Box account is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

Aug 28, 2012 12:21 PM in response to jester12345

You can generally do what Yvans script does by making a text box, entering the desired text, rotate the text box 90 degrees, copy the rotated text box, open Preview create a new document using the clip board (select the menu item "File > New from Clipboard"), the use the rectangular selection tool to select the text in Preview, copy, then paste back in a cell in Numbers. adjust the height of the cell to scale the text as needed

Aug 28, 2012 6:57 PM in response to bosg

While there is no way to rotate text in a cell and have it act like text in a cell (i.e., use it in formulas, sorting, etc. or change the font or formatting), you can make a rotated image background for the cell. The image background is part of the cell, unlike a text box placed over the cell. It is not exportable to Excel but neither is a rotated text box placed over a cell. Yvan's script does basically this same thing, creating an image background, but I think it has a problem. Here is one way to do it using Numbers and Preview:


  1. Make a text box in Numbers and enter your text in it
  2. Rotate the box 90 degrees using the Metrics Inspector
  3. With the text box (not the text, the box) selected, Copy
  4. Open the Preview app and choose File/New from Clipboard
  5. Select the image in the sidebar of the Preview App
  6. Drag the image to a cell in Numbers and drop it there.
  7. Resize the cell.


If you have the fill set to "scale to fit", the text will change size to fit the size of the cell. If you have it set to "original size" it will not change size. The other options give other results; try them all to get what you want.


Here is an example showing the same image background in three different size cells with them set to "scale to fit"


User uploaded file

Nov 30, 2012 8:12 AM in response to Badunit

Badunit, that is AWESOME!


it took me a bit to figure out what you meant by "Open the Preview app." (I was looking for this in Numbers, but you mean the App that previews images.... duh)


then, when you said, "select the image in the sidebar of the Preview App," I finally figured out that this means, View --> Thumbnails.


anyway, thanks for posting that. It works great.

Is it possible to rotate text in a cel. (really in the cel!!)

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