Aspose.cells 修改复选框名称的方法不生效,调用的是shape.setName方法,在excel
2013上可以生效,但是2007不行。
20171106-164500(eSpace).png (20.7 KB)
感谢您使用的Aspose的API。
寻找到你的代码后,我们发现了一个错误。我们认为,这个错误代码是造成你的问题。请把这个线
//XlsSaveOptions is invalid for XLSX format
XlsSaveOptions saveOptions = new XlsSaveOptions(SaveFormat.XLSX);
成
//OoxmlSaveOptions is correct for XLSX format
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.XLSX);
它应该解决您的问题。让我们知道您的反馈意见。
按照你提供的保存方法,我们重新测试了下,还是一样的问题。
感谢您使用的Aspose的API。
我们能够观察到这一问题,并在我们的调查数据库和修复记录它。有一次,问题得到解决,否则我们有一些其他的消息要告诉你,我们将尽快更新你的。
此问题已被记录为
- CELLSJAVA-42444 - CheckBox.setName() method works in Excel 2016 but does not work in Excel 2007
Java
Workbook workbook = new Workbook(dirPath + "222.xlsx");
WorksheetCollection sheets = workbook.getWorksheets();
int len = sheets.getCount();
for (int i = 0; i < len; i++) {
Worksheet sheet = sheets.get(i);
if (!sheet.isVisible()) {
continue;
}
ShapeCollection shapes = sheet.getShapes();
for (int j = 0; j < shapes.getCount(); j++) {
Shape shape = shapes.get(j);
if (shape.getMsoDrawingType() == MsoDrawingType.RADIO_BUTTON
|| shape.getMsoDrawingType() == MsoDrawingType.CHECK_BOX) {
CheckBox ch = (CheckBox) shape;
ch.setName("GGGGGHHH");
System.out.println(ch.getName());
}
}
}
workbook.save(dirPath + "out.xlsx");
修复这个问题需要多长时间。我们项目最近就要用这个功能,如果时间不长的话,我们可以等一下;时间太长,我们就要考虑其他方案了。
I have no privilege to access “Personal Network Storage” category. Could you send it to my email( daichao1@huawei.com ), thanks.
The issues you have found earlier (filed as CELLSJAVA-42444) have been fixed in this Aspose.Cells for Java 17.11 update.
Please also check the following document/blog for your reference: