We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ComboBox.SelectedIndex has no effect

Hi there

I programatically add a ComboBox shape to an Excel sheet. If it already exists, I just reference it.

When I now set the the selected index by using the SelectedIndex property, the changes get reflected in the object. However, the content of the linked cell is not updated and what's worse, if I save the file and open it using Excel, there is no selection made in the ComboBox.

workbook.CalculateFormula() does not help. Is there another method to force an update and propagate it to the Excel sheet?

Please refer to the attached files for a code example.

Many thanks and kindest regards

Lukas

Hi again

I just figured out a workaround. If I set the value of the linked cell, the combo box reflects the changes when I open the sheet in Excel.

But that leaves the task of manually synchronising the combo box and the linked cell, which seems to be somewhat unfortunate.

Cheers

Lukas

Hi Lukas,

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our issue tracking system with issue id CELLSNET-11368
.


Thank You & Best Regards,

Hi,

Please try the attached version. We have supported to set the value of the linked cell when setting the select index of the Combo Box.

Thank you.

Hi Amjad

Thanks for the quick response. The updated version does the trick for me.

However I suggest that the other way round should be supported as well, i.e. if the value of the linked cell is set, the selected index of the combo box should be changed accordingly.

Having said that, it is not a requirement on our side, so no urgency at all.

Thanks again

Lukas

Hi Lukas,

You will soon find a version which has Shape.UpdateSelectedValue method that you will call it to change the selected value of the combo box shape (if the linked cell’s value is set/changed) before saving the workbook


Thank you.

Hi,

Please try this fix with the following sample code:

Workbook workbook = new Workbook();
workbook.Open(@“F:\FileTemp\ComboBox.xlsx”);
workbook.Worksheets[0].Cells[“B1”].PutValue(5);
workbook.Worksheets[0].Shapes[0].UpdateSelectedValue();

You will see the selected index is changed in the generated file.

Thank you.

Hi Amjad

Works a charm.

Thanks

Lukas

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


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