From 863410f6eb47169dd02767a26e9c83d9df026ec4 Mon Sep 17 00:00:00 2001 From: kdevilpf <459373440@qq.com> Date: Thu, 17 Dec 2020 14:38:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86src/methods/get.js?= =?UTF-8?q?=E7=9A=84getRangetxt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/methods/get.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/methods/get.js b/src/methods/get.js index 55461cc..606b8db 100644 --- a/src/methods/get.js +++ b/src/methods/get.js @@ -19,7 +19,17 @@ function getRangetxt(sheetIndex, range, currentIndex) { } if (sheetIndex != currentIndex) { - sheettxt = Store.luckysheetfile[getSheetIndex(sheetIndex)].name + "!"; + //sheet名字包含'的,引用时应该替换为'' + sheettxt = Store.luckysheetfile[getSheetIndex(sheetIndex)].name.replace(/'/g,"''"); + //如果包含除a-z、A-Z、0-9、下划线等以外的字符那么就用单引号包起来 + if(/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/.test(sheettxt)) + { + sheettxt = sheettxt+"!"; + } + else + { + sheettxt="'"+sheettxt+"'!"; + } } let row0 = range["row"][0], row1 = range["row"][1]; @@ -86,4 +96,4 @@ export { getconfig, getvisibledatarow, getvisibledatacolumn, -} \ No newline at end of file +}