fei
5 天以前 2f1ae9c10a1751438d09b3d848677deb883631aa
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -307,7 +307,6 @@
                int column = 0;
                if(index == 0) {
                    // 合并第一行的前5个单元格
                    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
                    // 必须先设置为true
                    // 页面布局设置
@@ -333,33 +332,49 @@
                    {
                        row.setHeight((short)(55.8 * 20));
                        Cell cell = row.createCell(6);
                        Cell cell = row.createCell(0);
//                        for(int cl = 1 ; cl <=8; cl++)
//                            cell = row.createCell(cl);
//
//
//                        for (int col = 4; col <= 7; col++) {
//                            row.getSheet().setColumnWidth(col, 15 * 256); // 每列15字符宽
                //        }
                        int margin = -40* 9525;
                        int mary = -11 * 9525;
                        XSSFClientAnchor anchor = new XSSFClientAnchor(
                                0,          // dx1
                                0,          // dy1
                                margin,     // dx2:右边界左移10像素
                                mary,          // dy2
                                (short)5,   // col1
                                0,          // row1
                                (short)9,   // col2
                                1          // row2
                        );
                        // 设置图片大小和位置
                        ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                                cell.getRow().getRowNum() + 1);
                     //   ClientAnchor anchor = new XSSFClientAnchor(0, 0, 600, 150, (short)0, 0, (short)6, 1);
                    //   anchor.setDx2(488);
                    //   anchor.setDy2(10);
                   //     anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
                        // 计算居中位置
//                    int col1 = 0; // 中间列
//                    int col2 = col1 + 2;
//                    anchor.setCol1(col1);
//                    anchor.setCol2(col2);
//                    anchor.setDx1(100);
//                    anchor.setDy1(0);
//                    anchor.setDx2(255); // 宽度
//                    anchor.setDy2(255); // 高度
                        anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
                        // 计算居中位置
                        int col1 = 4; // 中间列
                        int col2 = col1 + 3;
                        anchor.setCol1(col1);
                        anchor.setCol2(col2);
                        anchor.setRow1(0);
                        anchor.setRow2(1);
//                        int col1 = 4; // 中间列
//                        int col2 = col1 + 3;
//                        anchor.setCol1(col1);
//                        anchor.setCol2(col2);
//                        anchor.setRow1(0);
//                        anchor.setRow2(1);
                        byte[] data = bt;
                 
                        // 获取图片原始尺寸
                        BufferedImage image = ImageIO.read(new ByteArrayInputStream(data));
                        double widthInEMU = image.getWidth() * 9525 * 0.2;
                        double heightInEMU = image.getHeight() * 9525;
//                        double widthInEMU = image.getWidth() * 9525 * 0.2;
//                        double heightInEMU = image.getHeight() * 9525;
                        // 设置图片原始尺寸
                    //    anchor.setDx2(-100000); // 原始宽度
@@ -378,6 +393,7 @@
                    }
                    else
                        row.setHeight((short)(33 * 20));
                  //  sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
                    //  sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 7));
                    if(firow==1)