【问题标题】:How to create EXCEL and WORD file using SuiteScript 2.0?如何使用 SuiteScript 2.0 创建 EXCEL 和 WORD 文件?
【发布时间】:2020-02-28 11:01:09
【问题描述】:

我正在使用 HTML Suitelet 创建 Word 和 Excel,我能够创建 CSV 和 PDF 文件,但无法创建 Word 或 Excel。我该怎么做?

file.create({name:'testinvoice.pdf',fileType:file.Type.PDF, contents:pdffile.getContents()});

【问题讨论】:

  • 嗨,如果你能解决这个问题,你能告诉我吗?我面临同样的问题。正在创建 WORD 文件,但在打开时出现错误。这是我的示例代码 ``` /** *@NApiVersion 2.x *@NScriptType ScheduledScript */ define(['N/file'], function(file) { function execute(context) { // 创建一个包含text var fileObj = file.create({ name: 'test.docx', fileType: file.Type.WORD, contents: 'Hello' }); var fileContent=fileObj.getContents({ }); log.debug('Contents ',文件内容);返回{执行:执行}}); ```

标签: javascript netsuite suitescript


【解决方案1】:

查看帮助中心中的 file.Type 枚举。 file.Type.WORD 和 file.Type.EXCEL 都受支持,但您的 file.Create 可能会失败,因为可能无法创建内容。我认为这个堆栈溢出问题将有助于创建 XLS 文件:Create Excel File in NetSuite's SuiteScript

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-05
    • 2016-11-16
    • 1970-01-01
    • 2019-12-26
    • 2010-11-03
    • 1970-01-01
    相关资源
    最近更新 更多