Search code examples
smartxls

Reading control from excel using smartxls api is not working


I was trying to read form control from an excel file. I am using smartXLS api.

In my excel file cell "c2" has list-box (formControl). Now i want to read that that control .

I was tried with following code but it throws an exception

workBook.readXLSX("D:\\TestAssessment.xlsx");

//This row throws an exception.
//Here I was passed parameters in function as getFormControl(rowIndex,columnIndex)
FormControlShape fm = (FormControlShape)workBook.getFormControl(1, 2);

Can anyone know why it's throw an exception?


Solution

  • I have read SmartXLS javaDoc.

    FormControlShape shape = workBook.getFormControl(FormControlShape.ListBox, listBoxId);
    
    // Here FormControlShape is inbuilt enum for to pass which type of form control you need to read/get.
    // listBoxId is integer for index of the form control.