david-PC\david
2018-06-12 cc7f57619fd09f68582b748a3580402717b84c50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package frame.file;
 
import frame.data.DataType;
import frame.util.Util;
 
public class CellTypes {
 
    public static CellDataType toExcelCellType(String type) {
        if (Util.isEmptyStr(type)) {
            return null;
        }
 
        type = type.toLowerCase();
 
        if ("boolean".equals(type)) {
            return CellDataType.Boolean;
        }
        else if ("int".equals(type)) {
            return CellDataType.Int;
        }
        else if ("decimal".equals(type)) {
            return CellDataType.Decimal;
        }
        else if ("percent".equals(type)) {
            return CellDataType.Percent;
        }
        else if ("date".equals(type)) {
            return CellDataType.Date;
        }
        else if ("datetime".equals(type)) {
            return CellDataType.DateTime;
        }
        else if ("String".equals(type)) {
            return CellDataType.String;
        }
 
        return CellDataType.Error;
 
    }
    
    public static CellDataType toExcelCellType(DataType type) {
        if (type == null || DataType.Void.equals(type)) {
            return null;
        }
 
        if (DataType.Boolean.equals(type)) {
            return CellDataType.Boolean;
        }
        else if (DataType.Int.equals(type)) {
            return CellDataType.Int;
        }
        else if (DataType.Decimal.equals(type)) {
            return CellDataType.Decimal;
        }
        else if (DataType.Decimal.equals(type)) {
            return CellDataType.Percent;
        }
        else if (DataType.Date.equals(type)) {
            return CellDataType.Date;
        }
        else if (DataType.Date.equals(type)) {
            return CellDataType.DateTime;
        }
        else if (DataType.String.equals(type)) {
            return CellDataType.String;
        }
 
        return CellDataType.Error;
 
    }
}