The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   Removing Row Style Elements OO3 (http://forums.omnigroup.com/showthread.php?t=29190)

Simon Knight 2013-04-19 04:49 AM

Removing Row Style Elements OO3
 
Hi,

I am writing a script that removes and sets named styles based on the values set by the user in certain columns. The script works but....... if at some point the user sets for example the font colour and size then these settings override the settings contained in the named style. Does anyone know the syntax required to remove all the styles set by the user from a given row?

best wishes

Simon

RobTrew 2013-05-11 08:39 AM

Didn't spot this, and I imagine you've probably solved it by now, but essentially you should be able to drop the manually applied styles by converting from a text object to a plain string and back again.

[CODE]tell application id "OOut"
tell front document
-- WHICH OF THE COLUMNS ARE RICH TEXT ?
set lstColID to id of columns where its type = rich text

-- WITH SELECTED ROWS, FOR EXAMPLE
repeat with oRow in selected rows
repeat with strColID in lstColID

-- EXTRACT THE PLAIN TEXT, AND RESET THE TEXT OBJECT
tell cell id strColID of oRow
set strText to value
set value to strText
end tell
end repeat
end repeat
end tell
end tell
[/CODE]

RobTrew 2013-05-11 08:45 AM

You might, of course, want to exclude the note from this, as in:

[CODE]tell application id "OOut"
tell front document
-- WHICH OF THE COLUMNS ARE RICH TEXT ?
set lstColID to id of columns where its type = rich text

-- EXCLUDE THE NOTE ?
set strNoteID to id of note column

-- WITH SELECTED ROWS, FOR EXAMPLE
repeat with oRow in selected rows
repeat with strColID in lstColID

-- UNLESS THIS IS THE NOTE, RESET THE TEXT OBJECT
if (contents of strColID) ≠ strNoteID then
tell cell id strColID of oRow to set value to value as string
end repeat
end repeat
end tell
end tell
[/CODE]

hitechito 2013-05-17 09:46 PM

I noticed that, and I think I probably decide now, but in fact, you should be able to abandon the style applied manually by converting a text object in a string and returns regularly.

tell application id "OOut"
tell front document
-- WHICH OF THE COLUMNS ARE RICH TEXT ?
set lstColID to id of columns where its type = rich text

-- EXCLUDE THE NOTE ?
set strNoteID to id of note column

-- WITH SELECTED ROWS, FOR EXAMPLE
repeat with oRow in selected rows
repeat with strColID in lstColID

-- UNLESS THIS IS THE NOTE, RESET THE TEXT OBJECT
if (contents of strColID) ≠ strNoteID then
tell cell id strColID of oRow to set value to value as string
end repeat
end repeat
end tell
end tell


All times are GMT -8. The time now is 09:55 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.