0

我试图从 excel 文件中读取表单控件。我正在使用 smartXLS api。

在我的 excel 文件中,单元格“c2”有列表框(formControl)。现在我想读那个控件。

我尝试使用以下代码,但它引发异常

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);

谁能知道为什么会抛出异常?

4

2 回答 2

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

这是描述该方法的 smartXLS 的 javadoc。参数int type表示表单控件的类型;类型:20-ComBox 11-CheckBox 18-ListBox。该参数int index表示表单控件的索引。

希望这可以帮到你。

于 2015-08-21T15:08:13.587 回答
0

我已阅读 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.
于 2017-08-11T11:15:59.190 回答