From 53d149f491dba554ee035599059a1bf65ea92df2 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期三, 12 二月 2025 17:36:13 +0800 Subject: [PATCH] 增加手动同步lis接口 --- ltkj-admin/src/main/java/com/ltkj/web/config/pdfutils/PdfUtils.java | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/config/pdfutils/PdfUtils.java b/ltkj-admin/src/main/java/com/ltkj/web/config/pdfutils/PdfUtils.java index 2626476..eb2050c 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/config/pdfutils/PdfUtils.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/config/pdfutils/PdfUtils.java @@ -111,7 +111,7 @@ return font; } catch (Exception e) { e.printStackTrace(); - throw new RuntimeException("璁剧疆瀛椾綋澶辫触锛�"); + throw new RuntimeException("璁剧疆瀛椾綋澶辫触锛�"+FONT_PATH); } } @@ -261,9 +261,10 @@ * @param list * @return */ - public static PdfPTable setTable2(Font headFont, Font textFont, String[] title, List<TjPdfVO> list,boolean flag) { + public static PdfPTable setTable2(Font headFont, Font textFont, String[] title, List<TjPdfVO> list,boolean flag,float[] titleWidth) { //鍥涘垪 - PdfPTable table = createTable(new float[]{240, 240,240}); + PdfPTable table = createTable(titleWidth); +// PdfPTable table = createTable(new float[]{240, 240,240}); //鐢绘爣棰� for (String head : title) { table.addCell(createCell(head, headFont)); @@ -319,7 +320,7 @@ } - private static PdfPTable createTable(float[] widths) { + public static PdfPTable createTable(float[] widths) { PdfPTable table = new PdfPTable(widths); try { // 璁剧疆琛ㄦ牸澶у皬 @@ -344,7 +345,7 @@ return table; } - private static PdfPCell createCell(String value, Font font) { + public static PdfPCell createCell(String value, Font font) { PdfPCell cell = new PdfPCell(); // 姘村钩銆佸瀭鐩村眳涓� cell.setVerticalAlignment(Element.ALIGN_MIDDLE); @@ -359,4 +360,30 @@ return cell; } + + /** + * + * @param value + * @param font + * @param boder Rectangle绫荤殑鏋氫妇 + * @param txtAlign Element绫荤殑鏋氫妇 + * @return + */ + public static PdfPCell createCell(String value, Font font,int boder,int txtAlign,Float paddingTop,Float paddingBottom) { + PdfPCell cell = new PdfPCell(); + // 姘村钩銆佸瀭鐩村眳涓� + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setHorizontalAlignment(txtAlign); + cell.setPhrase(new Phrase(value, font)); + if (paddingTop != null) + cell.setPaddingTop(paddingTop); + if (paddingBottom != null) + cell.setPaddingBottom(paddingBottom); + // 璁剧疆鏃犺竟妗� + cell.setBorder(boder); + // 璁剧疆楂樺害 + //cell.setFixedHeight(20); + + return cell; + } } -- Gitblit v1.8.0