求助,不同版本表格区域数据读写的问题?

如题,在不同的wps版本中,对表格区域数据的整体读写存在显著差异,在开发表格js时,无法事先知道使用者的版本,导致兼容性差,结果出错,如何解决?具体如下:

  1. 读区域数据

表格数据如下图:

使用一下代码读取数据:

let sht1 = ThisWorkbook.Sheets("Sheet1");

let arrV = sht1.Range("A1:C2").Value2;

在win 11电脑的wps中,能正常读取,arrV是预想的值

arrV = [ [1, 2, 3], [4, 5, 6]]

但在win7的wps(版本11.8.2.10229)中,读取就出了问题,竟然是按“先列后行 ”的方式读取,与正常的理解不同。

读取的结果:arrV = [ [1, 4, 2], [5, 3, 6]]

  1. 区域写数据,同样存在问题

下面的代码,在win 11电脑的wps中能正常写入,但在win7的wps(版本11.8.2.10229)就出错,结果完全不一样。

let arrV = [[1, 2, 3], [4, 5, 6]];

let sht1 = ThisWorkbook.Sheets("Sheet1");

sht1.Range("A1:C2").Value2 = arrV;

福建省
浏览 633
2
5
分享
5 +1
1
2 +1
全部评论 1
 
企业用户_561880361
补充一下,win11的Wps版本为 12.1.0.16929
· 福建省
回复