update at 2026-02-14 11:01:22

This commit is contained in:
douboer@gmail.com
2026-02-14 11:01:22 +08:00
parent 53c7fa7b81
commit 78896060b2
3 changed files with 20 additions and 9 deletions

View File

@@ -251,7 +251,11 @@ function parseXlsxBuffer(buffer) {
throw new Error('当前环境未启用 xlsx 解析,请先在开发者工具执行“构建 npm”');
}
const workbook = xlsx.read(buffer, { type: 'array' });
const workbook = xlsx.read(buffer, {
type: 'array',
// 兼容部分旧版 xls 在小程序环境下的中文 codepage 解析。
codepage: 936
});
const firstSheetName = workbook.SheetNames[0];
if (!firstSheetName) {
throw new Error('Excel 文件中没有工作表');