最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Exceljs数据验证列表导致Excel女士出错

运维笔记admin16浏览0评论

Exceljs数据验证列表导致Excel女士出错

Exceljs数据验证列表导致Excel女士出错

我使用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.

如何解决此问题?

回答如下:

反转数据验证公式中的引号。看起来它仅支持并识别theother一个。

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"
}

};

发布评论

评论列表(0)

  1. 暂无评论