|
@@ -1154,7 +1154,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
if (x1 == 0) {
|
|
if (x1 == 0) {
|
|
x1 = 1;
|
|
x1 = 1;
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
String myData = DataInfo.get(val) + "";
|
|
String myData = DataInfo.get(val) + "";
|
|
if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
@@ -1187,10 +1187,19 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
// 这里根据实际需求选择图片类型
|
|
// 这里根据实际需求选择图片类型
|
|
int pictureIdx = workbook.addPicture(bytes,6);
|
|
int pictureIdx = workbook.addPicture(bytes,6);
|
|
|
|
|
|
- int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
|
- int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
|
|
|
|
- int picHeight = 0;
|
|
|
|
- int picWidth = 0;
|
|
|
|
|
|
+ CreationHelper helper = workbook.getCreationHelper();
|
|
|
|
+ ClientAnchor anchor = helper.createClientAnchor();
|
|
|
|
+ anchor.setCol1(x1); // param1是列号
|
|
|
|
+ anchor.setCol2(x2);
|
|
|
|
+ anchor.setRow1(y1); // param2是行号
|
|
|
|
+ anchor.setRow2(y2); // param2是行号
|
|
|
|
+ //
|
|
|
|
+ Drawing drawing = sheet.createDrawingPatriarch();
|
|
|
|
+ anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
|
|
+ // 插入图片
|
|
|
|
+ Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
|
|
+ pict.resize(1,1);
|
|
|
|
+ FileUtils.imageOrientation(sheet, anchor, new DataVO(x1-1, y1-1) );
|
|
|
|
|
|
} else if(myData.equals("1") && data.html().indexOf("hc-form-checkbox-group")>=0){
|
|
} else if(myData.equals("1") && data.html().indexOf("hc-form-checkbox-group")>=0){
|
|
Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
@@ -1201,16 +1210,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
cell.setCellValue(exceVal.replace("□","\u2611"));
|
|
cell.setCellValue(exceVal.replace("□","\u2611"));
|
|
}else {
|
|
}else {
|
|
Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
- short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
|
|
|
+ cell.setCellValue(myData);
|
|
|
|
|
|
- if (colspan >= 1) {
|
|
|
|
- for (int i = x1 - 1; i < x1 + colspan - 1; i++) {
|
|
|
|
- String dataInfo = cols.get(i).attr("width").replaceAll("px", "");
|
|
|
|
- if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
|
- picWidth += Integer.parseInt(dataInfo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1545,14 +1546,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
if (data.html().contains("el-tooltip")) {
|
|
if (data.html().contains("el-tooltip")) {
|
|
x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
- y2 = Integer.parseInt(data.children().get(0).children().get(0).attr("y2"));
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
- x2 = Integer.parseInt(data.children().get(0).attr("x2"));
|
|
|
|
y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
- y2 = Integer.parseInt(data.children().get(0).attr("y2"));
|
|
|
|
}
|
|
}
|
|
- /*if (x1 == 0) {
|
|
|
|
|
|
+ if (x1 == 0) {
|
|
x1 = 1;
|
|
x1 = 1;
|
|
}
|
|
}
|
|
String myData = DataInfo.get(val) + "";
|
|
String myData = DataInfo.get(val) + "";
|
|
@@ -1580,19 +1579,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
|
|
|
- CreationHelper helper = workbook.getCreationHelper();
|
|
|
|
- ClientAnchor anchor = helper.createClientAnchor();
|
|
|
|
- anchor.setCol1(x1); // param1是列号
|
|
|
|
- anchor.setCol2(x2);
|
|
|
|
- anchor.setRow1(y1); // param2是行号
|
|
|
|
- anchor.setRow2(y2); // param2是行号
|
|
|
|
- //
|
|
|
|
- Drawing drawing = sheet.createDrawingPatriarch();
|
|
|
|
- anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
|
|
- // 插入图片
|
|
|
|
- Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
|
|
- pict.resize(1,1);
|
|
|
|
- FileUtils.imageOrientation(sheet, anchor, new DataVO(x1-1, y1-1) );
|
|
|
|
|
|
+ int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
|
+ int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
|
|
|
|
+ int picHeight = 0;
|
|
|
|
+ int picWidth = 0;
|
|
|
|
|
|
if (rowspan == 0) {
|
|
if (rowspan == 0) {
|
|
String dataInfo = trs.get(y1).attr("height");
|
|
String dataInfo = trs.get(y1).attr("height");
|
|
@@ -1616,7 +1606,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- cell.setCellValue(myData);
|
|
|
|
|
|
+ if (colspan >= 1) {
|
|
|
|
+ for (int i = x1 - 1; i < x1 + colspan - 1; i++) {
|
|
|
|
+ String dataInfo = cols.get(i).attr("width").replaceAll("px", "");
|
|
|
|
+ if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
|
+ picWidth += Integer.parseInt(dataInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
pic.setAutoSize(true);
|
|
pic.setAutoSize(true);
|