Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
liaochong committed Dec 23, 2023
1 parent ceedf3c commit 19d296a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ private void setImage(Td td, Sheet sheet) {
ClientAnchor anchor = createHelper.createClientAnchor();
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
Image image = td.getImage();
if (image == null) {
image = new Image();
}
anchor.setDx1(isHssf ? (image.getMarginLeft() > 0 ? image.getMarginLeft() : 2) : Units.pixelToEMU(image.getMarginLeft() > 0 ? image.getMarginLeft() : 3));
anchor.setDy1(isHssf ? (image.getMarginTop() > 0 ? image.getMarginTop() : 1) : Units.pixelToEMU(image.getMarginTop() > 0 ? image.getMarginTop() : 3));
anchor.setCol1(td.col);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,33 @@ public static ExcelColumnMapping mapping(ExcelColumn excelColumn) {
result.promptContainer = promptContainer;
}
com.github.liaochong.myexcel.core.annotation.Image image = excelColumn.image();
result.image = new Image();
if (image.scaleX() > 0 && image.scaleY() > 0) {
result.image.setScaleX(image.scaleX());
result.image.setScaleY(image.scaleY());
result.image = new Image();
}
if ((image.marginTop() > 0)) {
if (result.image == null) {
result.image = new Image();
}
result.image.setMarginTop(image.marginTop());
}
if ((image.marginLeft() > 0)) {
if (result.image == null) {
result.image = new Image();
}
result.image.setMarginLeft(image.marginLeft());
}
if (image.width() > 0) {
if (result.image == null) {
result.image = new Image();
}
result.image.setWidth(image.width());
}
if (image.height() > 0) {
if (result.image == null) {
result.image = new Image();
}
result.image.setHeight(image.height());
}
com.github.liaochong.myexcel.core.annotation.DropdownList dr = excelColumn.dropdownList();
Expand Down

0 comments on commit 19d296a

Please sign in to comment.