Data validaion

Is it possible to create any pull down values in excel sheet without macro code using aspose.cells.

Hi,

Thanks for your question.

I think, you want to extract values from drop down list. If yes, then it is possible.

Can you please send me any demo for creating a dropdownlist in excel sheet with values… we used chart concept using aspose and it is giving good result… Before buying your software i want to know about the data validation… So please send me any demo’s for pull down values as soon as possible…

Hi,

Please see this code. It will add a dropdown. I have attached the output xlsx file.

I have also added a sample C# project which you can run and get the output xlsx file.

C#


//Create a new Workbook.

Workbook workbook = new Workbook();


//Get the first worksheet.

Worksheet sheet = workbook.Worksheets[0];


//Get the worksheet cells collection.

Cells cells = sheet.Cells;


//Input a value.

cells[“B3”].PutValue(“Employee:”);


//Set it bold.

Style style = cells[“B3”].GetStyle();

style.Font.IsBold = true;

cells[“B3”].SetStyle(style);


//Input some values that denote the input range

//for the combo box.

cells[“A2”].PutValue(“Emp001”);

cells[“A3”].PutValue(“Emp002”);

cells[“A4”].PutValue(“Emp003”);

cells[“A5”].PutValue(“Emp004”);

cells[“A6”].PutValue(“Emp005”);

cells[“A7”].PutValue(“Emp006”);


//Add a new combo box.

Aspose.Cells.Drawing.ComboBox comboBox = sheet.Shapes.AddComboBox(2, 0, 2, 0, 22, 100);


//Set the linked cell;

comboBox.LinkedCell = “A1”;


//Set the input range.

comboBox.InputRange = “A2:A7”;


//Set no. of list lines displayed in the combo

//box’s list portion.

comboBox.DropDownLines = 5;


//Set the combo box with 3-D shading.

comboBox.Shadow = true;


//AutoFit Columns

sheet.AutoFitColumns();


//Saves the file.

workbook.Save(@“F:\Shak-Data-RW\Downloads\DropDown.xlsx”, SaveFormat.Xlsx);

Screenshot:

Hi,

Please also refer to this document for a reference and a sample code: Data Filtering and Validation

Hi mshakeel.faiz,


Thanks for your help…

The link which you have sent is adding a dropdownlist control but i need a column which contains pull down values…Please reply me as soon as possible…



Hi,

Please attach a sample xls/xlsx file with your desired features (pull down values etc) so that we know your requirements. You can create it manually using Ms-Excel.

Hi,

My doubts got cleared.

Now i can able to create an excel file with pull down values using Aspose.cells after referring this link Data Filtering and Validation

Thanks for your help…


Hi,

It’s great to know that your question is now sorted out.