poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1808501 - in /poi/trunk/src/java/org/apache/poi/ss/formula/ptg: RefNPtg.java RefPtgBase.java
Date Sat, 16 Sep 2017 08:20:17 GMT
Author: centic
Date: Sat Sep 16 08:20:17 2017
New Revision: 1808501

URL: http://svn.apache.org/viewvc?rev=1808501&view=rev
Log:
At least print out correct offset information for PtrRefN if it has offset values set

Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefNPtg.java
    poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefNPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefNPtg.java?rev=1808501&r1=1808500&r2=1808501&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefNPtg.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefNPtg.java Sat Sep 16 08:20:17 2017
@@ -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 Ref2D
 	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();
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java?rev=1808501&r1=1808500&r2=1808501&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java Sat Sep 16 08:20:17 2017
@@ -105,7 +105,7 @@ public abstract class RefPtgBase extends
 		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();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message