We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Validation always returns true for 'getInCellDropDown()' method

Validation always returns true for ‘getInCellDropDown()’ method. I am using the following file validation.xlsx.zip (19.6 KB)
The code I am using is as follows

        Worksheet sheet = book.getWorksheets().get("Sheet1");
            Cells cells  = sheet.getCells();
            Cell a2 = cells.get("A2");
            Validation va2 = a2.getValidation();
            if(va2.getInCellDropDown()) {
                System.out.println("A2 is a dropdown");
            } else {
                System.out.println("A2 is NOT a dropdown");
            }
            Cell b2 = cells.get("B2");
            Validation vb2 = b2.getValidation();
            if(vb2.getInCellDropDown()) {
                System.out.println("B2 is a dropdown");
            } else {
                System.out.println("B2 is NOT a dropdown");
            }
            Cell c2 = cells.get("C2");
            Validation vc2 = c2.getValidation();
            if(vc2.getInCellDropDown()) {
                System.out.println("C2 is a dropdown");
            } else {
                System.out.println("C2 is NOT a dropdown");
            }
 
The output is

    A2 is a dropdown
    B2 is a dropdown
    C2 is a dropdown

But, the expected output is

A2 is a dropdown
B2 is NOT a dropdown
C2 is NOT a dropdown.

Please help.

@dvector,

Thanks for the template file and sample code.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found that validation always returns true for ‘getInCellDropDown()’ method:
e.g
Sample code:

Workbook book = new Workbook("f:\\files\\validation.xlsx");
Worksheet sheet = book.getWorksheets().get("Sheet1");
            Cells cells  = sheet.getCells();
            Cell a2 = cells.get("A2");
            Validation va2 = a2.getValidation();
            if(va2.getInCellDropDown()) {
                System.out.println("A2 is a dropdown");
            } else {
                System.out.println("A2 is NOT a dropdown");
            }
            Cell b2 = cells.get("B2");
            Validation vb2 = b2.getValidation();
            if(vb2.getInCellDropDown()) {
                System.out.println("B2 is a dropdown");
            } else {
                System.out.println("B2 is NOT a dropdown");
            }
            Cell c2 = cells.get("C2");
            Validation vc2 = c2.getValidation();
            if(vc2.getInCellDropDown()) {
                System.out.println("C2 is a dropdown");
            } else {
                System.out.println("C2 is NOT a dropdown");
            }

I have logged a ticket with an id “CELLSJAVA-42764” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@dvector,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42764”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

The issues you have found earlier (filed as ) have been fixed in Aspose.Cells for Java 18.12. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi