functioncountWordsAndTime() { var doc = DocumentApp.getActiveDocument(); var body = doc.getBody(); var tables = body.getTables(); var totalCharacters = 0; var totalTime = 0; var totalCharactersUnchecked = 0; var totalTimeUnchecked = 0; var checkedCount = 0; var scriptTable = tables[2];
// 遍歷分鏡表格的每一行,並判斷是否是統計行,如果是,則移除該行,以便重新添加新的統計行。
var numRows = scriptTable.getNumRows(); for (var i = numRows - 1; i >= 0; i--) { var row = scriptTable.getRow(i); var cellText = row.getCell(1).getText().trim(); if (cellText.startsWith('打勾數量') || cellText.startsWith('全部對白字數')) { scriptTable.removeRow(i); scriptTable.removeRow(i); } }
for (var i = 1; i < scriptTable.getNumRows(); i++) { var row = scriptTable.getRow(i); var hasActor = row.getCell(5).getText().trim(); var dialogue = row.getCell(3).getText(); var duration = row.getCell(4).getText().trim();