mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix excel sax
This commit is contained in:
@@ -277,16 +277,16 @@ public class Img implements Serializable {
|
||||
int srcWidth = srcImage.getWidth(null);
|
||||
double heightRatio = NumberUtil.div(height, srcHeight);
|
||||
double widthRatio = NumberUtil.div(width, srcWidth);
|
||||
if (heightRatio == widthRatio) {
|
||||
|
||||
if (widthRatio == heightRatio) {
|
||||
// 长宽都按照相同比例缩放时,返回缩放后的图片
|
||||
scale(width, height);
|
||||
} else{
|
||||
// 宽缩放比例多就按照宽缩放,否则按照高缩放
|
||||
if (widthRatio < heightRatio) {
|
||||
scale(width, (int) (srcHeight * widthRatio));
|
||||
} else {
|
||||
scale((int) (srcWidth * heightRatio), height);
|
||||
}
|
||||
} else if (widthRatio < heightRatio) {
|
||||
// 宽缩放比例多就按照宽缩放
|
||||
scale(width, (int) (srcHeight * widthRatio));
|
||||
} else {
|
||||
// 否则按照高缩放
|
||||
scale((int) (srcWidth * heightRatio), height);
|
||||
}
|
||||
|
||||
// 获取缩放后的新的宽和高
|
||||
|
@@ -681,30 +681,19 @@ public class XmlUtil {
|
||||
* @since 4.0.8
|
||||
*/
|
||||
public static String escape(String string) {
|
||||
final StringBuilder sb = new StringBuilder(string.length());
|
||||
for (int i = 0, length = string.length(); i < length; i++) {
|
||||
char c = string.charAt(i);
|
||||
switch (c) {
|
||||
case '&':
|
||||
sb.append("&");
|
||||
break;
|
||||
case '<':
|
||||
sb.append("<");
|
||||
break;
|
||||
case '>':
|
||||
sb.append(">");
|
||||
break;
|
||||
case '"':
|
||||
sb.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
sb.append("'");
|
||||
break;
|
||||
default:
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
return EscapeUtil.escape(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反转义XML特殊字符:
|
||||
*
|
||||
* @param string 被替换的字符串
|
||||
* @return 替换后的字符串
|
||||
* @since 5.0.6
|
||||
* @see EscapeUtil#unescape(String)
|
||||
*/
|
||||
public static String unescape(String string) {
|
||||
return EscapeUtil.unescape(string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user