我目前正在使用以下Google脚本在问题中添加换行符:
function addLineBreaks() {
var form = FormApp.getActiveForm();
var multiplechoices = form.getItems(FormApp.ItemType.MULTIPLE_CHOICE);
var date = form.getItems(FormApp.ItemType.DATE);
var textbox = form.getItems(FormApp.ItemType.TEXT);
var checkboxgrid = form.getItems(FormApp.ItemType.GRID)
questions = multiplechoices.concat(date, textbox, checkboxgrid);
for(i = 0; i < questions.length; i++) {
var title = questions[i].getTitle();
if(title.indexOf("\n") < 0) {
questions[i].setTitle(title.replace(" | ", "\n"));
}
}
}
我的问题是我无法在网格行和常规标题(Tt)中添加换行符。我确信这是因为我正在使用的脚本引用了getTitle
,但是无法使其与getRows
或setRows
一起使用。
我不介意添加“ |”并在脚本运行时将其替换为换行符,但是我确实需要找到有关网格的解决方案(仅适用于多选网格行)。