At least print out correct offset information for PtrRefN if it has offset values set

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808501 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-09-16 08:20:17 +00:00
parent 57a396a502
commit b226bfe431
2 changed files with 21 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package org.apache.poi.ss.formula.ptg;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.LittleEndianInput;
/**
@ -33,4 +34,23 @@ public final class RefNPtg extends Ref2DPtgBase {
protected byte getSid() {
return sid;
}
protected final String formatReferenceAsString() {
StringBuilder builder = new StringBuilder();
// The bits in RefNPtg indicate offset, not relative/absolute values!
if(isRowRelative()) {
builder.append("RowOffset: ").append(getRow()).append(" ");
} else {
builder.append(getRow()+1);
}
if(isColRelative()) {
builder.append(" ColOffset: ").append(getColumn());
} else {
builder.append(CellReference.convertNumToColString(getColumn()));
}
return builder.toString();
}
}

View File

@ -105,7 +105,7 @@ public abstract class RefPtgBase extends OperandPtg {
return column.getValue(field_2_col);
}
protected final String formatReferenceAsString() {
protected String formatReferenceAsString() {
// Only make cell references as needed. Memory is an issue
CellReference cr = new CellReference(getRow(), getColumn(), !isRowRelative(), !isColRelative());
return cr.formatAsString();