我有一个包含html的字符串Transaction T1 Transaction T2 Transaction T3
Write (A)
Write (B)
Read (C)
Read (B)
Read (B)
,我希望以这样的方式将其保存在已打开的Google文档格式文件中:str
如何以doc格式转换该字符串?
答案 0 :(得分:2)
这对我来说很好用
function html_to_doc()
{
var html = '<html><body><h1><i><b>HEADING</b></i></h1></body></html>';
var mediaData = Utilities.newBlob("").setDataFromString(html, "UTF-8").setContentType("text/html");
var resource = {
title: "Html_to_doc",
};
var optionalArgs = {
convert: true
};
var newFileId = Drive.Files.insert(resource, mediaData, optionalArgs);
}