Aspose2月版本开始,存在下拉列表渲染有问题的问题

image.png (72.9 KB)

@feng.qun.zhu.avaryholding.com

请您提供更多关于下拉列表渲染问题的详细信息,例如您使用的代码或具体的错误信息。

下拉列表不展示下拉内容,点击报错Uncaught TypeError: Cannot read properties of undefined (reading ‘canselectunlocked’)
at t.value (xspreadsheet.js:12:832768)
at t.Vl (xspreadsheet.js:12:741554)
at t.dc (xspreadsheet.js:12:751094)
at xspreadsheet.js:12:766584
at HTMLDivElement. (xspreadsheet.js:12:4079)

@feng.qun.zhu.avaryholding.com
请提供下具体的文件,我试了下filter的下拉和validation的下拉,都是正常显示

您好,现在是程序加了以下excel保护的逻辑所以才出错的。
workbook.calculateFormula();
workbook.getWorksheets().get(0).protect(ProtectionType.ALL);
workbook.getWorksheets().get(1).protect(ProtectionType.ALL);
worksheet.protect(ProtectionType.ALL);
AsposeFileVo vo = new AsposeFileVo();
inventory-product-wip.7z (19.8 KB)

@feng.qun.zhu.avaryholding.com,

感谢您提供的示例文件。

我对您的场景/案例进行了一些测试。首先,我手动在 MS Excel 中打开您的 Excel 文件,使用 Excel 选项保护工作表,然后重新保存该 Excel 文件。现在,我使用在线 Excel 编辑器(使用了 Aspose.Cells.GridJs)将更新后的 Excel 文件打开到网格矩阵中。我测试了不同的下拉菜单,效果良好,控制台工具也没有出现任何异常。请您在手动保护工作表后保存您的 Excel 文件,并提供更新后的 Excel 文件,以便我们复现此问题,我们会尽快检查。

您好,
1、 java代码需要先把数据放入excel再加保护,若先手动加保护,数据就无法灌入进去。
2、然后有个线索提供您下;
我们发现咱们这边js取值更改过规则。
以下是无问题的版本

f670ca83411f47c3e6f7c7d934aa6090.png (14.7 KB)
以下是更改了取值逻辑,将this.protection赋值给n,后,我们这边就报错了
8a095cda4f6407b1ec1ee7dcdc5b4250.png (14.5 KB)
3、我们是vue渲染的,是不是这个取值逻辑与vue渲染有关啊?

@feng.qun.zhu.avaryholding.com
和vue应该没有关系,这个protection对象是worksheet 处于IsProtected情况下才会有,这边直接复现不了,我们再试试

@feng.qun.zhu.avaryholding.com
上面js的逻辑是
xs.sheet.data.sprotected 为false的情况下xs.sheet.data.protection是空
xs.sheet.data.sprotected 为true的情况下xs.sheet.data.protection不为空
我尝试倒出json然后用json读入,对应的protection信息依然存在,所以无法复现
下面是我测试的代码,我是用c#测试的,效果和java的应该是一样的

 [TestMethod]
 public void TestProtection()
 {
     Config.FileCacheDirectory = @"F:\storage\gridjs_temp\testcache";
     GridJsWorkbook gw = new GridJsWorkbook();
    
     Workbook wb = new Workbook(util.GetTestfile("inventory-product-wip.xlsx"));
     foreach (Worksheet ws in wb.Worksheets)
     {//保护
         ws.Protect(ProtectionType.All);
     }
     MemoryStream ms = wb.SaveToStream();
     gw.ImportExcelFile(ms, GridLoadFormat.Xlsx);
     String json = gw.ExportToJson();
// 打印内容里面 对应的protection信息字段存在
     Console.WriteLine(json);
     JObject cpresult = JObject.Parse(json);
//导入
     gw.ImportExcelFileFromJson(json);
//再导出,
     json = gw.ExportToJson();
//打印内容里面 对应的protection信息依然存在
     Console.WriteLine(json);

 }

感谢您的支持,本次是我们的问题。我们后端程序未更新成对应的版本。更新成最新版本就可以了

@feng.qun.zhu.avaryholding.com
感谢你的反馈。很高兴你通过更新后端程序到最新版本解决了问题。如果你有任何疑问,请随时联系我们。