首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用smartxls api从excel读取控件不起作用

使用smartxls api从excel读取控件不起作用
EN

Stack Overflow用户
提问于 2015-04-21 08:13:59
回答 2查看 359关注 0票数 0

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

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

我尝试使用下面的代码,但它引发了一个异常

代码语言:javascript
运行
复制
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);

有人知道为什么会抛出异常吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-08-11 11:15:59

我读过SmartXLS javaDoc。

代码语言:javascript
运行
复制
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.
票数 0
EN

Stack Overflow用户

发布于 2015-08-21 15:08:13

代码语言:javascript
运行
复制
getFormControl(int type, int index) 
          get the specified index formcontrol from the current sheet

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

希望这能帮到你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29766527

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档