How to unset a characterStyle characterAttribute?
I am writing a script that will replace one Character Style with another:
- OldStyle - size: 40pt · Font Family: Verdana · Font Style: Italic
- NewStyle - Font Family: Comic Sans · Font Style: Bold
It was easy to apply the properties of the new style to the old style.
But I cannot find out how to remove the Size: 40pt from OldStyle. I have tried:
oldStyle['size'] = false; // invalid text range
oldStyle['size'] = undefined; // numeric value expected
oldStyle['size'] = null; // numeric value expected
oldStyle.characterAttributes['size'] = false; //numeric value expected
oldStyle.characterAttributes['size'] = undefined; //numeric value expected
oldStyle.characterAttributes['size'] = null; //numeric value expected
delete oldStyle.characterAttributes['size']; // no error but didn't work
delete oldStyle['size']; // no error but didn't work
oldStyle['size'].remove();
// oldStyle['size'].remove is not a function
oldStyle.characterAttributes['size'].remove();
// oldStyle.characterAttributes['size'].remove is not a function
oldStyle.characterAttributes['size'].remove;
// oldStyle.characterAttributes['size'].remove is not a function
oldStyle.characterAttributes['size'] = newStyle.characterAttributes['size'];
// the requested attribute is undefined for the text range
oldStyle['size'] = newStyle['size'];
// the requested attribute is undefined for the text range
I can't think of anything else to try, but I still need to remove the "size" property from the NewStyle style definition.
Anybody got any ideas?