]> source.dussan.org Git - poi.git/commitdiff
pretty printing from AttrPtg, submitted by Werner Froidevaux
authorAvik Sengupta <avik@apache.org>
Tue, 11 Jun 2002 21:17:44 +0000 (21:17 +0000)
committerAvik Sengupta <avik@apache.org>
Tue, 11 Jun 2002 21:17:44 +0000 (21:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352673 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/formula/AttrPtg.java

index 417a2710651c3960ad30642c18f2963bd374550c..a741192b8c620944dabd7fe44dc26b72041dd0fa 100644 (file)
@@ -191,10 +191,15 @@ public class AttrPtg
         return SIZE;
     }
 
-    public String toFormulaString()
-    {
-        return "ATTR";
+    public String toFormulaString(String[] operands) {
+        if(space.isSet(field_1_options)) {
+            return operands[ 0 ];
+        }
+        else {
+            return toFormulaString() + "(" + operands[ 0 ] + ")";
+        }
     }
+  
 
     public int getNumberOfOperands()
     {
@@ -206,9 +211,31 @@ public class AttrPtg
         return -1;
     }
         
-    public String toFormulaString(String[] operands) {
-        return "SUM(" + operands[ 0 ] + ")";
-    }    
+   public String toFormulaString() {
+      if(semiVolatile.isSet(field_1_options)) {
+        return "ATTR(semiVolatile)";
+      }
+      if(optiIf.isSet(field_1_options)) {
+        return "IF";
+      }
+      if( optiChoose.isSet(field_1_options)) {
+        return "CHOOSE";
+      }
+      if(optGoto.isSet(field_1_options)) {
+        return "GOTO";
+      }
+      if(sum.isSet(field_1_options)) {
+        return "SUM";
+      }
+      if(baxcel.isSet(field_1_options)) {
+        return "ATTR(baxcel)";
+      }
+      if(space.isSet(field_1_options)) {
+        return "";
+      }
+      return "UNKNOWN ATTRIBUTE";
+     }
+    
     
  
     public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}