|
|
@ -428,7 +428,10 @@ public class ExcelTemplateALPHA { |
|
|
style.setBorderBottom(BorderStyle.NONE); |
|
|
style.setBorderBottom(BorderStyle.NONE); |
|
|
style.setBorderTop(BorderStyle.NONE); |
|
|
style.setBorderTop(BorderStyle.NONE); |
|
|
style.setWrapText(true); |
|
|
style.setWrapText(true); |
|
|
style.setAlignment(HorizontalAlignment.LEFT); |
|
|
|
|
|
|
|
|
// 箱单 A 列 CTN No 后面会单独居中;这里不要改共享样式的对齐,避免表头被带成左对齐 |
|
|
|
|
|
if (!(intRight && j == 0)) { |
|
|
|
|
|
style.setAlignment(HorizontalAlignment.LEFT); |
|
|
|
|
|
} |
|
|
c.setCellStyle(style); |
|
|
c.setCellStyle(style); |
|
|
if (rangeStyle && j < 4) { |
|
|
if (rangeStyle && j < 4) { |
|
|
for (int mi = 0; mi < 3; mi++) { |
|
|
for (int mi = 0; mi < 3; mi++) { |
|
|
@ -444,6 +447,23 @@ public class ExcelTemplateALPHA { |
|
|
} |
|
|
} |
|
|
// 设置明细样式,因为明细是动态添加的,会有样式和模版偏差,此处主要是第2、3列的样式需要设置 |
|
|
// 设置明细样式,因为明细是动态添加的,会有样式和模版偏差,此处主要是第2、3列的样式需要设置 |
|
|
if (cellStyle) { |
|
|
if (cellStyle) { |
|
|
|
|
|
// 箱单 A 列 CTN No 共用一份居中样式:箱号/托号是文本(如 1~1),不在数字列循环里。 |
|
|
|
|
|
// 明细默认左对齐,RFID 的 c1 还会重绘 A 列;循环后再覆盖,后续合并才能 clone 到居中。 |
|
|
|
|
|
XSSFCellStyle packingCtnNoStyle = null; |
|
|
|
|
|
if (intRight) { |
|
|
|
|
|
packingCtnNoStyle = workbook.createCellStyle(); |
|
|
|
|
|
packingCtnNoStyle.setBorderRight(BorderStyle.NONE); |
|
|
|
|
|
packingCtnNoStyle.setBorderLeft(BorderStyle.MEDIUM); |
|
|
|
|
|
packingCtnNoStyle.setBorderBottom(BorderStyle.NONE); |
|
|
|
|
|
packingCtnNoStyle.setBorderTop(BorderStyle.NONE); |
|
|
|
|
|
Font packingCtnNoFont = workbook.createFont(); |
|
|
|
|
|
packingCtnNoFont.setFontName("Arial"); |
|
|
|
|
|
packingCtnNoFont.setFontHeightInPoints((short) 10); |
|
|
|
|
|
packingCtnNoStyle.setFont(packingCtnNoFont); |
|
|
|
|
|
packingCtnNoStyle.setVerticalAlignment(VerticalAlignment.TOP); |
|
|
|
|
|
packingCtnNoStyle.setAlignment(HorizontalAlignment.CENTER); |
|
|
|
|
|
packingCtnNoStyle.setWrapText(true); |
|
|
|
|
|
} |
|
|
for (Integer dtlRow : dtlRows) { |
|
|
for (Integer dtlRow : dtlRows) { |
|
|
XSSFCell c1 = sheet.getRow(dtlRow).getCell(cellStyle2?0:1); |
|
|
XSSFCell c1 = sheet.getRow(dtlRow).getCell(cellStyle2?0:1); |
|
|
if (c1 == null) { |
|
|
if (c1 == null) { |
|
|
@ -618,6 +638,19 @@ public class ExcelTemplateALPHA { |
|
|
}*/ |
|
|
}*/ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 放在明细样式循环之后,覆盖 RFID/Label 对 A 列的默认左对齐,再交给后续合并 clone |
|
|
|
|
|
if (packingCtnNoStyle != null && dtlRowIndex >= 0 && !listVariables.isEmpty()) { |
|
|
|
|
|
for (int r = dtlRowIndex; r < dtlRowIndex + listVariables.size(); r++) { |
|
|
|
|
|
XSSFRow ctnRow = sheet.getRow(r); |
|
|
|
|
|
if (ctnRow == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
XSSFCell ctnNoCell = ctnRow.getCell(0); |
|
|
|
|
|
if (ctnNoCell != null) { |
|
|
|
|
|
ctnNoCell.setCellStyle(packingCtnNoStyle); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (delRight) { |
|
|
if (delRight) { |
|
|
int declarationCenterStartCol = declarationUnitPriceCols.isEmpty() |
|
|
int declarationCenterStartCol = declarationUnitPriceCols.isEmpty() |
|
|
|