|
|
|
@ -307,6 +307,7 @@ public class ExcelTemplateTX { |
|
|
|
Set<Integer> invoiceUnitPriceCols = new HashSet<>(); |
|
|
|
Set<Integer> invoiceTotalPriceCols = new HashSet<>(); |
|
|
|
Set<Integer> declarationFixedPriceCols = new HashSet<>(); |
|
|
|
Set<Integer> declarationUnitPriceCols = new HashSet<>(); |
|
|
|
Set<Integer> declarationQtyCols = new HashSet<>(); |
|
|
|
Set<Integer> declarationHsCodeDescCols = new HashSet<>(); |
|
|
|
Set<Integer> packingVolumeCols = new HashSet<>(); |
|
|
|
@ -343,6 +344,9 @@ public class ExcelTemplateTX { |
|
|
|
if (isDeclarationFixedPriceField(dtlField)) { |
|
|
|
declarationFixedPriceCols.add(j); |
|
|
|
} |
|
|
|
if (isDeclarationUnitPriceField(dtlField)) { |
|
|
|
declarationUnitPriceCols.add(j); |
|
|
|
} |
|
|
|
if (isDeclarationQtyField(dtlField)) { |
|
|
|
declarationQtyCols.add(j); |
|
|
|
} |
|
|
|
@ -636,6 +640,9 @@ public class ExcelTemplateTX { |
|
|
|
} |
|
|
|
} |
|
|
|
if (delRight) { |
|
|
|
int declarationCenterStartCol = declarationUnitPriceCols.isEmpty() |
|
|
|
? 11 |
|
|
|
: Collections.max(declarationUnitPriceCols) + 1; |
|
|
|
for (Integer dtlRow : dtlRows) { |
|
|
|
for (int i = 0; i < 17; i++) { |
|
|
|
XSSFRow row = sheet.getRow(dtlRow); |
|
|
|
@ -658,8 +665,9 @@ public class ExcelTemplateTX { |
|
|
|
style.setFont(font); |
|
|
|
boolean declarationHsCodeDescColumn = declarationHsCodeDescCols.contains(i); |
|
|
|
boolean keepWrapText = c7.getCellStyle() != null && c7.getCellStyle().getWrapText(); |
|
|
|
style.setVerticalAlignment(declarationHsCodeDescColumn ? VerticalAlignment.TOP : VerticalAlignment.CENTER); |
|
|
|
style.setAlignment(HorizontalAlignment.LEFT); |
|
|
|
boolean declarationAfterPriceColumn = i >= declarationCenterStartCol; |
|
|
|
style.setVerticalAlignment(VerticalAlignment.CENTER); |
|
|
|
style.setAlignment(declarationAfterPriceColumn ? HorizontalAlignment.CENTER : HorizontalAlignment.LEFT); |
|
|
|
style.setWrapText(keepWrapText || declarationHsCodeDescColumn); |
|
|
|
c7.setCellStyle(style); |
|
|
|
boolean declarationFixedTwoScaleColumn = fixedDeclarationPriceScale && declarationFixedPriceCols.contains(i); |
|
|
|
@ -691,7 +699,7 @@ public class ExcelTemplateTX { |
|
|
|
font7.setFontHeightInPoints((short) 10); |
|
|
|
style7.setFont(font7); |
|
|
|
style7.setVerticalAlignment(VerticalAlignment.CENTER); |
|
|
|
style7.setAlignment(HorizontalAlignment.RIGHT); |
|
|
|
style7.setAlignment(HorizontalAlignment.CENTER); |
|
|
|
// 设置千分位格式(根据单元格实际小数位动态决定格式) |
|
|
|
DataFormat dataFormat = workbook.createDataFormat(); |
|
|
|
String numFmt3; |
|
|
|
@ -948,6 +956,10 @@ public class ExcelTemplateTX { |
|
|
|
|| "total_price".equalsIgnoreCase(field); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isDeclarationUnitPriceField(String field) { |
|
|
|
return "unit_price".equalsIgnoreCase(field); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isDeclarationQtyField(String field) { |
|
|
|
return "qty".equalsIgnoreCase(field); |
|
|
|
} |
|
|
|
|