Need a dropdown list with a textbox

We need to export data from db, and user make changes in the excel, then import excel data into db.
we need a dropdown list in one cell, user can select one item from it or enter text in it.
user select one item from the dropdown list, when save data into db, we need to get the value of the selected item, bcos display text and value is not the same. meanwhile user can input text directly. Would you give any suggestions:

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and use the latest version:
Aspose.Cells
for .NET v7.1.2.4


Please see the following article for your needs.

  1. Working with Controls

Please see the following subsections inside the main document.

  1. Adding TextBox Control to the Worksheet
  2. Adding ComboBox Control to the Worksheet

We need a dropdownlist , also this dropdownlist can let user edit, not only select. as your suggestion, we have to add two controls. we hope one control can solve my query

Hi,

I think, combo box will fulfill your needs.

If that is not a case, please create such a control manually using Ms-Excel 2010 and post your file here.

We will check it soon.

can combox allow input text? I use it, only can select. I can’t input in the combox

Hi,

Please provide us the Ms-Excel xls/xlsx file with your desired controls.

We will load this file into Aspose.Cells API and figure out how to achieve your desired output programmatically using Aspose.Cells API and let you know the sample code.

I list out my questions in the attachment.
Thanks in advance!

Hi,

Please see the answers of your below questions.

Q1
In sheet- MainSheet, the comb is made by aspose, I can select option in the comb but I can’t enter data.

We will look into it and let you know asap.

Q2:
In sheet- MainSheet, how to set the comb size(width and height) as the same with the holding cell? (by C# code)

Please control the width and height of any shape (including combo) with their X,Y, Width and Height properties

e.g
worksheet.Shapes[0].Width property

You can find the cell’s height and width using these properties and methods

Cell.Column // will return column index of the cell
Cell.Row //will return row index of the cell
Worksheet.Cells.Set/GetColumnWidth
Worksheet.Cells.Set/GetRowHeight

Q3
In sheet- MainSheet, In comb, display data is not the same with value, so we open another sheet-comb-displaydata & Value to keep the mapping.

We will look into it and let you know asap. We might also need further illustration of it.

Q4:
We want to keep three aspose checkbox in one cell, how to set them in one cell, and make same space between each control ?(by C# code)

Again, you will have to adjust column width to hold all three check boxes in a cell. Please see Q2

Q5
Fill data by aspose.cel.put(), if over 40000 charactors, does aspose have any way to split them to another row

You can put any string value in cell, you can split your string if it exceeds those many characters and move your rest of string into next row.

You can also wrap text using Cell.GetStyle() > Style object and then using Style.IsTextWrapped=true property.

Thanks for your detailed answer.
Are there any difference between Aspose.Cells.ValidationCollection and shape-combo? I found in our application there are validations also show as a dropdown list. it looks like the width and height is easy to set. and behavior is similar with comb. I am confused to use comb or validation to meet the requirement.

Hi,

For your help, I have created a screenshot below that illustrates what is exactly meant by Validation and Combo Box.

Please also see the xlsx file I have created with the steps as mentioned in screenshot.

You can create such an xlsx file programmatically using Aspose.Cells for .NET.

Please refer to this document.

Data Filtering and Validation

Screenshot: