If I have the string:
var text = "Altman, R. (1992). Sound space. In R. Altman (Ed.), <em>Sound Theory Sound Practice</em> (pp. 46–64). New York: Routledge.";How can I insert this into Google Docs with the required italics intact?
var cursor = DocumentApp.getActiveDocument().getCursor();cursor.insertText('here: '+ text);Inserts the text as is (without displaying italics and showing the <em>...</em>).
A few people have asked similar questions here without success mostly getting answers that relate to creating a new document using the Drive service (I want to insert HTML text anywhere in an existing document).
I've come across intriguing snippets such as:
var text = Utilities.newBlob("").setDataFromString(response.bibEntry, "UTF-8").setContentType("text/html");or:
var text = doGet('<b>Hello, world!</b>');function doGet(text) {return HtmlService.createHtmlOutput(text);}But these appear to return objects which I've no idea how to use – trying to use insertText(text), I get 'Blob' and 'HtmlOutput' respectively.