2
A
回答
1
請看Henrique的this post,它使用定義爲available in the doc的不同文檔元素...您應該選擇一個您需要的文檔並添加相應的例程。
這是怎麼一回事呢(代碼從原來的職位):
function mergeDocs() {
var docIDs = ['list-of','documents','ids','you should have somehow'];
var baseDoc = DocumentApp.openById(docIDs[0]);
var body = baseDoc.getActiveSection();
for(var i = 1; i < docIDs.length; ++i) {
var otherBody = DocumentApp.openById(docIDs[i]).getActiveSection();
var totalElements = otherBody.getNumChildren();
for(var j = 0; j < totalElements; ++j) {
var element = otherBody.getChild(j).copy();
var type = element.getType();
if(type == DocumentApp.ElementType.PARAGRAPH)
body.appendParagraph(element);
else if(type == DocumentApp.ElementType.TABLE)
body.appendTable(element);
else if(type == DocumentApp.ElementType.LIST_ITEM)
body.appendListItem(element);
else
throw new Error("According to the doc this type couldn't appear in the body: "+type);
}
}
}
相關問題
- 1. 將腳本複製到Google文檔的應用程序腳本
- 2. 複製Google文檔包括使用Drive SDK的嵌入腳本
- 3. 此Google Apps腳本文檔頁面是否有錯誤?
- 4. Google Apps腳本 - 向文檔添加動態頁眉/頁腳
- 5. Google Apps腳本:腳本格式文檔中奇怪的頁面佈局
- 6. Google文檔:onOpen()不會在複製的文檔+腳本中執行
- 7. Google文檔腳本addToFolder
- 8. Excel到Google文檔 - 腳本
- 9. 如何編寫腳本複製文檔
- 10. html頁面沒有複製腳本
- 11. Google Apps腳本。 *複製*文件
- 12. Google文檔到Google表格腳本
- 13. Google文檔ImportXML從腳本中調用
- 14. Google Apps腳本MailApp使用htmlBody文檔
- 15. 使用Google Apps腳本清除文檔
- 16. 複製文檔的頁面,每個頁面
- 17. 如何使用Google Apps腳本在文檔中添加頁碼
- 18. 使用腳本在Google表格(驅動器/文檔)中複製相關公式
- 19. 訪問Google文檔中的Google Apps腳本腳本
- 20. 使用應用腳本將HTML呈現爲Google文檔?
- 21. Google Apps腳本:如何自動將文檔複製到新文件夾?
- 22. 腳本自動製作Google文檔的副本進行編輯
- 23. 應用腳本代碼在另一個Google文檔帳戶中創建文檔
- 24. 在我的腳本中引用someelse的google文檔腳本庫
- 25. 將頁眉和頁腳複製到所有其他文檔OpenXML
- 26. 使用Zend Gdata Google文檔複製文檔API
- 27. 在Google應用程序腳本中注入外部JavaScript文件(Google文檔)
- 28. 在Google文檔中使用谷歌應用程序腳本選擇文本
- 29. 我試圖使用Google腳本將模板文檔的整個標題複製到新文檔中
- 30. 如何使用任何命令行工具或腳本將Word文檔內容複製到Google文檔
嗨,你爲什麼要刪除自己的答案嗎?這是正確的方法,只是有點不完整...... ;-) –
如果我沒有記錯,我的解決方案停止工作,因爲谷歌改變了界面。 – oneself