diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index c0f06eb8b..7fa34db87 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -67,6 +67,7 @@ Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx + 43354 - support for evalating formulas with missing args 45912 - fixed ArrayIndexOutOfBoundsException in EmbeddedObjectRefSubRecord 45889 - fixed ArrayIndexOutOfBoundsException when constructing HSLF Table with a single row Initial support for creating hyperlinks in HSLF diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 9a4b02f57..baead2a35 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -64,6 +64,7 @@ Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx + 43354 - support for evalating formulas with missing args 45912 - fixed ArrayIndexOutOfBoundsException in EmbeddedObjectRefSubRecord 45889 - fixed ArrayIndexOutOfBoundsException when constructing HSLF Table with a single row Initial support for creating hyperlinks in HSLF diff --git a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java index 295a86a70..bd8207418 100644 --- a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java +++ b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java @@ -36,9 +36,7 @@ import org.apache.poi.util.LittleEndian; * @author Glen Stampoultzis (glens at apache.org) * @author Michael Zalewski (zalewski at optonline.net) */ -public abstract class AbstractEscherHolderRecord - extends Record -{ +public abstract class AbstractEscherHolderRecord extends Record { private static boolean DESERIALISE; static { try { @@ -133,34 +131,6 @@ public abstract class AbstractEscherHolderRecord return getRecordSize(); } -// public int serialize(int offset, byte[] data) -// { -// if (escherRecords.size() == 0 && rawData != null) -// { -// System.arraycopy( rawData, 0, data, offset, rawData.length); -// return rawData.length; -// } -// else -// { -// collapseShapeInformation(); -// -// LittleEndian.putShort(data, 0 + offset, getSid()); -// LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); -// -// int pos = offset + 4; -// for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) -// { -// EscherRecord r = (EscherRecord) iterator.next(); -// pos += r.serialize(pos, data, new NullEscherSerializationListener() ); -// } -// -// return getRecordSize(); -// } -// } - - /** - * Size of record (including 4 byte header) - */ public int getRecordSize() { if (escherRecords.size() == 0 && rawData != null) @@ -323,9 +293,4 @@ public abstract class AbstractEscherHolderRecord { convertToEscherRecords(0, rawData.length, rawData ); } - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java b/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java index 65658ab3e..f6abd9c17 100644 --- a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The area format record is used to define the colours and patterns for an area. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The area format record is used to define the colours and patterns for an area.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class AreaFormatRecord extends Record { @@ -112,9 +110,6 @@ public final class AreaFormatRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 4 + 4 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/AreaRecord.java b/src/java/org/apache/poi/hssf/record/AreaRecord.java index de994427f..14a5737f5 100644 --- a/src/java/org/apache/poi/hssf/record/AreaRecord.java +++ b/src/java/org/apache/poi/hssf/record/AreaRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The area record is used to define a area chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The area record is used to define a area chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class AreaRecord extends Record { @@ -77,9 +75,6 @@ public final class AreaRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; diff --git a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java b/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java index 64d2a071d..1f6e03dbc 100644 --- a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The axis line format record defines the axis type details. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The axis line format record defines the axis type details.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class AxisLineFormatRecord - extends Record -{ +public final class AxisLineFormatRecord extends Record { public final static short sid = 0x1021; private short field_1_axisType; public final static short AXIS_TYPE_AXIS_LINE = 0; @@ -77,9 +70,6 @@ public class AxisLineFormatRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -128,10 +118,4 @@ public class AxisLineFormatRecord { this.field_1_axisType = field_1_axisType; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java b/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java index 54cd2b49b..32656d470 100644 --- a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The axis options record provides unit information and other various tidbits about the axis. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The axis options record provides unit information and other various tidbits about the axis.

+ * * @author Andrew C. Oliver(acoliver at apache.org) */ public final class AxisOptionsRecord extends Record { @@ -144,9 +142,6 @@ public final class AxisOptionsRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java b/src/java/org/apache/poi/hssf/record/AxisParentRecord.java index 281a0824f..9a92c2e4a 100644 --- a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisParentRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The axis size and location - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The axis size and location

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class AxisParentRecord - extends Record -{ +public final class AxisParentRecord extends Record { public final static short sid = 0x1041; private short field_1_axisType; public final static short AXIS_TYPE_MAIN = 0; @@ -103,9 +96,6 @@ public class AxisParentRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 4 + 4 + 4 + 4; @@ -218,10 +208,4 @@ public class AxisParentRecord { this.field_5_height = field_5_height; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/AxisRecord.java b/src/java/org/apache/poi/hssf/record/AxisRecord.java index b57ac1d4f..0619027c9 100644 --- a/src/java/org/apache/poi/hssf/record/AxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The axis record defines the type of an axis. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The axis record defines the type of an axis.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class AxisRecord - extends Record -{ +public final class AxisRecord extends Record { public final static short sid = 0x101d; private short field_1_axisType; public final static short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0; @@ -104,9 +97,6 @@ public class AxisRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 4 + 4 + 4 + 4; @@ -221,10 +211,4 @@ public class AxisRecord { this.field_5_reserved4 = field_5_reserved4; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java b/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java index 361ae2304..c70129d7f 100644 --- a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java +++ b/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The number of axes used on a chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The number of axes used on a chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class AxisUsedRecord - extends Record -{ +public final class AxisUsedRecord extends Record { public final static short sid = 0x1046; private short field_1_numAxis; @@ -73,9 +66,6 @@ public class AxisUsedRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +101,4 @@ public class AxisUsedRecord { this.field_1_numAxis = field_1_numAxis; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/BarRecord.java b/src/java/org/apache/poi/hssf/record/BarRecord.java index dbf41202a..a9733c521 100644 --- a/src/java/org/apache/poi/hssf/record/BarRecord.java +++ b/src/java/org/apache/poi/hssf/record/BarRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The bar record is used to define a bar chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The bar record is used to define a bar chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class BarRecord extends Record { @@ -94,9 +92,6 @@ public final class BarRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java index c8f50ff1c..15d3174c2 100644 --- a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java @@ -23,14 +23,11 @@ import org.apache.poi.util.*; /** - * Record for the bottom margin. - * NOTE: This source was automatically generated. - * + * Record for the bottom margin.

+ * * @author Shawn Laubach (slaubach at apache dot org) */ -public class BottomMarginRecord - extends Record implements Margin -{ +public final class BottomMarginRecord extends Record implements Margin { public final static short sid = 0x29; private double field_1_margin; @@ -62,9 +59,6 @@ public class BottomMarginRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 8; @@ -98,4 +92,4 @@ public class BottomMarginRecord return rec; } -} // END OF CLAS \ No newline at end of file +} // END OF CLA \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java b/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java index 158b3e5cf..2842788c7 100644 --- a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * This record refers to a category or series axis and is used to specify label/tickmark frequency. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * This record refers to a category or series axis and is used to specify label/tickmark frequency.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class CategorySeriesAxisRecord extends Record { @@ -99,9 +97,6 @@ public final class CategorySeriesAxisRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/ChartRecord.java b/src/java/org/apache/poi/hssf/record/ChartRecord.java index 9ce93946a..62e02d4fa 100644 --- a/src/java/org/apache/poi/hssf/record/ChartRecord.java +++ b/src/java/org/apache/poi/hssf/record/ChartRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** * The chart record is used to define the location and size of a chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - * @author Glen Stampoultzis (glens at apache.org) */ -public class ChartRecord - extends Record -{ +public final class ChartRecord extends Record { public final static short sid = 0x1002; private int field_1_x; private int field_2_y; @@ -94,9 +86,6 @@ public class ChartRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 4 + 4 + 4 + 4; @@ -183,10 +172,4 @@ public class ChartRecord { this.field_4_height = field_4_height; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java index ed2372d82..68ce8e91d 100644 --- a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The common object data record is used to store all common preferences for an excel object. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - * + * The common object data record is used to store all common preferences for an excel object.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class CommonObjectDataSubRecord extends SubRecord { @@ -147,9 +145,6 @@ public final class CommonObjectDataSubRecord extends SubRecord { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 4 + 4 + 4; diff --git a/src/java/org/apache/poi/hssf/record/DVALRecord.java b/src/java/org/apache/poi/hssf/record/DVALRecord.java index 9235ef2c6..9f051db6e 100644 --- a/src/java/org/apache/poi/hssf/record/DVALRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVALRecord.java @@ -164,7 +164,6 @@ public class DVALRecord extends Record return getRecordSize(); } - //with 4 bytes header public int getRecordSize() { return 22; diff --git a/src/java/org/apache/poi/hssf/record/DatRecord.java b/src/java/org/apache/poi/hssf/record/DatRecord.java index a6c504015..f93efe622 100644 --- a/src/java/org/apache/poi/hssf/record/DatRecord.java +++ b/src/java/org/apache/poi/hssf/record/DatRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The dat record is used to store options for the chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The dat record is used to store options for the chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class DatRecord extends Record { @@ -80,9 +78,6 @@ public final class DatRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; diff --git a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java index 7d37704eb..b0a67aefa 100644 --- a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The data format record is used to index into a series. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - * + * The data format record is used to index into a series.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class DataFormatRecord extends Record { @@ -95,9 +93,6 @@ public final class DataFormatRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java index 49120e75a..e970265f2 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The default data label text properties record identifies the text characteristics of the preceeding text record. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The default data label text properties record identifies the text characteristics of the preceding text record.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class DefaultDataLabelTextPropertiesRecord - extends Record -{ +public final class DefaultDataLabelTextPropertiesRecord extends Record { public final static short sid = 0x1024; private short field_1_categoryDataType; public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; @@ -76,9 +69,6 @@ public class DefaultDataLabelTextPropertiesRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -125,10 +115,4 @@ public class DefaultDataLabelTextPropertiesRecord { this.field_1_categoryDataType = field_1_categoryDataType; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java b/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java index ea083ee1e..1f149efbb 100644 --- a/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java +++ b/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java @@ -83,9 +83,6 @@ public class DrawingGroupRecord extends AbstractEscherHolderRecord convertRawBytesToEscherRecords(); } - /** - * Size of record (including 4 byte headers for all sections) - */ public int getRecordSize() { return grossSizeFromDataSize( getRawDataSize() ); diff --git a/src/java/org/apache/poi/hssf/record/EndSubRecord.java b/src/java/org/apache/poi/hssf/record/EndSubRecord.java index e2d3808d8..26f660942 100644 --- a/src/java/org/apache/poi/hssf/record/EndSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EndSubRecord.java @@ -20,10 +20,8 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; /** - * The end data record is used to denote the end of the subrecords. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The end data record is used to denote the end of the subrecords.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class EndSubRecord extends SubRecord { @@ -61,9 +59,6 @@ public final class EndSubRecord extends SubRecord { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 ; @@ -79,9 +74,4 @@ public final class EndSubRecord extends SubRecord { return rec; } - - - -} // END OF CLASS - - +} diff --git a/src/java/org/apache/poi/hssf/record/EscherAggregate.java b/src/java/org/apache/poi/hssf/record/EscherAggregate.java index bfeb44751..369cf0b14 100644 --- a/src/java/org/apache/poi/hssf/record/EscherAggregate.java +++ b/src/java/org/apache/poi/hssf/record/EscherAggregate.java @@ -498,9 +498,6 @@ public class EscherAggregate extends AbstractEscherHolderRecord return size; } - /** - * The number of bytes required to serialize this record. - */ public int getRecordSize() { convertUserModelToRecords(); diff --git a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java index 582668f33..14a849de5 100644 --- a/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExtSSTRecord.java @@ -129,7 +129,6 @@ public class ExtSSTRecord return pos; } - /** Returns the size of this record */ public int getRecordSize() { return 6 + 8*getNumInfoRecords(); diff --git a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java b/src/java/org/apache/poi/hssf/record/FontBasisRecord.java index 645db716c..452a8f9ae 100644 --- a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontBasisRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The font basis record stores various font metrics. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The font basis record stores various font metrics.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class FontBasisRecord - extends Record -{ +public final class FontBasisRecord extends Record { public final static short sid = 0x1060; private short field_1_xBasis; private short field_2_yBasis; @@ -101,9 +94,6 @@ public class FontBasisRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2 + 2; @@ -207,10 +197,4 @@ public class FontBasisRecord { this.field_5_indexToFontTable = field_5_indexToFontTable; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java b/src/java/org/apache/poi/hssf/record/FontIndexRecord.java index b2ece5317..241753bac 100644 --- a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/FontIndexRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The font index record indexes into the font table for the text record. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The font index record indexes into the font table for the text record.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class FontIndexRecord - extends Record -{ +public final class FontIndexRecord extends Record { public final static short sid = 0x1026; private short field_1_fontIndex; @@ -73,9 +66,6 @@ public class FontIndexRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +101,4 @@ public class FontIndexRecord { this.field_1_fontIndex = field_1_fontIndex; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/FrameRecord.java b/src/java/org/apache/poi/hssf/record/FrameRecord.java index 4425b0817..357728a0e 100644 --- a/src/java/org/apache/poi/hssf/record/FrameRecord.java +++ b/src/java/org/apache/poi/hssf/record/FrameRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The frame record indicates whether there is a border around the displayed text of a chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The frame record indicates whether there is a border around the displayed text of a chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class FrameRecord extends Record { @@ -85,9 +83,6 @@ public final class FrameRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java index 0618ea6f4..4cdbbff0e 100644 --- a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** * The group marker record is used as a position holder for groups. * @author Glen Stampoultzis (glens at apache.org) */ -public class GroupMarkerSubRecord - extends SubRecord -{ - public final static short sid = 0x06; +public class GroupMarkerSubRecord extends SubRecord { + public final static short sid = 0x0006; private byte[] reserved = new byte[0]; // would really love to know what goes in here. @@ -43,7 +37,6 @@ public class GroupMarkerSubRecord public GroupMarkerSubRecord(RecordInputStream in) { -// int pos = 0; reserved = in.readRemainder(); } @@ -67,9 +60,6 @@ public class GroupMarkerSubRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + reserved.length; @@ -87,9 +77,4 @@ public class GroupMarkerSubRecord rec.reserved[i] = reserved[i]; return rec; } - - - -} // END OF CLASS - - +} diff --git a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java index 92da85cea..1a0753086 100644 --- a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java @@ -17,16 +17,16 @@ package org.apache.poi.hssf.record; -import org.apache.poi.util.*; +import org.apache.poi.util.LittleEndian; /** - * Record for the left margin. - * NOTE: This source was automatically generated. + * Record for the left margin.

+ * * @author Shawn Laubach (slaubach at apache dot org) */ public class LeftMarginRecord extends Record implements Margin { - public final static short sid = 0x26; + public final static short sid = 0x0026; private double field_1_margin; public LeftMarginRecord() { } @@ -53,9 +53,6 @@ public class LeftMarginRecord extends Record implements Margin return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 8; } @@ -85,4 +82,4 @@ public class LeftMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLAS \ No newline at end of file +} // END OF CLA \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/LegendRecord.java b/src/java/org/apache/poi/hssf/record/LegendRecord.java index 08ff6513f..d4351b72a 100644 --- a/src/java/org/apache/poi/hssf/record/LegendRecord.java +++ b/src/java/org/apache/poi/hssf/record/LegendRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * Defines a legend for a chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Defines a legend for a chart.

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ public final class LegendRecord extends Record { @@ -135,9 +133,6 @@ public final class LegendRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 4 + 4 + 4 + 4 + 1 + 1 + 2; diff --git a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java index c3f0197f3..78142a17c 100644 --- a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * Describes a line format record. The line format record controls how a line on a chart appears. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Describes a line format record. The line format record controls how a line on a chart appears.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class LineFormatRecord extends Record { @@ -120,9 +118,6 @@ public final class LineFormatRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 4 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java index 673fc85f4..46610ec2b 100644 --- a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java +++ b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * Describes a linked data record. This record referes to the series data or text. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Describes a linked data record. This record referes to the series data or text.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class LinkedDataRecord extends Record { @@ -110,9 +108,6 @@ public final class LinkedDataRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 1 + 1 + 2 + 2 + field_5_formulaOfLink.getSize(); diff --git a/src/java/org/apache/poi/hssf/record/Margin.java b/src/java/org/apache/poi/hssf/record/Margin.java index 0dd59ece2..0850ca4a6 100644 --- a/src/java/org/apache/poi/hssf/record/Margin.java +++ b/src/java/org/apache/poi/hssf/record/Margin.java @@ -20,19 +20,18 @@ package org.apache.poi.hssf.record; /** * The margin interface is a parent used to define left, right, top and bottom margins. * This allows much of the code to be generic when it comes to handling margins. - * NOTE: This source wass automatically generated. * * @author Shawn Laubach (slaubach at apache dot org) */ -public interface Margin -{ - /** - * Get the margin field for the Margin. - */ - public double getMargin(); +public interface Margin { + // TODO - introduce MarginBaseRecord + /** + * Get the margin field for the Margin. + */ + public double getMargin(); - /** - * Set the margin field for the Margin. - */ - public void setMargin( double field_1_margin ); -} // END OF CLASS \ No newline at end of file + /** + * Set the margin field for the Margin. + */ + public void setMargin(double field_1_margin); +} diff --git a/src/java/org/apache/poi/hssf/record/NameRecord.java b/src/java/org/apache/poi/hssf/record/NameRecord.java index 512e784c0..0c2d17b49 100644 --- a/src/java/org/apache/poi/hssf/record/NameRecord.java +++ b/src/java/org/apache/poi/hssf/record/NameRecord.java @@ -410,8 +410,6 @@ public final class NameRecord extends Record { return nChars; } - /** returns the record size - */ public int getRecordSize(){ return 4 // sid + size + 15 // 4 shorts + 7 bytes diff --git a/src/java/org/apache/poi/hssf/record/NoteRecord.java b/src/java/org/apache/poi/hssf/record/NoteRecord.java index 2f506f115..1a82d56e9 100644 --- a/src/java/org/apache/poi/hssf/record/NoteRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteRecord.java @@ -100,9 +100,6 @@ public class NoteRecord extends Record { return getRecordSize(); } - /** - * Size of record - */ public int getRecordSize() { int retval = 4 + 2 + 2 + 2 + 2 + 2 + 1 + field_5_author.length() + 1; diff --git a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java index 4b96a0ee4..74dfad9a0 100644 --- a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java @@ -87,9 +87,6 @@ public class NoteStructureSubRecord return getRecordSize(); } - /** - * Size of record - */ public int getRecordSize() { return 4 + reserved.length; diff --git a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java index 00307e141..3f35184eb 100644 --- a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,25 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The number format index record indexes format table. This applies to an axis. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The number format index record indexes format table. This applies to an axis.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class NumberFormatIndexRecord - extends Record -{ - public final static short sid = 0x104e; +public final class NumberFormatIndexRecord extends Record { + public final static short sid = 0x104E; private short field_1_formatIndex; @@ -73,9 +66,6 @@ public class NumberFormatIndexRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +101,4 @@ public class NumberFormatIndexRecord { this.field_1_formatIndex = field_1_formatIndex; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/ObjRecord.java b/src/java/org/apache/poi/hssf/record/ObjRecord.java index 03ea7d1f5..98a2df4e5 100644 --- a/src/java/org/apache/poi/hssf/record/ObjRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjRecord.java @@ -117,9 +117,6 @@ public final class ObjRecord extends Record { return getRecordSize(); } - /** - * Size of record (excluding 4 byte header) - */ public int getRecordSize() { int size = 0; diff --git a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java index 7a86fe2ec..95fc5ff7f 100644 --- a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * Links text to an object on the chart or identifies it as the title. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Links text to an object on the chart or identifies it as the title.

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ -public class ObjectLinkRecord - extends Record -{ +public final class ObjectLinkRecord extends Record { public final static short sid = 0x1027; private short field_1_anchorId; public final static short ANCHOR_ID_CHART_TITLE = 1; @@ -93,9 +86,6 @@ public class ObjectLinkRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2; @@ -180,10 +170,4 @@ public class ObjectLinkRecord { this.field_3_link2 = field_3_link2; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/PaneRecord.java b/src/java/org/apache/poi/hssf/record/PaneRecord.java index f02b0795b..f02e517a3 100644 --- a/src/java/org/apache/poi/hssf/record/PaneRecord.java +++ b/src/java/org/apache/poi/hssf/record/PaneRecord.java @@ -22,10 +22,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * Describes the frozen and unfozen panes. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Describes the frozen and unfozen panes.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class PaneRecord extends Record { @@ -104,9 +102,6 @@ public final class PaneRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java index e678eac78..1a50441ff 100644 --- a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java +++ b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java @@ -20,10 +20,8 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; /** - * preceeds and identifies a frame as belonging to the plot area. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * preceeds and identifies a frame as belonging to the plot area.

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ public final class PlotAreaRecord extends Record { @@ -62,9 +60,6 @@ public final class PlotAreaRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 ; @@ -80,13 +75,4 @@ public final class PlotAreaRecord extends Record { return rec; } - - - - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java index 9df6811e2..04a124080 100644 --- a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java +++ b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The plot growth record specifies the scaling factors used when a font is scaled. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The plot growth record specifies the scaling factors used when a font is scaled.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class PlotGrowthRecord - extends Record -{ +public final class PlotGrowthRecord extends Record { public final static short sid = 0x1064; private int field_1_horizontalScale; private int field_2_verticalScale; @@ -81,9 +74,6 @@ public class PlotGrowthRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 4 + 4; @@ -136,10 +126,4 @@ public class PlotGrowthRecord { this.field_2_verticalScale = field_2_verticalScale; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java index 75cdb2c2f..32fb7c8a4 100644 --- a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java @@ -15,16 +15,16 @@ limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; -import org.apache.poi.util.*; +import org.apache.poi.util.LittleEndian; /** - * Record for the right margin. * NOTE: This source was automatically generated. * @author Shawn Laubach (slaubach at apache dot org) + * Record for the right margin.

+ * + * @author Shawn Laubach (slaubach at apache dot org) */ -public class RightMarginRecord extends Record implements Margin -{ +public final class RightMarginRecord extends Record implements Margin { public final static short sid = 0x27; private double field_1_margin; @@ -52,9 +52,6 @@ public class RightMarginRecord extends Record implements Margin return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 8; } public short getSid() { return sid; } @@ -76,4 +73,4 @@ public class RightMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLA \ No newline at end of file +} // END OF CL \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/SCLRecord.java b/src/java/org/apache/poi/hssf/record/SCLRecord.java index 7295ad61e..09093af6c 100644 --- a/src/java/org/apache/poi/hssf/record/SCLRecord.java +++ b/src/java/org/apache/poi/hssf/record/SCLRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,25 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * Specifies the window's zoom magnification. If this record isn't present then the windows zoom is 100%. see p384 Excel Dev Kit - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Specifies the window's zoom magnification.

+ * If this record isn't present then the windows zoom is 100%. see p384 Excel Dev Kit + * * @author Andrew C. Oliver (acoliver at apache.org) */ -public class SCLRecord - extends Record -{ - public final static short sid = 0xa0; +public final class SCLRecord extends Record { + public final static short sid = 0x00A0; private short field_1_numerator; private short field_2_denominator; @@ -80,9 +74,6 @@ public class SCLRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2; @@ -135,10 +126,4 @@ public class SCLRecord { this.field_2_denominator = field_2_denominator; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java index acc9665ae..0f5c19361 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The series chart group index record stores the index to the CHARTFORMAT record (0 based). - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The series chart group index record stores the index to the CHARTFORMAT record (0 based).

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class SeriesChartGroupIndexRecord - extends Record -{ +public final class SeriesChartGroupIndexRecord extends Record { public final static short sid = 0x1045; private short field_1_chartGroupIndex; @@ -73,9 +66,6 @@ public class SeriesChartGroupIndexRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +101,4 @@ public class SeriesChartGroupIndexRecord { this.field_1_chartGroupIndex = field_1_chartGroupIndex; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java index 6896a0a21..70565c66b 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * links a series to its position in the series list. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * links a series to its position in the series list.

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ -public class SeriesIndexRecord - extends Record -{ +public final class SeriesIndexRecord extends Record { public final static short sid = 0x1065; private short field_1_index; @@ -73,9 +66,6 @@ public class SeriesIndexRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +101,4 @@ public class SeriesIndexRecord { this.field_1_index = field_1_index; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java index a3e8089bf..868358b0d 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The series label record defines the type of label associated with the data format record. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The series label record defines the type of label associated with the data format record.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class SeriesLabelsRecord extends Record { @@ -83,9 +81,6 @@ public final class SeriesLabelsRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; diff --git a/src/java/org/apache/poi/hssf/record/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/SeriesRecord.java index 34b3c94a6..b2ab88e8c 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The series record describes the overall data for a series. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The series record describes the overall data for a series.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class SeriesRecord - extends Record -{ +public final class SeriesRecord extends Record { public final static short sid = 0x1003; private short field_1_categoryDataType; public final static short CATEGORY_DATA_TYPE_DATES = 0; @@ -121,9 +114,6 @@ public class SeriesRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2 + 2 + 2; @@ -283,10 +273,4 @@ public class SeriesRecord { this.field_6_numBubbleValues = field_6_numBubbleValues; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java index a445dc616..da0e854ea 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.StringUtil; /** - * Defines a series name - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Defines a series name

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ -public class SeriesTextRecord - extends Record -{ +public final class SeriesTextRecord extends Record { public final static short sid = 0x100d; private short field_1_id; private byte field_2_textLength; @@ -94,9 +88,6 @@ public class SeriesTextRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 1 + 1 + (field_2_textLength *2); @@ -199,10 +190,4 @@ public class SeriesTextRecord { this.field_4_text = field_4_text; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java index ff69ec546..6b38c40a4 100644 --- a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java +++ b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * Indicates the chart-group index for a series. The order probably defines the mapping. So the 0th record probably means the 0th series. The only field in this of course defines which chart group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG) - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Indicates the chart-group index for a series. The order probably defines the mapping. + * So the 0th record probably means the 0th series. The only field in this of course defines which chart + * group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG)

+ * * @author Andrew C. Oliver (acoliver at apache.org) */ -public class SeriesToChartGroupRecord - extends Record -{ +public final class SeriesToChartGroupRecord extends Record { public final static short sid = 0x1045; private short field_1_chartGroupIndex; @@ -73,9 +68,6 @@ public class SeriesToChartGroupRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -111,10 +103,4 @@ public class SeriesToChartGroupRecord { this.field_1_chartGroupIndex = field_1_chartGroupIndex; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java index 9ae777e1e..1f7a5e44e 100644 --- a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java +++ b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * Describes a chart sheet properties record. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * Describes a chart sheet properties record.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class SheetPropertiesRecord extends Record { @@ -92,9 +90,6 @@ public final class SheetPropertiesRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 1; diff --git a/src/java/org/apache/poi/hssf/record/StringRecord.java b/src/java/org/apache/poi/hssf/record/StringRecord.java index e4e71f7db..d56e105f5 100644 --- a/src/java/org/apache/poi/hssf/record/StringRecord.java +++ b/src/java/org/apache/poi/hssf/record/StringRecord.java @@ -68,9 +68,6 @@ public class StringRecord extends Record { return isUnCompressedUnicode() ? field_1_string_length * 2 : field_1_string_length; } - /** - * gives the current serialized size of the record. Should include the sid and reclength (4 bytes). - */ public int getRecordSize() { return 4 + 2 + 1 + getStringByteLength(); diff --git a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java index 8a27d163d..59e0cd2e6 100644 --- a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java @@ -19,21 +19,21 @@ package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** * The TXO record is used to define the properties of a text box. It is followed - by two continue records unless there is no actual text. The first continue record contains - the text data and the next continue record contains the formatting runs. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * by two continue records unless there is no actual text. The first continue record contains + * the text data and the next continue record contains the formatting runs.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public class TextObjectBaseRecord extends Record { - public final static short sid = 0x1B6; + // TODO - don't instantiate superclass + public final static short sid = 0x01B6; private static final BitField reserved1 = BitFieldFactory.getInstance(0x0001); private static final BitField HorizontalTextAlignment = BitFieldFactory.getInstance(0x000E); @@ -149,9 +149,6 @@ public class TextObjectBaseRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 4; diff --git a/src/java/org/apache/poi/hssf/record/TextRecord.java b/src/java/org/apache/poi/hssf/record/TextRecord.java index 60c05e6d0..aeb9dc89c 100644 --- a/src/java/org/apache/poi/hssf/record/TextRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The text record is used to define text stored on a chart. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The text record is used to define text stored on a chart.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class TextRecord extends Record { @@ -204,9 +202,6 @@ public final class TextRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 1 + 1 + 2 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/TickRecord.java b/src/java/org/apache/poi/hssf/record/TickRecord.java index 7e216156c..f24f033eb 100644 --- a/src/java/org/apache/poi/hssf/record/TickRecord.java +++ b/src/java/org/apache/poi/hssf/record/TickRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The Tick record defines how tick marks and label positioning/formatting - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The Tick record defines how tick marks and label positioning/formatting

+ * * @author Andrew C. Oliver(acoliver at apache.org) */ public final class TickRecord extends Record { @@ -151,9 +149,6 @@ public final class TickRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2; diff --git a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java index d67509e6c..4d1a19a77 100644 --- a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java @@ -20,13 +20,11 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.*; /** - * Record for the top margin. - * NOTE: This source was automatically generated. - * + * Record for the top margin.

+ * * @author Shawn Laubach (slaubach at apache dot org) */ -public class TopMarginRecord extends Record implements Margin -{ +public final class TopMarginRecord extends Record implements Margin { public final static short sid = 0x28; private double field_1_margin; @@ -57,9 +55,6 @@ public class TopMarginRecord extends Record implements Margin return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 8; } public short getSid() { return sid; } @@ -81,4 +76,4 @@ public class TopMarginRecord extends Record implements Margin rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF CLAS \ No newline at end of file +} // END OF CLA \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/UnitsRecord.java b/src/java/org/apache/poi/hssf/record/UnitsRecord.java index 4295cfe79..e4464eb79 100644 --- a/src/java/org/apache/poi/hssf/record/UnitsRecord.java +++ b/src/java/org/apache/poi/hssf/record/UnitsRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,24 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; - - -import org.apache.poi.util.*; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; /** - * The units record describes units. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The units record describes units.

+ * * @author Glen Stampoultzis (glens at apache.org) */ -public class UnitsRecord - extends Record -{ +public final class UnitsRecord extends Record { public final static short sid = 0x1001; private short field_1_units; @@ -74,9 +67,6 @@ public class UnitsRecord return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 2; @@ -112,10 +102,4 @@ public class UnitsRecord { this.field_1_units = field_1_units; } - - -} // END OF CLASS - - - - +} diff --git a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java index bc5023212..9caffa73b 100644 --- a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java +++ b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java @@ -23,10 +23,8 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; /** - * The value range record defines the range of the value axis. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - + * The value range record defines the range of the value axis.

+ * * @author Glen Stampoultzis (glens at apache.org) */ public final class ValueRangeRecord extends Record { @@ -121,9 +119,6 @@ public final class ValueRangeRecord extends Record { return getRecordSize(); } - /** - * Size of record (exluding 4 byte header) - */ public int getRecordSize() { return 4 + 8 + 8 + 8 + 8 + 8 + 2; diff --git a/src/java/org/apache/poi/hssf/record/formula/eval/MissingArgEval.java b/src/java/org/apache/poi/hssf/record/formula/eval/MissingArgEval.java new file mode 100644 index 000000000..708329ba6 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/formula/eval/MissingArgEval.java @@ -0,0 +1,35 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.formula.eval; + +/** + * Represents the (intermediate) evaluated result of a missing function argument. In most cases + * this can be translated into {@link BlankEval} but there are some notable exceptions. Functions + * COUNT and COUNTA do count their missing args. Note - the differences between + * {@link MissingArgEval} and {@link BlankEval} have not been investigated fully, so the POI + * evaluator may need to be updated to account for these as they are found. + * + * @author Josh Micich + */ +public final class MissingArgEval implements ValueEval { + + public static MissingArgEval instance = new MissingArgEval(); + + private MissingArgEval() { + } +} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Count.java b/src/java/org/apache/poi/hssf/record/formula/functions/Count.java index fd5944e85..62f4b6137 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Count.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Count.java @@ -19,6 +19,7 @@ package org.apache.poi.hssf.record.formula.functions; import org.apache.poi.hssf.record.formula.eval.ErrorEval; import org.apache.poi.hssf.record.formula.eval.Eval; +import org.apache.poi.hssf.record.formula.eval.MissingArgEval; import org.apache.poi.hssf.record.formula.eval.NumberEval; import org.apache.poi.hssf.record.formula.functions.CountUtils.I_MatchPredicate; @@ -64,6 +65,10 @@ public final class Count implements Function { // only numbers are counted return true; } + if(valueEval == MissingArgEval.instance) { + // oh yeah, and missing arguments + return true; + } // error values and string values not counted return false; diff --git a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java index 7aa9bb2a8..41a7c72fa 100644 --- a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java +++ b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java @@ -52,6 +52,7 @@ import org.apache.poi.hssf.record.formula.eval.BoolEval; import org.apache.poi.hssf.record.formula.eval.ErrorEval; import org.apache.poi.hssf.record.formula.eval.Eval; import org.apache.poi.hssf.record.formula.eval.FunctionEval; +import org.apache.poi.hssf.record.formula.eval.MissingArgEval; import org.apache.poi.hssf.record.formula.eval.NameEval; import org.apache.poi.hssf.record.formula.eval.NameXEval; import org.apache.poi.hssf.record.formula.eval.NumberEval; @@ -284,10 +285,7 @@ public final class WorkbookEvaluator { continue; } if (ptg instanceof MemErrPtg) { continue; } - if (ptg instanceof MissingArgPtg) { - // TODO - might need to push BlankEval or MissingArgEval - continue; - } + Eval opResult; if (ptg instanceof OperationPtg) { OperationPtg optg = (OperationPtg) ptg; @@ -306,6 +304,9 @@ public final class WorkbookEvaluator { } // logDebug("invoke " + operation + " (nAgs=" + numops + ")"); opResult = invokeOperation(operation, ops, _workbook, sheetIndex, srcRowNum, srcColNum); + if (opResult == MissingArgEval.instance) { + opResult = BlankEval.INSTANCE; + } } else { opResult = getEvalForPtg(ptg, sheetIndex, tracker); } @@ -424,6 +425,9 @@ public final class WorkbookEvaluator { if (ptg instanceof ErrPtg) { return ErrorEval.valueOf(((ErrPtg) ptg).getErrorCode()); } + if (ptg instanceof MissingArgPtg) { + return MissingArgEval.instance; + } if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg || ptg instanceof DeletedArea3DPtg || ptg instanceof DeletedRef3DPtg) { return ErrorEval.REF_INVALID; diff --git a/src/testcases/org/apache/poi/hssf/record/formula/eval/AllFormulaEvalTests.java b/src/testcases/org/apache/poi/hssf/record/formula/eval/AllFormulaEvalTests.java index fe37a3c84..a26539cdd 100755 --- a/src/testcases/org/apache/poi/hssf/record/formula/eval/AllFormulaEvalTests.java +++ b/src/testcases/org/apache/poi/hssf/record/formula/eval/AllFormulaEvalTests.java @@ -36,6 +36,7 @@ public class AllFormulaEvalTests { result.addTestSuite(TestExternalFunction.class); result.addTestSuite(TestFormulaBugs.class); result.addTestSuite(TestFormulasFromSpreadsheet.class); + result.addTestSuite(TestMissingArgEval.class); result.addTestSuite(TestPercentEval.class); result.addTestSuite(TestRangeEval.class); result.addTestSuite(TestUnaryPlusEval.class); diff --git a/src/testcases/org/apache/poi/hssf/record/formula/eval/TestMissingArgEval.java b/src/testcases/org/apache/poi/hssf/record/formula/eval/TestMissingArgEval.java new file mode 100644 index 000000000..2a830b080 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/formula/eval/TestMissingArgEval.java @@ -0,0 +1,74 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.formula.eval; + +import java.util.EmptyStackException; + +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.CellValue; + +/** + * Tests for {@link MissingArgEval} + * + * @author Josh Micich + */ +public final class TestMissingArgEval extends TestCase { + + public void testEvaluateMissingArgs() { + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); + HSSFSheet sheet = wb.createSheet("Sheet1"); + HSSFCell cell = sheet.createRow(0).createCell(0); + + cell.setCellFormula("if(true,)"); + fe.clearAllCachedResultValues(); + CellValue cv; + try { + cv = fe.evaluate(cell); + } catch (EmptyStackException e) { + throw new AssertionFailedError("Missing args evaluation not implemented (bug 43354"); + } + // MissingArg -> BlankEval -> zero (as formula result) + assertEquals(0.0, cv.getNumberValue(), 0.0); + + // MissingArg -> BlankEval -> empty string (in concatenation) + cell.setCellFormula("\"abc\"&if(true,)"); + fe.clearAllCachedResultValues(); + assertEquals("abc", fe.evaluate(cell).getStringValue()); + } + + public void testCountFuncs() { + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); + HSSFSheet sheet = wb.createSheet("Sheet1"); + HSSFCell cell = sheet.createRow(0).createCell(0); + + cell.setCellFormula("COUNT(C5,,,,)"); // 4 missing args, C5 is blank + assertEquals(4.0, fe.evaluate(cell).getNumberValue(), 0.0); + + cell.setCellFormula("COUNTA(C5,,)"); // 2 missing args, C5 is blank + fe.clearAllCachedResultValues(); + assertEquals(2.0, fe.evaluate(cell).getNumberValue(), 0.0); + } +}