| | |
| | | for (SalesLedger ledger : ledgerList) { |
| | | XSSFSheet sheet = workbook.createSheet(ledger.getSalesContractNo()); |
| | | |
| | | sheet.setColumnWidth(0, 1310); // 4.56 → 精准显示 |
| | | sheet.setColumnWidth(1, 4000); // 15.06 → 精准显示 |
| | | sheet.setColumnWidth(2, 8980); // 34.43 → 精准显示 |
| | | sheet.setColumnWidth(3, 1820); // 6.56 → 精准显示 |
| | | sheet.setColumnWidth(4, 2880); // 10.68 → 精准显示 |
| | | sheet.setColumnWidth(5, 5090); // 19.31 → 精准显示 |
| | | sheet.setColumnWidth(6, 1410); // 4.97 → 精准显示 |
| | | // 设置页边距(单位:英寸,1英寸=2.54厘米) |
| | | sheet.getPrintSetup().setLandscape(false); // 纵向打印 |
| | | sheet.setMargin(Sheet.TopMargin, 0.54 / 2.54); // 上页边距:0.54厘米 |
| | | sheet.setMargin(Sheet.BottomMargin, 0.54 / 2.54); // 下页边距:0.54厘米 |
| | | sheet.setMargin(Sheet.LeftMargin, 0.41 / 2.54); // 左页边距:0.41厘米 |
| | | sheet.setMargin(Sheet.RightMargin, 0.41 / 2.54); // 右页边距:0.41厘米 |
| | | sheet.setMargin(Sheet.HeaderMargin, 0.77 / 2.54); // 页眉:0.77厘米 |
| | | sheet.setMargin(Sheet.FooterMargin, 0.27 / 2.54); // 页脚:0.27厘米 |
| | | |
| | | sheet.setColumnWidth(0, 1310); |
| | | sheet.setColumnWidth(1, 4000); |
| | | sheet.setColumnWidth(2, 8980); |
| | | sheet.setColumnWidth(3, 1820); |
| | | sheet.setColumnWidth(4, 2880); |
| | | sheet.setColumnWidth(5, 5090); |
| | | sheet.setColumnWidth(6, 1410); |
| | | |
| | | CellStyle companyTitle = createBaseStyle(workbook, "宋体", (short) 20, true, true); |
| | | CellStyle billTitle = createBaseStyle(workbook, "宋体", (short) 18, false, true); |
| | |
| | | Row row7 = sheet.createRow(7); |
| | | row7.createCell(0).setCellValue("地址:湖南省耒阳市创新创业园A1栋"); |
| | | Row row8 = sheet.createRow(8); |
| | | row8.createCell(0).setCellValue("货物详细信息:"); |
| | | row8.setHeightInPoints((short) 3); // 行高3磅 |
| | | Row row9 = sheet.createRow(9); |
| | | row9.createCell(0).setCellValue("货物详细信息:"); |
| | | |
| | | int tableStart = 9; |
| | | int tableStart = 10; |
| | | Row headerRow = sheet.createRow(tableStart); |
| | | headerRow.setHeightInPoints((short)22); |
| | | headerRow.setHeightInPoints((short)18); |
| | | |
| | | String[] headers = {"序号", "物料编号", "品名/规格", "单位", "数量", "订单号", "共四联"}; |
| | | for (int i = 0; i < headers.length; i++) { |
| | |
| | | for (int i = 0; i < productList.size(); i++) { |
| | | SalesLedgerProduct p = productList.get(i); |
| | | Row dataRow = sheet.createRow(currentRow++); |
| | | dataRow.setHeightInPoints((short)22); |
| | | dataRow.setHeightInPoints((short)18); |
| | | |
| | | String materialCode = ""; |
| | | if (p.getProductModelId() != null) { |
| | |
| | | for (int i = 0; i < needEmpty; i++) { |
| | | int seq = productList.size() + i; |
| | | Row dataRow = sheet.createRow(currentRow++); |
| | | dataRow.setHeightInPoints((short)22); |
| | | dataRow.setHeightInPoints((short)18); |
| | | |
| | | for (int c = 0; c <= 5; c++) dataRow.createCell(c).setCellStyle(dataCenterStyle); |
| | | |
| | |
| | | |
| | | // 合计 |
| | | Row totalRow = sheet.createRow(currentRow); |
| | | totalRow.setHeightInPoints((short)22); |
| | | totalRow.setHeightInPoints((short)18); |
| | | |
| | | // 合计放在第二列,不合并单元格 |
| | | totalRow.createCell(1).setCellValue("合计"); |