Answered
Set TextFrame.contents to InDesign Tagged Text from variable
Hi, scripting InDesign, I'm aware you can do this:
var doc = app.activeDocument;
var myTextFrame = doc.textFrames.add();
myTextFrame.contents = "whatever I want to put here";
But I'd like to set the contents to be some tagged text, so that we can colourise some of the words, this would be generated in a rest api and contained in the json response, so is it possible to do this:
/* Code to get data from api... */
var response = api.getData();
var doc = app.activeDocument;
var myTextFrame = doc.textFrames.add();
myTextFrame.contents = response.taggedText; // this just shows the tagged text, with all the markup etc...
Is this possible to do? Or do I need to write the file out to disk and then use TextFrame.place( File fileName, Boolean showingOptions, Object withProperties )?
