I'm having similar issues to the above poster.
According to the OmniOutliner AppleScript Dictionary, a cell contains text(s) element(s), which are specified elsewhere in the docs to contain elements including attribute runs, characters, and paragraphs.
However, whenever I ask a cell for its text, I get a string, not a text object, so asking that object for "attribute runs" (an element) or "color" (a property) results in an error (strings don't know about those things).
In fact, the value returned from "text of aCell" seems to be exactly the same as the property "value" of that cell--both strings.
Here is the code I've been playing with trying to get what I want to work (more verbose than I would like, but I can't yet find the magic combo):
tell front document of application "OmniOutliner Professional"
repeat with aRow in selected rows
set rowTopic to topic of aRow
set rowCells to cells of aRow
set rowStyle to style of aRow
set rowStyleName to name of named style of rowStyle
display dialog ¬
("Row " & quote & rowTopic & quote & return & ¬
"RowStyle: " & rowStyleName ¬
)
repeat with aCell in rowCells
-- first column is notes, 2nd is the default content column
set cellText to text of aCell
set cellValue to value of aCell
display dialog ¬
("Cell[" & (topic of row of aCell) & ", " & (name of column of aCell) & ¬
"]: " & "Text: " & quote & cellText & quote & return ¬
& "Value: " & quote & cellValue & quote & return ¬
)
if (length of cellText > 0) then
-- set cellContent to attribute run of text of aCell
set cellContent to paragraphs of cellText
-- set cellContent to paragraph of aCell
if ((count of cellContent) > 0) then
set cellStyle to style of first item of cellContent
set cellStyleName to name of named style of cellStyle
else
set cellStyleName to "no content to get style from?"
end if
else
set cellContent to ""
set cellStyleName to "no text to get style from?"
end if
display dialog ¬
("Cell[" & (topic of row of aCell) & ", " & (name of column of aCell) & ¬
"]: " & quote & cellContent & quote & return ¬
& "Style: " & cellStyleName ¬
)
end repeat
end repeat
end tell
My goal is to get the named style of the style of the paragraph within a cell (I've tried asking for both paragraph and paragraphs, but since the object I'm asking is a string and not an actual "text" object I get an error in both cases). The OmniOutliner Suite for paragraph adds the "style" property, but since I can't get the paragraph from the cell in the first place I don't get far enough to ask for the style (let alone the named style of the style).
The above code works great for obtaining the name of the named style of the row style, and other code I have works great finding the column style, but I just can't get the contents of a cell to be represented in a object that responds to "style".
I don't think this issue is specific to styles or named styles, but more generically "how does one get not just a string but an object representing the contents of the cell"?
Thank you,
Scott