google-apps-script - 如何以编程方式合并 Google 文档表格中的单元格

标签 google-apps-script google-docs google-docs-api

<分区>

所以我看到您可以合并单元格,以便它们跨越 文档 表格中的多个列,方法是选择两个或多个单元格并从文档菜单中选择“合并”。

我的问题是如何以编程方式执行此操作?例如,如果您

myTable.getChild(0).asTableRow().getCell(1).merge()

它只是将单元格 (1) 与单元格 (0) 合并,所有后续单元格向左移动一列,而不是将合并后的单元格跨越两列。

这里有什么帮助吗?

最佳答案

这里是对你的问题的解释:

merge()

Merges the element with the preceding sibling of the same type.

Only elements of the same ElementType may be merged. Any child elements contained in the current element are moved to the preceding sibling element.

The current element is removed from the document.

这是 document以供更多引用。

关于google-apps-script - 如何以编程方式合并 Google 文档表格中的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29683529/

相关文章:

google-docs - 在DSUM中使用多个手动条件的Google文档

google-apps-script - Google 文档是否有内容控制?

google-drive-api - 谷歌文档 API : Do document resource ID's ever change?

javascript - 正在寻找一种使用 Google Apps 脚本或 DOCS API 向 Google 文档中的段落添加边框的方法?

javascript - 如何使用 JS 从 Google Drive 复制文件夹以在 Google Drive 中创建新文件夹

excel - 在谷歌表格中比较 SUMIFS 函数中的日期的结果不正确

python - 如何使用 python 将文本附加到 Google Docs 文档的末尾?

google-apps-script - 另一个 Google Apps 脚本 UrlFetchApp 返回未经授权的错误 401

json - 可以使用 "initialData"属性将 App 脚本参数写入 Stackdriver 消息吗?