我正在尝试从模板文件在 Google 文档中生成报告。当它复制文档时,它会将所有格式重置为用户的默认格式,而不是原始文档中的格式。我尝试了以下方法来尝试在文档、tableRow 和 tableCell 级别上设置格式,尽管创建报告时行距为 1.5 并且段落后有空格
var style = {};
style[DocumentApp.Attribute.SPACING_AFTER] =0;
style[DocumentApp.Attribute.SPACING_BEFORE] =0;
style[DocumentApp.Attribute.LINE_SPACING]=1;
var newrow= tables[2].insertTableRow(n).setBold(false).setAttributes(style);
if(j==0){
newrow.insertTableCell(0,reportDate).setPaddingBottom(0).setPaddingTop(0).setAttributes(style);
}
else{
newrow.insertTableCell(0,'').setPaddingBottom(0).setPaddingTop(0).setAttributes(style);
}
newrow.insertTableCell(0,values1[rowId1][1]+' '+values1[rowId1][2]).setPaddingBottom(0).setPaddingTop(0).setAttributes(style);
newrow.insertTableCell(0,'').setPaddingBottom(0).setPaddingTop(0).setAttributes(style);
doc.editAsText().setAttributes(style);
关于如何让报告遵循这些属性的任何建议?