Add header and footer to the output document if not already present
This commit is contained in:
parent
4b69914181
commit
594a0b41d7
8
Code.ts
8
Code.ts
@ -83,12 +83,12 @@ function generateForCurrentRow() {
|
|||||||
const out_doc = DocumentApp.openById(out_file.getId());
|
const out_doc = DocumentApp.openById(out_file.getId());
|
||||||
|
|
||||||
// Copy header
|
// Copy header
|
||||||
out_doc.getHeader().clear();
|
if (!out_doc.getHeader()) out_doc.addHeader();
|
||||||
copySection(template_doc.getHeader(), out_doc.getHeader());
|
copySection(template_doc.getHeader(), out_doc.getHeader().clear());
|
||||||
|
|
||||||
// Copy footer
|
// Copy footer
|
||||||
out_doc.getFooter().clear();
|
if (!out_doc.getFooter()) out_doc.addFooter();
|
||||||
copySection(template_doc.getFooter(), out_doc.getFooter());
|
copySection(template_doc.getFooter(), out_doc.getFooter().clear());
|
||||||
|
|
||||||
const insert_point = template_doc
|
const insert_point = template_doc
|
||||||
.getBody()
|
.getBody()
|
||||||
|
Reference in New Issue
Block a user