Commit 960de1e3 authored by neo's avatar neo

[bugfix] fixed bb inprove function for char index

parent a80484ee
package pwc.taxtech.atms.dto.vatdto;
import com.sun.xml.internal.ws.util.ASCIIUtility;
import lombok.Getter;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
......@@ -18,7 +19,22 @@ public class BBParasBo {
public BBParasBo(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException {
reportCode = resolverString(args, ec, 0);
columnIndex = resolverInteger(args, ec, 1);
try {
columnIndex = resolverInteger(args, ec, 1);
} catch (Exception e) {
String columnStr = resolverString(args, ec, 1);
int rtn = 0;
columnStr = columnStr.toLowerCase();
char[] excelCol = columnStr.toCharArray();
for (int i = columnStr.length() - 1; i >= 0; i--) {
if (excelCol[i] >= 'A' && excelCol[i] <= 'Z') {
rtn += ((int) Math.pow(26, excelCol.length - 1 - i) * (excelCol[i] - 64));
} else {
rtn = -1;
}
}
columnIndex = rtn;
}
rowIndex = resolverInteger(args, ec, 2);
period = args.length >= 4 ? resolverInteger(args, ec, 3) : 0;
year = args.length == 5 ? resolverInteger(args, ec, 4) : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment