OfficeScript.EmailAttachment interface

要随电子邮件一起发送的附件。 必须至少为一个 to、 或 bcccc或 参数指定值。 如果未指定收件人,则会显示以下错误:“邮件没有收件人。 请至少为“收件人”、“抄送”或“密件抄送”参数之一输入一个值。

注解

使用方

示例

/**
 * This script saves a worksheet as a PDF and emails that PDF to a recipient.
 */
function main(workbook: ExcelScript.Workbook) {    
    // Create the PDF.
    const pdfObject = OfficeScript.convertToPdf();
    const pdfFile = { name: "report.pdf", content: pdfObject }; // Enter your desired PDF name here.

    // Email the PDF.
    OfficeScript.sendMail({
        to: "name@email.com", // Enter your recipient email address here.
        subject: "[Demo] Monthly Sales Report", // This is the subject of your email.
        content: "Here's the Monthly Sales Report", // This is the content within your email.
        attachments: [pdfFile]
    })    
}

属性

content

文件的内容。

name

表示附件的图标下方显示的文本。 此字符串不需要与文件名匹配。

属性详细信息

content

文件的内容。

content: string;

属性值

string

name

表示附件的图标下方显示的文本。 此字符串不需要与文件名匹配。

name: string;

属性值

string