1. 程式人生 > >EAS BOS KDTable的顯示格式設定

EAS BOS KDTable的顯示格式設定

table.getColumn(colIndex).getStyleAttributes().setNumberFormat(formatString); //設定某列顯示格式
table.getCell(rowIndex, colIndex).getStyleAttributes().setNumberFormat(formatString); //設定某單元格顯示格式

//1.數值類
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0.00");//0.00 表示顯示兩位小數,末尾為0時0仍顯示
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0.##");//0.## 表示顯示兩位小數,末尾為0時0不顯示
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("#,##0.00");//#,##0.00 表示顯示兩位小數,且顯示千分位

//2.日期類 
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-m-d");
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-MM-dd");
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-MM-dd HH:mm:ss");
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy年MM月dd日");

//3.百分比
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0%");
table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0.00%");