2014-12-29 51 views

回答

0

這是不可能的氣體。

即使列表項目在文檔中不連續,您可以得到的最接近的方式是繼續列表的編號。爲此,請在現有項目上使用.getListId(),然後在您要追加的新項目上使用.setListId(id),獲取上一個清單項目的清單ID。

+0

謝謝,我正在尋找的是繼續在不同文件之間的有序號碼列表,我認爲這是不可能的。 – lucanapo

+0

不是。同樣在上面的答案中,不幸的是,setListID不能這樣工作。您只能將其設置爲與現有列表項目相同: item2.setListId(item1) –

0

可以使用insertListItem()方法插入一個列表項:

Google Documentation - insertListItem

var body = DocumentApp.getActiveDocument().getBody(); 

// Append a new list item to the body. 
var item1 = body.insertListItem(childIndex, listItem); 

// Log the new list item's list ID. 
Logger.log(item1.getListId()); 
相關問題