From 7c1e810bdbe3fc9e97181c157bb60d47c6b4c64d Mon Sep 17 00:00:00 2001 From: Avik Sengupta Date: Tue, 11 Jun 2002 21:17:44 +0000 Subject: [PATCH] pretty printing from AttrPtg, submitted by Werner Froidevaux git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352673 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/record/formula/AttrPtg.java | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java b/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java index 417a271065..a741192b8c 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java @@ -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;} -- 2.39.5