2022.2

Table Of Contents
WhengeneratingEmailoutputwiththePrintcontextasattachment,theemailwillhavetwoattach-
ments:
l
attachment1:SectionA,SectionB
l
attachment2:"Part2",whichisSectionC.Thefilenameofthisattachmentisthepartname.
Note: ForWebsections,apartalwaysconsistsofonlythegivensection.Webpagescannotbe
appendedtoformasinglepart.ItishoweverpossibletoattachmultipleWebpagestooneemail;
seethefollowingexample.
Controlling multiple Email attachments
Thefollowingscriptattachesthefollowingsectionstoanemail:
l
Printsection3+4asattachmentwithcontinuedpagenumbers
l
Printsection6asseparateattachment
l
WebsectionsAandBasseparateattachments
if (channel == Channel.EMAIL) { // only when generating Email output
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section 1'].enabled = false;
merge.context.sections['Section 2'].enabled = false;
merge.context.sections['Section 3'].enabled = true;
merge.context.sections['Section 3'].part = "PDFAttach1";
merge.context.sections['Section 4'].enabled = true;
merge.context.sections['Section 4'].restartPageNumber = false;
merge.context.sections['Section 5'].enabled = false;
merge.context.sections['Section 6'].enabled = true;
merge.context.sections['Section 6'].part = "PDFAttach2";
} else if (merge.context.type == ContextType.WEB) {
merge.context.sections['default Section'].enabled = false; // disable
whatever is the default section
merge.context.sections['Section A'].enabled = true;
merge.context.sections['Section A'].part = "WebPartA";
merge.context.sections['Section B'].enabled = true;
merge.context.sections['Section B'].part = "WebPartB";
}
}
Note: Foranotherexample,seethishow-to:Outputsectionsconditionally.
Page 844