diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-17 08:45:38 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-17 08:45:38 +0000 |
commit | 50c40b61f72903693f5304767fdd337d7e685f50 (patch) | |
tree | 8836fa01b52b94599237af67595ea15cf426c57c /poi-ooxml | |
parent | cd02f739eb2c2fe6978ea0672396c20c748f73e4 (diff) | |
download | poi-50c40b61f72903693f5304767fdd337d7e685f50.tar.gz poi-50c40b61f72903693f5304767fdd337d7e685f50.zip |
[github-354] Add extra methods to StringUtil and refactor some code to use them. Thanks to XenoAmess. This closes #354
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java | 7 | ||||
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java index 9cab106a14..bc60130c76 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java @@ -398,14 +398,15 @@ public class XSSFSimpleShape extends XSSFShape implements Iterable<XSSFTextParag * Convert an integer to its alpha equivalent e.g. 1 = A, 2 = B, 27 = AA etc */ private String valueToAlpha(int value) { - String alpha = ""; + StringBuilder alpha = new StringBuilder(); int modulo; while (value > 0) { modulo = (value - 1) % 26; - alpha = (char) (65 + modulo) + alpha; + alpha.append((char) (65 + modulo)); value = (value - modulo) / 26; } - return alpha; + alpha.reverse(); + return alpha.toString(); } private static String[] _romanChars = new String[] { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java index 2fdd7fa06d..70ee324c62 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java @@ -78,7 +78,7 @@ public class XSSFXmlColumnPr { String[] xPathTokens = ctXmlColumnPr.getXpath().split("/"); for (int i = numberOfCommonXPathAxis; i < xPathTokens.length; i++) { - localXPath.append("/" + xPathTokens[i]); + localXPath.append("/").append(xPathTokens[i]); } return localXPath.toString(); } |