node.js - Exceljs数据验证列表导致Excel女士出错

标签 node.js exceljs

我使用 exceljs Node 模块并添加下拉数据验证

worksheet.getCell(cell).dataValidation = {
  type: 'list',
  allowBlank: true,
  formulae: ['"One,Two,Three,Four"'],
  showErrorMessage: true,
  errorStyle: 'error',
  errorTitle: 'Error',
  error: 'Value must be in the list'
};

文件生成成功。但它只能使用 Libre Office 打开。用Office小姐打开文件会出现如下错误:

Excel completed file level validation and repair.
Some parts of this workbook mau have been repaired or discarded.
Repaired Part: /xl/worksheets/sheet1.xml part.

如何解决这个问题?

最佳答案

在数据验证公式中反引号。它只支持和识别另一个

worksheet.getCell(cell).dataValidation=
{
    type : "list",
    allowBlank : true,
    formulae : ["'One,Two,Three,Four'"],//<--------------------------------Right there
    showErrorMessage : true,
    errorStyle : "error",
    errorTitle : "Error",
    error : "Value must be in the list"
};

关于node.js - Exceljs数据验证列表导致Excel女士出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48019987/

相关文章:

javascript - 来自 Angular 形式的 $http.post 不发送任何数据

Javascript nodejs JSON.parse 数组

c++ - 在 Node.js 和 v8 中调用使用包装对象作为参数的函数

javascript - 嵌套异步等待未按预期工作

node.js - 使用 node.js 修改现有 Excel 文件

javascript - 了解 Express NodeJs 路由器行为

node.js - React 应用程序使用什么服务器端代码

node.js - 无法修剪 exceljs 单元格值

node.js - 如何使用exceljs在node.js中下载创建的excel文件