1 person found this helpful
Textframes insertion point 0 has the None char style apllied
After scritp is run both Dave and Bill are in italic.
Perhaps apply style after inserting the text will help.
What style does the none italic word have?
Message was edited by: Thomas B. Nielsen
Thanks for testing it for me.
You're right, if I start with a new document then it's fine. If I start with the template file that I'm using I am having the issue. It's not a particular textframe causing the behaviour because I place a new textframe each time I insert text. However, it is something to do with the document itself.
You mention applying the style after placing the text. This seems like an option worth trying. Do have a simple example of how to do that. I'm pretty new to scripting in Indesign. I presume I have to select a certain portion of the text and then use some sort of command like:
selection.appliedCharacterStyle = 'Italics';
But, how can I select text and then reference that selected text?
If you will select the text with the mouse and then get a reference to it, you can do something like:
app.activeDocument.selection.appliedCharacterStyle = 'Italics'; // depending on what the selection is (it needs to have the option of appliedCharacterStyle
But you dont need to select something to work on it, to use your previous example:
r = app.activeWindow.activeSpread.groups.item('Group1').textFrames.item('Text1');
r.paragraphs.appliedCharacterStyle = 'Italics';