RadioButtons not working as expected

We are currently using Aspose Cells version 5.2.0.0 in order to process and alter Excel files we receive from clients. Part of the process in to repopulate the files we receive with corrected data and return them to clients. We initially noticed that content linked to RadioButtons was not being updated correctly based upon the newly populated values. We even tried using the UpdateSelectedValue available off of the Aspose shape RadioButton object, but even that leads to further disjointed results. Attached is a sample files made in Excel 2010 (xlsx). Within the file you will find on Sheet 1 a group box with 4 radio buttons. Each radio button is linked to the named range "TEST". The named range "TEST" is defined on Sheet 2 for cell 0,0. If you open the initial file in Excel, you will see that the first radio button is selected and the value in the named range "TEST" is 1 - as expected.

Using the following code, we open the Excel document, change the value of the named range "TEST", call UpdateSelectedValue for all the radio buttons on Sheet 1, and then save the file.

Workbook workbook = new Workbook("C:\\RadioButtonTest2010.xlsx");
foreach (Range workbookNamedRange in testExcelFile2010.Workbook.Worksheets.GetNamedRanges())
{
if (string.Compare("TEST", workbookNamedRange.Name, true, System.Globalization.CultureInfo.CurrentCulture) == 0)
{
Cell currentCell = workbookNamedRange[0, 0];
currentCell.PutValue(4);
}
}
testExcelFile2010.Save("C:\\RadioButtonTest2010_new.xlsx");

If you open the "new" file in Excel, you will notice that although the fourth radio button shows as selected, the value in the "TEST" named range on Sheet 1 is 1 - even though we updated it to 4 and even though the fourth radio button is shown as checked.

Even worse, if you open the "new" file using Aspose again and interrogate the value for the radio buttons and the named range "TEST" you get the following:

for the first radio button -> Name: Option Button 9, IsChecked: True, LinkedCell: TEST
for the first radio button -> Name: Option Button 10, IsChecked: False, LinkedCell: TEST
for the first radio button -> Name: Option Button 11, IsChecked: False, LinkedCell: TEST
for the first radio button -> Name: Option Button 12, IsChecked: False, LinkedCell: TEST
for the named range "TEST" -> Name: TEST, ValueInCell: 4

Which doesn't at all match what the Excel document looks like when opened in Excel.

Could you please look into this? Thanks in advance.

Hi Jeff,

Thank you for using Aspose…

On investigation, we have found that the your mentioned issue exists, so we have assigned it to our Development Team under Issue ID CELLSNET-25430.

Soon we will get back to you on this.

Hi,

Please try the attached version Aspose.Cells for .NET v5.3.1.4. We have fixed the issue you
mentioned.

Please modify the test code:

C#

Workbook workbook = new Workbook(“C:\RadioButtonTest2010.xlsx”);

foreach (Range workbookNamedRange in testExcelFile2010.Workbook.Worksheets.GetNamedRanges())

{

if (string.Compare(“TEST”, workbookNamedRange.Name, true, System.Globalization.CultureInfo.CurrentCulture) == 0)

{

Cell currentCell = workbookNamedRange[0, 0];

currentCell.PutValue(4);

}

}

workbook.Worksheets[0].Shapes.UpdateSelectedValue();

workbook.Save(“C:\RadioButtonTest2010_new.xlsx”);


The issues you have found earlier (filed as 25430) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.