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 |
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] |
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] |
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 08:47 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.