数据为0时不显示。
日期类: 1、yyyy-m-d 2、yyyy-MM-dd
3、yyyy-MM-ddhh:mm:ss 4、yyyy年MM月dd日 百分比: 1、0% 2、0.00%
……详细请打开Excel2003,单元格右键,设置单元格格式,选一种格式,点自定义即可看到该格式的格式串;有的Excel格式串后有带”_”,在使用时,必须去掉。
如何理解KDTable的Render和Editor
Render即为绘制器,KDTable的每个单元格都是对应的绘制器绘制出来的,例如文本绘制器将进行文本的绘制,CheckBox绘制器将在单元格绘制CheckBox的样子,图片绘制器将在单元格绘制图片等。
Editor即为编辑器,当单元格进入编辑状态后,会在单元格的位置显示编辑器,通过编辑器可以修改单元格的值。在同一时刻,只能有一个单元格进入编辑状态。进入编辑状态的方法有(1)双击或者单击某个单元格,有些编辑器是双击以后再进入,有些编辑器是单击后进入;(2)选中某个单元格,按F2可以进入编辑器;(3)选中某个单元格,按下编辑器能接受的按键,例如文本编辑器可以接受任意可见字符,checkbox可以接受空格键作为切换选择的键,按下这些键后,单元格也将进入编辑状态。结束编辑的方法有(1)在编辑器中按下Enter键或者Tab键;(2)在编辑状态下点击表格的其他单元格;(3)表格控件失去焦点。在编辑状态下按下Esc键将取消编辑。结束编辑和取消编辑的区别在于,结束编辑时会将单元格的值修改为编辑器的值,取消编辑器将保持单元格的旧值。
如何在取数之后,调整KDTable单元格的内容或者显示格式
table. addKDTDataFillListener这个事件将在取数事件之后被调用,在这个事件当中,取数事件获取的数据已经填充到KDTable当中,可以直接获取KDTable的行及单元格进行操作。DataFillListener和取数事件是一一对应的,取数事件调用一次则DataFillListener将被调用一次,而且DataFillListener的事件参数中的起始行和结束行也是和取数事件的参数一致的。需要注意的是在DataFillListener中只能访问事件参数中的起始行和结束行范围的行,千万不要在这个事件里访问table的所有行,因为如果在这里访问不在事件参数范围内的行,可能导致再次触发取数事件。
KDTable刷新后,滚动条跳到最后修改位置
kdtEntrys.getLayoutManager().scrollRowToShow(rowInde);
如何通过代码控制KDTable新增行
方法一: //增行
EmpEnrollBizBillEntryInfo entry = new EmpEnrollBizBillEntryInfo();//创建分录的实体
entry.setEmpName(name);//设置实体属性 entry.setIDCardNo(id);
editData.getEntrys().add(entry);//将实体新增到editData的实体列表中。 loadFields();//重新加载分录信息 方法二: //增行
addLine(kdtEntries);
IRow newRow = kdtEntries.getRow(kdtEntries.getRowCount()-1);//获取新增的行对象 //设置分录的实体
newRow.setUserObject(new ReceivingBillEntryInfo()); //设置分录实体的属性
newRow.getCell(\品牌
newRow.getCell(\产品线 newRow.getCell(\期数
对于分录设置排序
KDTSortManagersortManager = new KDTSortManager(kdtEntrys); sortManager.setSortAuto(true); sortManager.setClickCount(1);
for(inti = 0; i this.kdtEntrys.getColumn(i).setSortable(true); EAS Bos 合计行代码 /** * 功能:添加合计行 * * @param table * 指定的KDTable * @param fields * 需要合计的列 */ public static void apendFootRow(KDTable table, String fields[]) { int size = fields.length; if (size == 0) return; Map sumValue = new HashMap(); // 利用getRowCount的到的行可能不正确 int count = table.getRowCount3(); for (inti = 0; i sumValue.put(fields[i], new BigDecimal(\ } IRowfootRow = null; KDTFootManagerfootManager = table.getFootManager(); if (footManager == null) { footManager = new KDTFootManager(table); footManager.addFootView(); table.setFootManager(footManager); } // 计算所有指定行的合计值 footRow = footManager.getFootRow(0); for (inti = 0; i< count; i++) { IRow row = table.getRow(i); for (int j = 0; j if (footRow == null) { footRow = footManager.addFootRow(0); } // 设置合计行显示样式 String colFormat = \ String total = EASResource.getString(FrameWorkClientUtils.strResource + \ table.getIndexColumn().setWidthAdjustMode(KDTIndexColumn.WIDTH_MANUAL); table.getIndexColumn().setWidth(30); footManager.addIndexText(0, total); footRow.getStyleAttributes().setBackground(new Color(0xf6, 0xf6, 0xbf)); for (inti = 0; i< size; i++) { String colName = fields[i]; footRow.getCell(colName).getStyleAttributes().setNumberFormat( colFormat); footRow.getCell(colName).getStyleAttributes().setHorizontalAlign( HorizontalAlignment.RIGHT); footRow.getCell(colName).getStyleAttributes().setFontColor( Color.black); } // 设置合计行的值 for (inti = 0; i footRow.getCell(fields[i]).setValue(sumValue.get(fields[i])); } } private static void sumValueForCell(IRow row, String key, Map sumValue) { ICell cell = row.getCell(key); if (cell != null) { Object obj = cell.getValue(); if (obj != null) { BigDecimalkeyValue = (BigDecimal) sumValue.get(key); keyValue = keyValue.add(new BigDecimal(obj.toString())); sumValue.put(key, keyValue); } } } EASBos 对于某个权限的验证 s BOSUuiduserId=SysContext.getSysContext().getCurrentUserInfo().getId(); BOSUuidorgId=SysContext.getSysContext().getCurrentOrgUnit().getId(); ObjectUuidPKuserPK = new ObjectUuidPK(userId); ObjectUuidPKorgPK = new ObjectUuidPK(orgId); com.kingdee.eas.base.permission.IPermission perm= null; try { perm =PermissionFactory.getRemoteInstance(); perm.hasFunctionPermission(userPK, orgPK, \arget_addnew\ } catch (Exception e) { e.printStackTrace(); } 关于Bos 开发中使用字段类型是选择已有基础资料的的源代码 s public void kdtPerson_Changed(introwIndex, intcolIndex) throws Exception { if (\ String name=(com.kingdee.bos.ui.face.UIRuleUtil .getString(com.kingdee.bos.ui.face.UIRuleUtil.getProperty(