AppleScript iWork Numbers: Matching Columns named with EOL/Return

I have not been able to find the correct AppleScript mojo to match column names that contain EOL/return characters, such as:

“Directory Services Group
Short Name”

The return/EOL between Group and Short is not created by Numbers’ line justification but is an actual return character.

If I drop the return character, I can easily find the value of a given row aRowNum for a column in AppleScript with:

		tell application "Numbers" to set aDSShortName to value of cell aRowNum of column ("Directory Services Group Short Name") of aTable

but none of the following seem to match when the return is involved:

		tell application "Numbers" to set aDSShortName to value of cell aRowNum of column ("Directory Services Group" & linefeed & "Short Name") of aTable

		tell application "Numbers" to set aDSShortName to value of cell aRowNum of column ("Directory Services Group" & return & "Short Name") of aTable

What is the magic incantation to make this work? Of course I can just get rid of the return in my column name in Numbers, but I’d rather get this figured out and keep the spreadsheet looking nicer…

Scott

PS Script needs to work on both Snow Leopard and Lion (I’m currently testing it on SL)

As far as I know, we can’t use header names to build cells references in AppleScript.
value of cell 5 of column 3
and
value of cell 5 of column “C”
and
value of cell 5 of column “cheval”

but

value of cell 5 of column “cheval” & return & “vapeur”
value of cell 5 of column “cheval” & linefeed & “vapeur”
value of cell 5 of column “cheval” & character id 8232 & “vapeur”
value of cell 5 of column “cheval” & character id 8233 & “vapeur”

aren’t.

So, in your case you must use :

value of cell 5 of column 3
and
value of cell 5 of column “C”

The first one seems to be most efficient.

I guess that the described behavior is linked to the way a value embedding a line break is stored by the app.

In the index.xml, we may see the way it’s stored:

sf:text-body
<sf:p sf:style=“tabular-Basic-header-row-cell-paragraph-style-id”>chevalsf:br/</sf:p>
<sf:p sf:style=“tabular-Basic-header-row-cell-paragraph-style-id”>vapeur</sf:p>
</sf:text-body>

Bingo, I got it

i[b]n the column name used in the script, replace the line break by a space.

value of cell 5 of column “cheval vapeur”
behave well.

But I repeat that it’s an efficient brake.[/b]

Yvan KOENIG (VALLAURIS, France) mardi 7 février 2012 18:55:01