Excel工具优化BigDecimal类型
This commit is contained in:
@@ -10,6 +10,7 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -466,6 +467,8 @@ public class ExcelExport implements Closeable{
|
|||||||
}else if(val instanceof Float) {
|
}else if(val instanceof Float) {
|
||||||
cell.setCellValue((Float) val);
|
cell.setCellValue((Float) val);
|
||||||
defaultDataFormat = "0.00";
|
defaultDataFormat = "0.00";
|
||||||
|
}else if(val instanceof BigDecimal) {
|
||||||
|
cell.setCellValue(((BigDecimal)val).doubleValue());
|
||||||
}else if(val instanceof Date) {
|
}else if(val instanceof Date) {
|
||||||
cell.setCellValue((Date) val);
|
cell.setCellValue((Date) val);
|
||||||
defaultDataFormat = "yyyy-MM-dd HH:mm";
|
defaultDataFormat = "yyyy-MM-dd HH:mm";
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public @interface ExcelField {
|
|||||||
Class<?> fieldType() default Class.class;
|
Class<?> fieldType() default Class.class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数值格式(例如:0.00,yyyy-MM-dd)
|
* 数值格式(例如:数值:0.00;日期:yyyy-MM-dd;金额:¥#,##0.00)
|
||||||
*/
|
*/
|
||||||
String dataFormat() default "@";
|
String dataFormat() default "@";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user