使用Google应用程序脚本将HTML表格导入Google文档 [英] Importing a HTML table into a google doc using google app script

查看:99
本文介绍了使用Google应用程序脚本将HTML表格导入Google文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将来自JIRA的数据导入Google文档。其中一个字段是描述,它基本上是HTML文本。

I'm importing data from JIRA into a Google Doc. One of the fields would be the description, which is basically HTML text.

有什么方法可以在Google Doc中添加这个HTML文本吗?或者我真的必须手动解析它,并创建段落,表格等?

Is there any way to "add" this HTML text on a Google Doc? Or do I really have to parse it manually and create paragraphs, tables, etc.?

HTML可能如下所示:

The HTML could look as follows:

<p>Hello There</p>
<table class='confluenceTable'>
    <tbody>
        <tr>
            <th class='confluenceTh'> Name </th>
            <th class='confluenceTh'> Hours </th>
            <th class='confluenceTh'> Cost </th>
        </tr>
        <tr>
            <td class='confluenceTd'> Some Person</td>
            <td class='confluenceTd'> 1 </td>
            <td class='confluenceTd'> CHF 1</td>
        </tr>
    </tbody>
</table>


推荐答案

我能够创建一个 / strong> Doc在我的此帖中的评论中提到的更改中带有样式化html内容的文档:

I was able to create a new Doc with styled html content from the change mentioned in my comment in this post:

var blob = Utilities.newBlob(content, {mimeType:"text/html"});
var newfile = Drive.Files.insert(resource, blob, {"convert":"true"});

这篇关于使用Google应用程序脚本将HTML表格导入Google文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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