|
@@ -473,6 +473,21 @@ public class ExcelUtil<T> |
|
@@ -473,6 +473,21 @@ public class ExcelUtil<T> |
|
473
|
style.setFont(totalFont);
|
473
|
style.setFont(totalFont);
|
|
474
|
styles.put("total", style);
|
474
|
styles.put("total", style);
|
|
475
|
|
475
|
|
|
|
|
476
|
+ style = wb.createCellStyle();
|
|
|
|
477
|
+ style.cloneStyleFrom(styles.get("data"));
|
|
|
|
478
|
+ style.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
479
|
+ styles.put("data1", style);
|
|
|
|
480
|
+
|
|
|
|
481
|
+ style = wb.createCellStyle();
|
|
|
|
482
|
+ style.cloneStyleFrom(styles.get("data"));
|
|
|
|
483
|
+ style.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
484
|
+ styles.put("data2", style);
|
|
|
|
485
|
+
|
|
|
|
486
|
+ style = wb.createCellStyle();
|
|
|
|
487
|
+ style.cloneStyleFrom(styles.get("data"));
|
|
|
|
488
|
+ style.setAlignment(HorizontalAlignment.RIGHT);
|
|
|
|
489
|
+ styles.put("data3", style);
|
|
|
|
490
|
+
|
|
476
|
return styles;
|
491
|
return styles;
|
|
477
|
}
|
492
|
}
|
|
478
|
|
493
|
|
|
@@ -555,7 +570,8 @@ public class ExcelUtil<T> |
|
@@ -555,7 +570,8 @@ public class ExcelUtil<T> |
|
555
|
{
|
570
|
{
|
|
556
|
// 创建cell
|
571
|
// 创建cell
|
|
557
|
cell = row.createCell(column);
|
572
|
cell = row.createCell(column);
|
|
558
|
- cell.setCellStyle(styles.get("data"));
|
573
|
+ int align = attr.align().value();
|
|
|
|
574
|
+ cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
|
|
559
|
|
575
|
|
|
560
|
// 用于读取对象中的属性
|
576
|
// 用于读取对象中的属性
|
|
561
|
Object value = getTargetValue(vo, field, attr);
|
577
|
Object value = getTargetValue(vo, field, attr);
|