在UI服务中:试图查看HTML内容 [英] In UI service : trying to view HTML content

查看:100
本文介绍了在UI服务中:试图查看HTML内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在UI服务中,我试图使用createHTML()或createRichTextArea()来查看HTML内容,但它没有显示任何内容。
HTML数据作为文档转换中的变量(请参阅下面的代码),如果我保存,则可以在浏览器中阅读。当设置为电子邮件中的html内容时(使用Mailapp),它也可以工作。
所以我的问题是:是否有任何已知的限制这些小部件中的html内容?编辑:限制并不完全适合长期!禁止将是最好的; - )



有关信息,这里是我用来获取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;


解决方案

这里列出了UiApp中HTML支持的标签: https://developers.google.com/apps-script/releases/2012#march_2012 b
$ b


新增了在使用UiApp小部件时包含一组有限HTML标记的能力,以回应此问题。以下是允许的HTML标签列表: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


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;

解决方案

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

这篇关于在UI服务中:试图查看HTML内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆