Combo Box not required!

Hi,

I'm having the licensed version of aspose.grid.net with latest version. I want to know that can we have property in the grid in which one cell or whole one row shouldn't have a combo box mainly the header row.

I have faced a problem that I have explained in the attached screen shot.

Thanks.

Hi,

1) I think you may protect your desired header cell(s). See the following sample code:

Dim sheet As Worksheet = GridDesktop1.Worksheets(0)

Dim ids As ArrayList = New ArrayList

Dim names As ArrayList = New ArrayList

Dim i As Integer = 0

While i < 10

ids.Add(i)

names.Add("item" + i.ToString)

i = i + 1

End While

sheet.Columns(0).AddComboBox(names)

'To lock a cell in a way that it cannot display the combobox values.

Dim c As GridCell = sheet.Cells("A1")

c.Value = "MyText"

Dim s As Style = c.GetStyle()

s.CellLocked = True

c.SetStyle(s)

c.Protected = True

2) Alternatively, you may put combobox controls to your desired cells only for a range of cells (except for your header cells in that column). See the following code how to add the combobox to a single cell only:

Dim sheet As Aspose.Grid.Desktop.Worksheet = grdDataEntry.Worksheets(0)

Dim cell As Aspose.Grid.Desktop.GridCell = sheet.Cells("B1")

cell.Value = "Hello..."

Dim items() As String = New String(5) {}

items(0) = "Aspose"

items(1) = "Aspose.Grid"

items(2) = "Aspose.Cells"

items(3) = "Aspose.Pdf"

items(4) = "Aspose.Slides"

sheet.Controls.AddComboBox(cell.Name, items)

Thank you.

Hi,

Please try the attached version, we have fixed the bug regarding combobox. The combobox now will not be opened when the cell is locked or protected.

Thank you.

Hi Amjad,

Thanks for the quick response and new dll. I have added the new dll in my code. Refering to the previous attachment that I have sent to you. The header column in the grid are protected and other columns are locked so that they are not editable, by clicking on the cell and removing the values. Now the problem is that the combo box are not opening in any case.

So can you pls make the combo box opened at least on property that is locked or protected. Or can you pls suggest some other method to lock the values in the grid in each cell, so that they are not editable.

Thank You

Hi Amjad

Any update??

Also, can we have a feature with which we should be able to remove a cellcontrol from a cell (not from whole column)

E.g.
grdDataEntry.Worksheets(0).Cells(0,2).ReomveCellControl()

I know, we can remove a columns’ cell control, but i just want to remove some cells’ cell control.

It has become a major issue for us as my first row which was locked got become un-locked in some way and user was able to select value from it’s drop down. But I just want to remove drop downs from first row.

Also, i tried following code, but it did not work:

'Accessing the worksheet of the Grid that is currently active


Dim sheet As Worksheet = gridDesktop1.GetActiveWorksheet()



'Getting the location of the cell that is currently in focus


Dim cl As CellLocation = sheet.GetFocusedCellLocation()



'Removing the cell control by specifying the location of cell containing it


sheet.Controls.Remove(cl.Row, cl.Column)



Regards
Sukhminder Singh

Hi,

"..... grid are protected and other columns are locked so that they are not editable, by clicking on the cell and removing the values. Now the problem is that the combo box are not opening in any case. "

Well, we did that (the locked or protected cells would not show the combobox values) for your need in our recent version(s) for your need.

"can we have a feature with which we should be able to remove a cellcontrol from a cell (not from whole column)

E.g.
grdDataEntry.Worksheets(0).Cells(0,2).ReomveCellControl()........"

We will check the feasibility of the feature and get back to you soon.

"

'Removing the cell control by specifying the location of cell containing it

sheet.Controls.Remove(cl.Row, cl.Column)

"

We have found the issue after an initial test and will figure it out soon.

Thank you.

Hi Sukhminder,

Thank you for considering Aspose.

We have provided a new method named RemoveComboBox to implement your needs. Please try the following line of code with Aspose.Grid.Desktop v2.0.1.31(attached).

grdDataEntry.Worksheets(0).Columns(0).RemoveComboBox(2)

Please do let us know if it fits your needs,

Thank You & Best Regards,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.