本帖最后由 bess 于 2012-12-31 15:00 编辑
Q:如何在平台源代码中获取所有表单字段名称以及字段的类型?
A:可在源码中任意新建一个类,添加一个方法,方法的代码如下:- public String tt() throws Exception {
- // TODO Auto-generated method stub
- String rtn = "555";//rtn变量只是用于便于测试而添加的,实际操作用可将其去掉
- DocumentProcessBean dpb = new DocumentProcessBean(
- "11de-ef9e-c010eee1-860c-e1cadb714510");//参数为软件应用id
- Document d = (Document) dpb
- .doView("11e1-ce7f-67bd1958-b516-4f113d2b84ed");//参数为表单记录id,即docid
- FormProcessBean fpb = new FormProcessBean();
- Form f = fpb.doViewByFormName("字段类型",
- "11de-ef9e-c010eee1-860c-e1cadb714510");//参数为软件应用id
- Collection formfield = f.getAllFields();
- for (Iterator<FormField> iterator = formfield.iterator(); iterator
- .hasNext();) {
- FormField field = (FormField) iterator.next();
- String name = field.getName();
- Item it = d.findItem(name);
- if (it != null) {
- String type = it.getType();
- System.out.println(name + "——的类型是:" + type);
- }
- }
- return rtn;
- }
复制代码 |