Hi,
We have Excel documents where we have dependent drop-downs to allows the user to select form the first and that impacts the values for the second, When I try and read in the drop-down list of values, the cellValidation.Values1 array ONLY contains the first value from the Range, not the full list of values:
Attached is an example project and file illustrating the problem. The console output from running this is:
Cell B1 DD values:
Pizza
IHOP
Chinese
Cell D1 DD values:
Pancakces
Cell D3 DD values:
Pancakces
Combos
French_Toast
Waffles
The D1 values list should match D3, but does not. Is this a defect? Is there another way to do this? Am I missing something?
The attached solution will need the Aspose.Cells.dll reference added. We’re using 8.7.1.0.
Thanks,
Andy.
Hi,
e.g
Sample code:
try
{
String excelFile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"…\Data\TestFile03.xlsx";
Workbook workbook = new Workbook(excelFile);
Worksheet wipWorksheet = workbook.Worksheets[0];
// Dispaly the first drop-down’s values:
displayDropDownValues(wipWorksheet, “B1”);
// Set the drop-down value…
wipWorksheet.Cells[“B1”].Value = “IHOP”;
// Now display the second drop-down values list (it uses INDIRECT/Ranges)
displayDropDownValues(wipWorksheet, “D1”);
// Now disply what the list should be, just using the range directly.
displayDropDownValues(wipWorksheet, “D3”);
Console.ReadLine();
}
catch (Exception ex)
{
}
private static void displayDropDownValues(Worksheet wipWorksheet, string Cell)
{
Cell wipCell = wipWorksheet.Cells[Cell];
Validation cellValidation = wipCell.GetValidation();
//OR
//Validation cellValidation = wipWorksheet.Validations.GetValidationInCell(wipCell.Row, wipCell.Column);
Console.WriteLine("Cell " + Cell + " DD values: “);
string[] ddData = ((System.Collections.IEnumerable)cellValidation.Value1).Cast()
.Select(x => x.ToString())
.ToArray();
foreach (String val in ddData)
{
Console.WriteLine(” " + val);
}
}
…
Output:
Cell B1 DD values:
Pizza
IHOP
Chinese
Cell D1 DD values:
Pancakces //Some values are missing here.
Cell D3 DD values:
Pancakces
Combos
French_Toast
Waffles
Hi,
Thanks for using Aspose.Cells.
This is to inform you that we have fixed your issue CELLSNET-44505 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
Hi,
Thanks for the quick fix! Yes, I’ve downloaded that build and the code works. Do you know when this will be officially released and combined with the full Total release package? We use some of the otehr DLL’s and prefer to update them all at once.
Thanks,
Andy
Hi Andy,
The issues you have found earlier (filed as CELLSNET-44505) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.