In UI service : trying to view HTML content

2019-02-20 23:51发布

In UI service I'm trying to view HTML content using both createHTML() or createRichTextArea() but it doesn't show anything. HTML data comes as a variable from a document conversion (see code below) and is readable in a browser if I save it. It's also working when set as html content in an email (using Mailapp). So my question is : is there any known restriction regarding html content in these widgets ?

EDIT : restriction is not exactly the appropriate term ! forbidden would be best ;-)

for info, here is the code I use to get the html :

  var url = 'https://docs.google.com/feeds/';
  var doc = UrlFetchApp.fetch(url+'download/documents/Export?exportFormat=html&format=html&id='+id,
                              googleOAuth_('docs',url)).getContentText();
  var show= app.getElementById('bodyhtm').setHTML(doc);
  Logger.log(doc)
  return app;

1条回答
Deceive 欺骗
2楼-- · 2019-02-21 00:30

The supported tags for HTML in UiApp are listed here: https://developers.google.com/apps-script/releases/2012#march_2012

Added the ability to include a limited set of HTML tags when working with UiApp widgets, in response to this issue. Here is the list of HTML tags that are permitted: B, BLOCKQUOTE, BODY, BR, CENTER, CAPTION, CITE, CODE, DIV, EM, H1, H2, H3, H4, H5, H6, HR, I, LABEL, LEGEND, LI, OL, P, SPAN, STRONG, SUB, SUP, TABLE, TBODY, TD, THEAD, TITLE, TR, TT, UL

查看更多
登录 后发表回答