fix excel sax

This commit is contained in:
Looly
2019-11-17 13:37:14 +08:00
parent f7d2b4b82d
commit 0837363931
6 changed files with 95 additions and 90 deletions

View File

@@ -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);
}
// 获取缩放后的新的宽和高

View File

@@ -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("&amp;");
break;
case '<':
sb.append("&lt;");
break;
case '>':
sb.append("&gt;");
break;
case '"':
sb.append("&quot;");
break;
case '\'':
sb.append("&apos;");
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);
}
/**