Free Support Forum - aspose.com

Aspose.Cells and ListBox objects

Hi,

We have been using Aspose.Cells to create a excel spreadsheet with ListBox controls. While that works pretty well, some of the functionalities we are looking for seems to be missing.

  • In the listbox control created, we cannot make multiple items appear as selected as there is no method to do so (or are we missing something ?). Even if we set the SelectionType property as "Multi", we have only a SelectedIndex property available to set a single item as selected.
  • While reading through an excel file containing listboxes (and one or more selected items in them) Aspose.Cells fails to report the selected items (SelectedIndex always returns -1)
  • Also there is no way to determine the number of items in the list box. If we try to determine it via number of cells that forms the input for the list box, problem is that the InputRange property of list box always returns null.

Can you please help us out in resolving that? If we are missing something, can you pointing to some relevant doc links/threads where this was already discussed? I have attached a sample XLS file with this post.

Regards,

Partha

Hi Partha,

Thanks for considering Aspose.

We will support your desired functionality soon.

Thank you.

Hi Partha,

Please try this fix.

1,If you want to select multiple items ,please try the following codes:

listBox.SelectionType = SelectionType.Multi;
listBox.SelectedItem(0, true);//0 means the item index in the list box.
listBox.SelectedItem(1, true);

ListBox.SelectedIndex only applies for selection type is single.

2,We have supported to read the list box from the template file. And use ListBox.listBox.IsSelected(int index) method to check whether the item is selected. ListBox.SelectedIndex property only returns the first selected item index.

3,Please get the number of items with the property List.ItemCount.

Hello Warren,

Thank you so much for the quick & timely response. The fix works. We would do some further testing on it and will get back to you in case we have any other related issues.

Regards,

Partha