4

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

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.

如何解决这个问题呢?

4

1 回答 1

1

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

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"
};
于 2019-10-04T18:37:03.850 回答