OfficeScript.DownloadFileProperties interface

要下载的文件。

注解

使用方

示例

/**
 * 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: OfficeScript.DownloadFileProperties = { name: "report.pdf", content: pdfObject }; // Enter your desired PDF name here.

    // Download the PDF.
    OfficeScript.downloadFile(pdfFile);

    // 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

下载后文件的名称。 文件扩展名确定文件的类型。 支持的扩展名为“.txt”和“.pdf”。 默认值为“.txt”。

属性详细信息

content

文件的内容。

content: string;

属性值

string

name

下载后文件的名称。 文件扩展名确定文件的类型。 支持的扩展名为“.txt”和“.pdf”。 默认值为“.txt”。

name: string;

属性值

string