导出调整固定宽度

This commit is contained in:
zhangheng 2024-12-30 14:34:52 +08:00
parent 52abc1d365
commit 2aeef5a79b
2 changed files with 11 additions and 9 deletions

View File

@ -568,6 +568,8 @@ public class ExcelUtil<T> {
if (!styles.containsKey(key)) { if (!styles.containsKey(key)) {
CellStyle style = wb.createCellStyle(); CellStyle style = wb.createCellStyle();
style = wb.createCellStyle(); style = wb.createCellStyle();
//自动换行
//style.setWrapText(true);
style.setAlignment(excel.align()); style.setAlignment(excel.align());
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN); style.setBorderRight(BorderStyle.THIN);
@ -677,7 +679,7 @@ public class ExcelUtil<T> {
public Cell addCell(Excel attr, Row row, T vo, Field field, int column) { public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
Cell cell = null; Cell cell = null;
try { try {
// 设置行高 // 设置行高 (自动换行注释掉)
row.setHeight(maxHeight); row.setHeight(maxHeight);
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport()) { if (attr.isExport()) {

View File

@ -47,7 +47,7 @@ public class UploadRobotPublishRecordVo {
*/ */
@ApiModelProperty(value = "就诊时间格式yyyy-MM-dd") @ApiModelProperty(value = "就诊时间格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "就诊时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "就诊时间", dateFormat = "yyyy-MM-dd")
private LocalDateTime visitDate; private LocalDateTime visitDate;
/** /**
@ -66,18 +66,18 @@ public class UploadRobotPublishRecordVo {
* 患者姓名 * 患者姓名
*/ */
@ApiModelProperty(value = "患者姓名") @ApiModelProperty(value = "患者姓名")
@Excel(name = "姓名") @Excel(name = "姓名", width = 10)
private String patientName; private String patientName;
/** /**
* 患者电话 * 患者电话
*/ */
@ApiModelProperty(value = "患者电话") @ApiModelProperty(value = "患者电话")
@Excel(name = "联系电话") @Excel(name = "联系电话", width = 12)
private String patientPhone; private String patientPhone;
@ApiModelProperty(value = "年龄") @ApiModelProperty(value = "年龄")
@Excel(name = "年龄") @Excel(name = "年龄", width = 8)
private Integer age; private Integer age;
/** /**
@ -98,7 +98,7 @@ public class UploadRobotPublishRecordVo {
* 调查分数 * 调查分数
*/ */
@ApiModelProperty(value = "调查分数") @ApiModelProperty(value = "调查分数")
@Excel(name = "调查分数") @Excel(name = "调查分数", width = 8)
private BigDecimal totalScore; private BigDecimal totalScore;
/** /**
@ -133,7 +133,7 @@ public class UploadRobotPublishRecordVo {
*/ */
@ApiModelProperty(value = "执行时间格式yyyy-MM-dd") @ApiModelProperty(value = "执行时间格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "随访时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "随访时间", dateFormat = "yyyy-MM-dd")
private LocalDateTime nodePlanTime; private LocalDateTime nodePlanTime;
/** /**
@ -147,8 +147,8 @@ public class UploadRobotPublishRecordVo {
* 抽样时间 * 抽样时间
*/ */
@ApiModelProperty(value = "抽样时间") @ApiModelProperty(value = "抽样时间")
@Excel(name = "抽样时间") @Excel(name = "抽样时间", dateFormat = "yyyy-MM-dd")
private String SampleTime; private LocalDateTime SampleTime;
/** /**
* 话术表 ID * 话术表 ID