Aspose.cells 修改复选框名称的方法不生效

Aspose.cells 修改复选框名称的方法不生效,调用的是shape.setName方法,在excel
2013上可以生效,但是2007不行。
20171106-164500(eSpace).png (20.7 KB)

@daichao1225,

感谢您的截图和细节。

你可以粘贴你的示例代码,并附上示例文件,我们将尽快检查。

@Daichao1225

感谢您使用的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); 

它应该解决您的问题。让我们知道您的反馈意见。

按照你提供的保存方法,我们重新测试了下,还是一样的问题。

@daichao1225

感谢您使用的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");

Excel 2007 - Screenshot

修复这个问题需要多长时间。我们项目最近就要用这个功能,如果时间不长的话,我们可以等一下;时间太长,我们就要考虑其他方案了。

@daichao1225

感谢您使用的Aspose的API。

这是为了告诉你,我们有固定您的问题CELLSJAVA-42444了。在进行QA和包括其他改进和修复后,我们会尽快提供修复。

@daichao1225

请下载并尝试以下修复,并让我们知道您的反馈。

I have no privilege to access “Personal Network Storage” category. Could you send it to my email( daichao1@huawei.com ), thanks.

@daichao1225,

带有附件的电子邮件将发送到您提及的电子邮件ID。

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: