简体   繁体   中英

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?

getFormControl(int type, int index) 
          get the specified index formcontrol from the current sheet

This is the javadoc of smartXLS describing the method. The parameter int type means the type of the form control; Types: 20-ComBox 11-CheckBox 18-ListBox. The parameter int index means the index of the form control.

Hope this can help you.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM