* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (glens at apache.org)
* @author Shawn Laubach (laubach at acm.org) Just Gridlines, Headers, Footers, and PrintSetup
+ * @author Jason Height (jheight at chariot dot net dot au) Clone support
*
* @see org.apache.poi.hssf.model.Workbook
* @see org.apache.poi.hssf.usermodel.HSSFSheet
return retval;
}
+ /**
+ * Clones the low level records of this sheet and returns the new sheet instance.
+ */
+ public Sheet cloneSheet()
+ {
+ ArrayList clonedRecords = new ArrayList(this.records.size());
+ for (int i=0; i<this.records.size();i++) {
+ Record rec = (Record)((Record)this.records.get(i)).clone();
+ //Need to pull out the Row record and the Value records from their
+ //Aggregates.
+ //This is probably the best way to do it since we probably dont want the createSheet
+ //To cater for these artificial Record types
+ if (rec instanceof RowRecordsAggregate) {
+ RowRecordsAggregate rrAgg = (RowRecordsAggregate)rec;
+ for (Iterator rowIter = rrAgg.getIterator();rowIter.hasNext();) {
+ Record rowRec = (Record)rowIter.next();
+ clonedRecords.add(rowRec);
+ }
+ } else if (rec instanceof ValueRecordsAggregate) {
+ ValueRecordsAggregate vrAgg = (ValueRecordsAggregate)rec;
+ for (Iterator cellIter = vrAgg.getIterator();cellIter.hasNext();) {
+ Record valRec = (Record)cellIter.next();
+ clonedRecords.add(valRec);
+ }
+ } else if (rec instanceof FormulaRecordAggregate) {
+ FormulaRecordAggregate fmAgg = (FormulaRecordAggregate)rec;
+ Record fmAggRec = fmAgg.getFormulaRecord();
+ if (fmAggRec != null)
+ clonedRecords.add(fmAggRec);
+ fmAggRec = fmAgg.getStringRecord();
+ if (fmAggRec != null)
+ clonedRecords.add(fmAggRec);
+ } else {
+ clonedRecords.add(rec);
+ }
+ }
+ return createSheet(clonedRecords, 0, 0);
+ }
+
+
/**
* read support (offset = 0) Same as createSheet(Record[] recs, int, int)
* only the record offset is assumed to be 0.
return this.sid;
}
+ public Object clone() {
+ AreaFormatRecord rec = new AreaFormatRecord();
+
+ rec.field_1_foregroundColor = field_1_foregroundColor;
+ rec.field_2_backgroundColor = field_2_backgroundColor;
+ rec.field_3_pattern = field_3_pattern;
+ rec.field_4_formatFlags = field_4_formatFlags;
+ rec.field_5_forecolorIndex = field_5_forecolorIndex;
+ rec.field_6_backcolorIndex = field_6_backcolorIndex;
+
+ return rec;
+ }
+
/**
* Get the foreground color field for the AreaFormat record.
return this.sid;
}
+ public Object clone() {
+ AreaRecord rec = new AreaRecord();
+
+ rec.field_1_formatFlags = field_1_formatFlags;
+
+ return rec;
+ }
+
/**
* Get the format flags field for the Area record.
return this.sid;
}
+ public Object clone() {
+ AxisLineFormatRecord rec = new AxisLineFormatRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+
+ return rec;
+ }
+
/**
* Get the axis type field for the AxisLineFormat record.
return this.sid;
}
+ public Object clone() {
+ AxisOptionsRecord rec = new AxisOptionsRecord();
+
+ rec.field_1_minimumCategory = field_1_minimumCategory;
+ rec.field_2_maximumCategory = field_2_maximumCategory;
+ rec.field_3_majorUnitValue = field_3_majorUnitValue;
+ rec.field_4_majorUnit = field_4_majorUnit;
+ rec.field_5_minorUnitValue = field_5_minorUnitValue;
+ rec.field_6_minorUnit = field_6_minorUnit;
+ rec.field_7_baseUnit = field_7_baseUnit;
+ rec.field_8_crossingPoint = field_8_crossingPoint;
+ rec.field_9_options = field_9_options;
+
+ return rec;
+ }
+
/**
* Get the minimum category field for the AxisOptions record.
return this.sid;
}
+ public Object clone() {
+ AxisParentRecord rec = new AxisParentRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+ rec.field_2_x = field_2_x;
+ rec.field_3_y = field_3_y;
+ rec.field_4_width = field_4_width;
+ rec.field_5_height = field_5_height;
+
+ return rec;
+ }
+
/**
* Get the axis type field for the AxisParent record.
return this.sid;
}
+ public Object clone() {
+ AxisRecord rec = new AxisRecord();
+
+ rec.field_1_axisType = field_1_axisType;
+ rec.field_2_reserved1 = field_2_reserved1;
+ rec.field_3_reserved2 = field_3_reserved2;
+ rec.field_4_reserved3 = field_4_reserved3;
+ rec.field_5_reserved4 = field_5_reserved4;
+
+ return rec;
+ }
+
/**
* Get the axis type field for the Axis record.
return this.sid;
}
+ public Object clone() {
+ AxisUsedRecord rec = new AxisUsedRecord();
+
+ rec.field_1_numAxis = field_1_numAxis;
+
+ return rec;
+ }
+
/**
* Get the num axis field for the AxisUsed record.
* Used in sheets and workbooks.<P>
* REFERENCE: PG 289 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ BOFRecord rec = new BOFRecord();
+ rec.field_1_version = field_1_version;
+ rec.field_2_type = field_2_type;
+ rec.field_3_build = field_3_build;
+ rec.field_4_year = field_4_year;
+ rec.field_5_history = field_5_history;
+ rec.field_6_rversion = field_6_rversion;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ BarRecord rec = new BarRecord();
+
+ rec.field_1_barSpace = field_1_barSpace;
+ rec.field_2_categorySpace = field_2_categorySpace;
+ rec.field_3_formatFlags = field_3_formatFlags;
+
+ return rec;
+ }
+
/**
* Get the bar space field for the Bar record.
* Description: Represents a column in a row with no value but with styling.<P>
* REFERENCE: PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
}
return false;
}
+
+ public Object clone() {
+ BlankRecord rec = new BlankRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_col = field_2_col;
+ rec.field_3_xf = field_3_xf;
+ return rec;
+ }
}
* Creates new BoolErrRecord. <P>
* REFERENCE: PG ??? Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Michael P. Harhen
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
}
return false;
}
+
+ public Object clone() {
+ BoolErrRecord rec = new BoolErrRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_column = field_2_column;
+ rec.field_3_xf_index = field_3_xf_index;
+ rec.field_4_bBoolErr = field_4_bBoolErr;
+ rec.field_5_fError = field_5_fError;
+ return rec;
+ }
}
* loop in the event the formulas are not independant. <P>
* REFERENCE: PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.CalcModeRecord
*/
{
return this.sid;
}
+
+ public Object clone() {
+ CalcCountRecord rec = new CalcCountRecord();
+ rec.field_1_iterations = field_1_iterations;
+ return rec;
+ }
}
* except for tables.<P>
* REFERENCE: PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.CalcCountRecord
*/
{
return this.sid;
}
+
+ public Object clone() {
+ CalcModeRecord rec = new CalcModeRecord();
+ rec.field_1_calcmode = field_1_calcmode;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
+
+ rec.field_1_crossingPoint = field_1_crossingPoint;
+ rec.field_2_labelFrequency = field_2_labelFrequency;
+ rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
+ rec.field_4_options = field_4_options;
+
+ return rec;
+ }
+
/**
* Get the crossing point field for the CategorySeriesAxis record.
* them.
*
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*
* @see org.apache.poi.hssf.model.Sheet
* @see org.apache.poi.hssf.record.Record
*/
public boolean isEqual(CellValueRecordInterface i);
+
+ public Object clone();
}
return this.sid;
}
+ public Object clone() {
+ ChartRecord rec = new ChartRecord();
+
+ rec.field_1_x = field_1_x;
+ rec.field_2_y = field_2_y;
+ rec.field_3_width = field_3_width;
+ rec.field_4_height = field_4_height;
+
+ return rec;
+ }
+
/**
* Get the x field for the Chart record.
return this.sid;
}
+ public Object clone() {
+ DatRecord rec = new DatRecord();
+
+ rec.field_1_options = field_1_options;
+
+ return rec;
+ }
+
/**
* Get the options field for the Dat record.
return this.sid;
}
+ public Object clone() {
+ DataFormatRecord rec = new DataFormatRecord();
+
+ rec.field_1_pointNumber = field_1_pointNumber;
+ rec.field_2_seriesIndex = field_2_seriesIndex;
+ rec.field_3_seriesNumber = field_3_seriesNumber;
+ rec.field_4_formatFlags = field_4_formatFlags;
+
+ return rec;
+ }
+
/**
* Get the point number field for the DataFormat record.
* width set.<P>
* REFERENCE: PG 302 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ DefaultColWidthRecord rec = new DefaultColWidthRecord();
+ rec.field_1_col_width = field_1_col_width;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord();
+
+ rec.field_1_categoryDataType = field_1_categoryDataType;
+
+ return rec;
+ }
+
/**
* Get the category data type field for the DefaultDataLabelTextProperties record.
* heights.
* REFERENCE: PG 301 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ DefaultRowHeightRecord rec = new DefaultRowHeightRecord();
+ rec.field_1_option_flags = field_1_option_flags;
+ rec.field_2_row_height = field_2_row_height;
+ return rec;
+ }
}
* Description: controls the accuracy of the calculations<P>
* REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ DeltaRecord rec = new DeltaRecord();
+ rec.field_1_max_change = field_1_max_change;
+ return rec;
+ }
}
* of a sheet.<P>
* REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ DimensionsRecord rec = new DimensionsRecord();
+ rec.field_1_first_row = field_1_first_row;
+ rec.field_2_last_row = field_2_last_row;
+ rec.field_3_first_col = field_3_first_col;
+ rec.field_4_last_col = field_4_last_col;
+ rec.field_5_zero = field_5_zero;
+ return rec;
+ }
}
* HSSF File<P>
* REFERENCE: PG 307 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ EOFRecord rec = new EOFRecord();
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ FontBasisRecord rec = new FontBasisRecord();
+
+ rec.field_1_xBasis = field_1_xBasis;
+ rec.field_2_yBasis = field_2_yBasis;
+ rec.field_3_heightBasis = field_3_heightBasis;
+ rec.field_4_scale = field_4_scale;
+ rec.field_5_indexToFontTable = field_5_indexToFontTable;
+
+ return rec;
+ }
+
/**
* Get the x Basis field for the FontBasis record.
return this.sid;
}
+ public Object clone() {
+ FontIndexRecord rec = new FontIndexRecord();
+
+ rec.field_1_fontIndex = field_1_fontIndex;
+
+ return rec;
+ }
+
/**
* Get the font index field for the FontIndex record.
* REFERENCE: PG 317 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ FooterRecord rec = new FooterRecord();
+ rec.field_1_footer_len = field_1_footer_len;
+ rec.field_2_footer = field_2_footer;
+ return rec;
+ }
}
* Formula Record.
* REFERENCE: PG 317/444 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
return buffer.toString();
}
+ public Object clone() {
+ FormulaRecord rec = new FormulaRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_column = field_2_column;
+ rec.field_3_xf = field_3_xf;
+ rec.field_4_value = field_4_value;
+ rec.field_5_options = field_5_options;
+ rec.field_6_zero = field_6_zero;
+ rec.field_7_expression_len = field_7_expression_len;
+ rec.field_8_parsed_expr = new Stack();
+ int size = 0;
+ if (field_8_parsed_expr != null)
+ size = field_8_parsed_expr.size();
+ for (int i=0; i< size; i++) {
+ Ptg ptg = (Ptg)((Ptg)field_8_parsed_expr.get(i)).clone();
+ rec.field_8_parsed_expr.set(i, ptg);
+ }
+ rec.all_data = all_data;
+ return rec;
+ }
+
}
return this.sid;
}
+ public Object clone() {
+ FrameRecord rec = new FrameRecord();
+
+ rec.field_1_borderType = field_1_borderType;
+ rec.field_2_options = field_2_options;
+
+ return rec;
+ }
+
/**
* Get the border type field for the Frame record.
*
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (glens at apache.org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ GridsetRecord rec = new GridsetRecord();
+ rec.field_1_gridset_flag = field_1_gridset_flag;
+ return rec;
+ }
}
* Description: Row/column gutter sizes <P>
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ GutsRecord rec = new GutsRecord();
+ rec.field_1_left_row_gutter = field_1_left_row_gutter;
+ rec.field_2_top_col_gutter = field_2_top_col_gutter;
+ rec.field_3_row_level_max = field_3_row_level_max;
+ rec.field_4_col_level_max = field_4_col_level_max;
+ return rec;
+ }
}
* Description: whether to center between horizontal margins<P>
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ HCenterRecord rec = new HCenterRecord();
+ rec.field_1_hcenter = field_1_hcenter;
+ return rec;
+ }
}
* REFERENCE: PG 321 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ HeaderRecord rec = new HeaderRecord();
+ rec.field_1_header_len = field_1_header_len;
+ rec.field_2_header = field_2_header;
+ return rec;
+ }
}
* NOT USED IN THIS RELEASE
* REFERENCE: PG 323 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ IndexRecord rec = new IndexRecord();
+ rec.field_1_zero = field_1_zero;
+ rec.field_2_first_row = field_2_first_row;
+ rec.field_3_last_row_add1 = field_3_last_row_add1;
+ rec.field_4_zero = field_4_zero;
+ rec.field_5_dbcells = new IntList();
+ rec.field_5_dbcells.addAll(field_5_dbcells);
+ return rec;
+ }
}
* a formula!)<P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ IterationRecord rec = new IterationRecord();
+ rec.field_1_iteration = field_1_iteration;
+ return rec;
+ }
}
* use this (except to read), use LabelSST instead <P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.LabelSSTRecord
*/
public void setXFIndex(short xf)
{
}
+
+ public Object clone() {
+ LabelRecord rec = new LabelRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_column = field_2_column;
+ rec.field_3_xf_index = field_3_xf_index;
+ rec.field_4_string_len = field_4_string_len;
+ rec.field_5_unicode_flag = field_5_unicode_flag;
+ rec.field_6_value = field_6_value;
+ return rec;
+ }
}
* value. <P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
}
return false;
}
+
+ public Object clone() {
+ LabelSSTRecord rec = new LabelSSTRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_column = field_2_column;
+ rec.field_3_xf_index = field_3_xf_index;
+ rec.field_4_sst_index = field_4_sst_index;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ LegendRecord rec = new LegendRecord();
+
+ rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;
+ rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft;
+ rec.field_3_xSize = field_3_xSize;
+ rec.field_4_ySize = field_4_ySize;
+ rec.field_5_type = field_5_type;
+ rec.field_6_spacing = field_6_spacing;
+ rec.field_7_options = field_7_options;
+
+ return rec;
+ }
+
/**
* Get the x axis upper left field for the Legend record.
return this.sid;
}
+ public Object clone() {
+ LineFormatRecord rec = new LineFormatRecord();
+
+ rec.field_1_lineColor = field_1_lineColor;
+ rec.field_2_linePattern = field_2_linePattern;
+ rec.field_3_weight = field_3_weight;
+ rec.field_4_format = field_4_format;
+ rec.field_5_colourPaletteIndex = field_5_colourPaletteIndex;
+
+ return rec;
+ }
+
/**
* Get the line color field for the LineFormat record.
return this.sid;
}
+ public Object clone() {
+ LinkedDataRecord rec = new LinkedDataRecord();
+
+ rec.field_1_linkType = field_1_linkType;
+ rec.field_2_referenceType = field_2_referenceType;
+ rec.field_3_options = field_3_options;
+ rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord;
+ rec.field_5_formulaOfLink = field_5_formulaOfLink;
+
+ return rec;
+ }
+
/**
* Get the link type field for the LinkedData record.
return this.sid;
}
+ public Object clone() {
+ NumberFormatIndexRecord rec = new NumberFormatIndexRecord();
+
+ rec.field_1_formatIndex = field_1_formatIndex;
+
+ return rec;
+ }
+
/**
* Get the format index field for the NumberFormatIndex record.
* Contains a numeric cell value. <P>
* REFERENCE: PG 334 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
}
return false;
}
+
+ public Object clone() {
+ NumberRecord rec = new NumberRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_col = field_2_col;
+ rec.field_3_xf = field_3_xf;
+ rec.field_4_value = field_4_value;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ ObjectLinkRecord rec = new ObjectLinkRecord();
+
+ rec.field_1_anchorId = field_1_anchorId;
+ rec.field_2_link1 = field_2_link1;
+ rec.field_3_link2 = field_3_link2;
+
+ return rec;
+ }
+
/**
* Get the anchor id field for the ObjectLink record.
return this.sid;
}
+ public Object clone() {
+ PlotAreaRecord rec = new PlotAreaRecord();
+
+
+ return rec;
+ }
+
} // END OF CLASS
return this.sid;
}
+ public Object clone() {
+ PlotGrowthRecord rec = new PlotGrowthRecord();
+
+ rec.field_1_horizontalScale = field_1_horizontalScale;
+ rec.field_2_verticalScale = field_2_verticalScale;
+
+ return rec;
+ }
+
/**
* Get the horizontalScale field for the PlotGrowth record.
* Description: whether to print the gridlines when you enjoy you spreadsheet on paper.<P>
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ PrintGridlinesRecord rec = new PrintGridlinesRecord();
+ rec.field_1_print_gridlines = field_1_print_gridlines;
+ return rec;
+ }
}
* enjoy your spreadsheet in the physical form.<P>
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ PrintHeadersRecord rec = new PrintHeadersRecord();
+ rec.field_1_print_headers = field_1_print_headers;
+ return rec;
+ }
}
* Description: Stores print setup options -- bogus for HSSF (and marked as such)<P>
* REFERENCE: PG 385 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ PrintSetupRecord rec = new PrintSetupRecord();
+ rec.field_1_paper_size = field_1_paper_size;
+ rec.field_2_scale = field_2_scale;
+ rec.field_3_page_start = field_3_page_start;
+ rec.field_4_fit_width = field_4_fit_width;
+ rec.field_5_fit_height = field_5_fit_height;
+ rec.field_6_options = field_6_options;
+ rec.field_7_hresolution = field_7_hresolution;
+ rec.field_8_vresolution = field_8_vresolution;
+ rec.field_9_headermargin = field_9_headermargin;
+ rec.field_10_footermargin = field_10_footermargin;
+ rec.field_11_copies = field_11_copies;
+ return rec;
+ }
}
*
* REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.NumberRecord
*/
public void setXFIndex(short xf)
{
}
+
+ public Object clone() {
+ RKRecord rec = new RKRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_col = field_2_col;
+ rec.field_3_xf_index = field_3_xf_index;
+ rec.field_4_rk_number = field_4_rk_number;
+ return rec;
+ }
}
* Company:
* @author Andrew C. Oliver
* @author Marc Johnson (mjohnson at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
*/
public abstract short getSid();
+
+ public Object clone() {
+ throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
+ }
}
* Description: Describes which reference mode to use<P>
* REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ RefModeRecord rec = new RefModeRecord();
+ rec.field_1_mode = field_1_mode;
+ return rec;
+ }
}
* Description: stores the row information for the sheet. <P>
* REFERENCE: PG 379 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
}
return false;
}
+
+ public Object clone() {
+ RowRecord rec = new RowRecord();
+ rec.field_1_row_number = field_1_row_number;
+ rec.field_2_first_col = field_2_first_col;
+ rec.field_3_last_col = field_3_last_col;
+ rec.field_4_height = field_4_height;
+ rec.field_5_optimize = field_5_optimize;
+ rec.field_6_reserved = field_6_reserved;
+ rec.field_7_option_flags = field_7_option_flags;
+ rec.field_8_xf_index = field_8_xf_index;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ SCLRecord rec = new SCLRecord();
+
+ rec.field_1_numerator = field_1_numerator;
+ rec.field_2_denominator = field_2_denominator;
+
+ return rec;
+ }
+
/**
* Get the numerator field for the SCL record.
* Description: defines whether to recalculate before saving (set to true)<P>
* REFERENCE: PG 381 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ SaveRecalcRecord rec = new SaveRecalcRecord();
+ rec.field_1_recalc = field_1_recalc;
+ return rec;
+ }
}
* TODO : Implement reference subrecords
* REFERENCE: PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ SelectionRecord rec = new SelectionRecord();
+ rec.field_1_pane = field_1_pane;
+ rec.field_2_row_active_cell = field_2_row_active_cell;
+ rec.field_3_col_active_cell = field_3_col_active_cell;
+ rec.field_4_ref_active_cell = field_4_ref_active_cell;
+ rec.field_5_num_refs = field_5_num_refs;
+ rec.field_6_refs = field_6_refs;
+ return rec;
+ }
}
return this.sid;
}
+ public Object clone() {
+ SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord();
+
+ rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
+
+ return rec;
+ }
+
/**
* Get the chart group index field for the SeriesChartGroupIndex record.
return this.sid;
}
+ public Object clone() {
+ SeriesIndexRecord rec = new SeriesIndexRecord();
+
+ rec.field_1_index = field_1_index;
+
+ return rec;
+ }
+
/**
* Get the index field for the SeriesIndex record.
return this.sid;
}
+ public Object clone() {
+ SeriesLabelsRecord rec = new SeriesLabelsRecord();
+
+ rec.field_1_formatFlags = field_1_formatFlags;
+
+ return rec;
+ }
+
/**
* Get the format flags field for the SeriesLabels record.
return this.sid;
}
+ public Object clone() {
+ SeriesListRecord rec = new SeriesListRecord();
+
+ rec.field_1_seriesNumbers = field_1_seriesNumbers;
+
+ return rec;
+ }
+
/**
* Get the series numbers field for the SeriesList record.
return this.sid;
}
+ public Object clone() {
+ SeriesRecord rec = new SeriesRecord();
+
+ rec.field_1_categoryDataType = field_1_categoryDataType;
+ rec.field_2_valuesDataType = field_2_valuesDataType;
+ rec.field_3_numCategories = field_3_numCategories;
+ rec.field_4_numValues = field_4_numValues;
+ rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
+ rec.field_6_numBubbleValues = field_6_numBubbleValues;
+
+ return rec;
+ }
+
/**
* Get the category data type field for the Series record.
return this.sid;
}
+ public Object clone() {
+ SeriesTextRecord rec = new SeriesTextRecord();
+
+ rec.field_1_id = field_1_id;
+ rec.field_2_textLength = field_2_textLength;
+ rec.field_3_undocumented = field_3_undocumented;
+ rec.field_4_text = field_4_text;
+
+ return rec;
+ }
+
/**
* Get the id field for the SeriesText record.
return this.sid;
}
+ public Object clone() {
+ SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
+
+ rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
+
+ return rec;
+ }
+
/**
* Get the chart group index field for the SeriesToChartGroup record.
return this.sid;
}
+ public Object clone() {
+ SheetPropertiesRecord rec = new SheetPropertiesRecord();
+
+ rec.field_1_flags = field_1_flags;
+ rec.field_2_empty = field_2_empty;
+
+ return rec;
+ }
+
/**
* Get the flags field for the SheetProperties record.
return this.sid;
}
+ public Object clone() {
+ TextRecord rec = new TextRecord();
+
+ rec.field_1_horizontalAlignment = field_1_horizontalAlignment;
+ rec.field_2_verticalAlignment = field_2_verticalAlignment;
+ rec.field_3_displayMode = field_3_displayMode;
+ rec.field_4_rgbColor = field_4_rgbColor;
+ rec.field_5_x = field_5_x;
+ rec.field_6_y = field_6_y;
+ rec.field_7_width = field_7_width;
+ rec.field_8_height = field_8_height;
+ rec.field_9_options1 = field_9_options1;
+ rec.field_10_indexOfColorValue = field_10_indexOfColorValue;
+ rec.field_11_options2 = field_11_options2;
+ rec.field_12_textRotation = field_12_textRotation;
+
+ return rec;
+ }
+
/**
* Get the horizontal alignment field for the Text record.
return this.sid;
}
+ public Object clone() {
+ TickRecord rec = new TickRecord();
+
+ rec.field_1_majorTickType = field_1_majorTickType;
+ rec.field_2_minorTickType = field_2_minorTickType;
+ rec.field_3_labelPosition = field_3_labelPosition;
+ rec.field_4_background = field_4_background;
+ rec.field_5_labelColorRgb = field_5_labelColorRgb;
+ rec.field_6_zero1 = field_6_zero1;
+ rec.field_7_zero2 = field_7_zero2;
+ rec.field_8_options = field_8_options;
+ rec.field_9_tickColor = field_9_tickColor;
+ rec.field_10_zero3 = field_10_zero3;
+
+ return rec;
+ }
+
/**
* Get the major tick type field for the Tick record.
return this.sid;
}
+ public Object clone() {
+ UnitsRecord rec = new UnitsRecord();
+
+ rec.field_1_units = field_1_units;
+
+ return rec;
+ }
+
/**
* Get the units field for the Units record.
* don't know all the records to. (HSSF leaves these alone!) <P>
* Company: SuperLink Software, Inc.<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
throw new RecordFormatException(
"Unknown record cannot be constructed via offset -- we need a copy of the data");
}
+
+ /** Unlike the other Record.clone methods this is a shallow clone*/
+ public Object clone() {
+ UnknownRecord rec = new UnknownRecord();
+ rec.offset = offset;
+ rec.sid = sid;
+ rec.size = size;
+ rec.thedata = thedata;
+ return rec;
+ }
}
* Description: tells whether to center the sheet between vertical margins<P>
* REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ VCenterRecord rec = new VCenterRecord();
+ rec.field_1_vcenter = field_1_vcenter;
+ return rec;
+ }
}
* REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (gstamp@iprimus.com.au)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ WSBoolRecord rec = new WSBoolRecord();
+ rec.field_1_wsbool = field_1_wsbool;
+ rec.field_2_wsbool = field_2_wsbool;
+ return rec;
+ }
}
* Description: sheet window settings<P>
* REFERENCE: PG 422 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
{
return this.sid;
}
+
+ public Object clone() {
+ WindowTwoRecord rec = new WindowTwoRecord();
+ rec.field_1_options = field_1_options;
+ rec.field_2_top_row = field_2_top_row;
+ rec.field_3_left_col = field_3_left_col;
+ rec.field_4_header_color = field_4_header_color;
+ rec.field_5_page_break_zoom = field_5_page_break_zoom;
+ rec.field_6_normal_zoom = field_6_normal_zoom;
+ rec.field_7_reserved = field_7_reserved;
+ return rec;
+ }
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class RowRecordsAggregate
return records.values().iterator();
}
+ /** Performs a deep clone of the record*/
+ public Object clone() {
+ RowRecordsAggregate rec = new RowRecordsAggregate();
+ for (Iterator rowIter = getIterator(); rowIter.hasNext();) {
+ //return the cloned Row Record & insert
+ RowRecord row = (RowRecord)((RowRecord)rowIter.next()).clone();
+ rec.insertRow(row);
+ }
+ return rec;
+ }
+
}
*
* @author andy
* @author Glen Stampoultzis (glens at apache.org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class ValueRecordsAggregate
{
return records.values().iterator();
}
+
+ /** Performs a deep clone of the record*/
+ public Object clone() {
+ ValueRecordsAggregate rec = new ValueRecordsAggregate();
+ for (Iterator valIter = getIterator(); valIter.hasNext();) {
+ CellValueRecordInterface val = (CellValueRecordInterface)((CellValueRecordInterface)valIter.next()).clone();
+ rec.insertCell(val);
+ }
+ return rec;
+ }
}
/*
* Addition operator PTG the "+" binomial operator. If you need more
* explanation than that then well...We really can't help you here.
* @author Andrew C. Oliver (acoliver@apache.org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class AddPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+ public Object clone() {
+ return new AddPtg();
+ }
+
}
* REFERENCE: <P>
* @author Libin Roman (Vista Portal LDT. Developer)
* @author avik
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 1.0-pre
*/
return Ptg.CLASS_REF;
}
+ public Object clone() {
+ Area3DPtg ptg = new Area3DPtg();
+ ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
+ ptg.field_2_first_row = field_2_first_row;
+ ptg.field_3_last_row = field_3_last_row;
+ ptg.field_4_first_column = field_4_first_column;
+ ptg.field_5_last_column = field_5_last_column;
+ return ptg;
+ }
+
}
/**
* Specifies a rectangular area of cells A1:A4 for instance.
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class AreaPtg
private BitField colRelative = new BitField(0x4000);
private BitField column = new BitField(0x3FFF);
-
+ private AreaPtg() {
+ //Required for clone methods
+ }
public AreaPtg(String arearef) {
AreaReference ar = new AreaReference(arearef);
return Ptg.CLASS_REF;
}
+ public Object clone() {
+ AreaPtg ptg = new AreaPtg();
+ ptg.field_1_first_row = field_1_first_row;
+ ptg.field_2_last_row = field_2_last_row;
+ ptg.field_3_first_column = field_3_first_column;
+ ptg.field_4_last_column = field_4_last_column;
+ return ptg;
+ }
+
}
* This seems to be a Misc Stuff and Junk record. One function it serves is
* in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class AttrPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+
+ public Object clone() {
+ AttrPtg ptg = new AttrPtg();
+ ptg.field_1_options = field_1_options;
+ ptg.field_2_data = field_2_data;
+ return ptg;
+ }
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class ConcatPtg
return buffer.toString();
}
+ public Object clone() {
+ return new ConcatPtg();
+ }
+
}
/**
* This PTG implements the standard binomial divide "/"
* @author Andrew C. Oliver acoliver at apache dot org
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class DividePtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
+
+ public Object clone() {
+ DividePtg ptg = new DividePtg();
+ return ptg;
+ }
}
return buffer.toString();
}
+ public Object clone() {
+ return new EqualPtg();
+ }
+
+
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class ExpPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+ public Object clone() {
+ throw new RuntimeException("NO IDEA SHARED FORMULA EXP PTG");
+ }
+
}
package org.apache.poi.hssf.record.formula;
import org.apache.poi.util.LittleEndian;
+/**
+ *
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
public class FuncPtg extends AbstractFunctionPtg{
public final static byte sid = 0x21;
private int numParams=0;
+
+ private FuncPtg() {
+ //Required for clone methods
+ }
+
/**Creates new function pointer from a byte array
* usually called while reading an excel file.
*/
public int getNumberOfOperands() {
return numParams;
}
+
+ public Object clone() {
+ FuncPtg ptg = new FuncPtg();
+ ptg.field_1_num_args = field_1_num_args;
+ ptg.field_2_fnc_index = field_2_fnc_index;
+ return ptg;
+ }
}
\ No newline at end of file
package org.apache.poi.hssf.record.formula;
import org.apache.poi.util.LittleEndian;
+
+/**
+ *
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
public class FuncVarPtg extends AbstractFunctionPtg{
public final static byte sid = 0x22;
+ private FuncVarPtg() {
+ //Required for clone methods
+ }
+
/**Creates new function pointer from a byte array
* usually called while reading an excel file.
*/
return field_1_num_args;
}
+ public Object clone() {
+ FuncVarPtg ptg = new FuncVarPtg();
+ ptg.field_1_num_args = field_1_num_args;
+ ptg.field_2_fnc_index = field_2_fnc_index;
+ return ptg;
+ }
+
}
* Integer (short intger)
* Stores a (java) short value in a formula
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class IntPtg
private String val;
private int strlen = 0;
+ private IntPtg() {
+ //Required for clone methods
+ }
+
public IntPtg(byte [] data, int offset)
{
setValue(LittleEndian.getShort(data, offset + 1));
return "" + getValue();
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+
+ public Object clone() {
+ IntPtg ptg = new IntPtg();
+ ptg.field_1_value = field_1_value;
+ return ptg;
+ }
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class MemErrPtg
return "ERR#";
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+
+ public Object clone() {
+ MemErrPtg ptg = new MemErrPtg();
+ ptg.field_1_reserved = field_1_reserved;
+ ptg.field_2_subex_len = field_2_subex_len;
+ return ptg;
+ }
}
* Missing Function Arguments
*
* Avik Sengupta <avik at apache.org>
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class MissingArgPtg
extends Ptg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+ public Object clone() {
+ return new MissingArgPtg();
+ }
+
}
/**
* Implements the standard mathmatical multiplication - *
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class MultiplyPtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
+
+ public Object clone() {
+ return new MultiplyPtg();
+ }
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class NamePtg
private short field_2_label_index;
private short field_3_zero; // reserved must be 0
+
+ private NamePtg() {
+ //Required for clone methods
+ }
+
/** Creates new NamePtg */
public NamePtg(String name)
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+
+ public Object clone() {
+ NamePtg ptg = new NamePtg();
+ ptg.field_1_ixti = field_1_ixti;
+ ptg.field_2_label_index = field_2_label_index;
+ ptg.field_3_zero = field_3_zero;
+ return ptg;
+ }
}
* Stores a floating point value in a formula
* value stored in a 8 byte field using IEEE notation
* @author Avik Sengupta
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class NumberPtg
public final static byte sid = 0x1f;
private double field_1_value;
+ private NumberPtg() {
+ //Required for clone methods
+ }
/** Create a NumberPtg from a byte array read from disk */
public NumberPtg(byte [] data, int offset)
return "" + getValue();
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+
+ public Object clone() {
+ NumberPtg ptg = new NumberPtg();
+ ptg.field_1_value = field_1_value;
+ return ptg;
+ }
}
*
* Avik Sengupta <lists@aviksengupta.com>
* Andrew C. Oliver (acoliver at apache dot org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class ParenthesisPtg
extends OperationPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+ public Object clone() {
+ return new ParenthesisPtg();
+ }
+
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class PowerPtg
return buffer.toString();
}
+ public Object clone() {
+ return new PowerPtg();
+ }
+
}
*
* @author andy
* @author avik
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public abstract class Ptg
public abstract byte getDefaultOperandClass();
+ public abstract Object clone();
+
}
* Description: Defined a cell in extern sheet. <P>
* REFERENCE: <P>
* @author Libin Roman (Vista Portal LDT. Developer)
+ * @author Jason Height (jheight at chariot dot net dot au)
* @version 1.0-pre
*/
public byte getDefaultOperandClass() {return Ptg.CLASS_REF;}
+ public Object clone() {
+ Ref3DPtg ptg = new Ref3DPtg();
+ ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
+ ptg.field_2_row = field_2_row;
+ ptg.field_3_column = field_3_column;
+ return ptg;
+ }
+
}
/**
* ReferencePtg - handles references (such as A1, A2, IA4)
* @author Andrew C. Oliver (acoliver@apache.org)
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class ReferencePtg extends Ptg
private BitField rowRelative = new BitField(0x8000);
private BitField colRelative = new BitField(0x4000);
-
+ private ReferencePtg() {
+ //Required for clone methods
+ }
/**
* Takes in a String represnetation of a cell reference and fills out the
return Ptg.CLASS_REF;
}
+ public Object clone() {
+ ReferencePtg ptg = new ReferencePtg();
+ ptg.field_1_row = field_1_row;
+ ptg.field_2_col = field_2_col;
+ return ptg;
+ }
}
* Number
* Stores a String value in a formula value stored in the format <length 2 bytes>char[]
* @author Werner Froidevaux
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class StringPtg
public final static byte sid = 0x17;
private String field_1_value;
+ private StringPtg() {
+ //Required for clone methods
+ }
/** Create a StringPtg from a byte array read from disk */
public StringPtg(byte [] data, int offset)
return Ptg.CLASS_VALUE;
}
+ public Object clone() {
+ StringPtg ptg = new StringPtg();
+ ptg.field_1_value = field_1_value;
+ return ptg;
+ }
+
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class SubtractPtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
+
+ public Object clone() {
+ return new SubtractPtg();
+ }
}
/**
*
* @author andy
+ * @author Jason Height (jheight at chariot dot net dot au)
*/
public class UnknownPtg
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
+ public Object clone() {
+ return new UnknownPtg();
+ }
+
}
setPropertiesFromSheet(sheet);
}
+ HSSFSheet cloneSheet(Workbook book) {
+ return new HSSFSheet(book, sheet.cloneSheet());
+ }
+
/**
* used internally to set the properties given a Sheet object
return sheet;
}
+ /**
+ * create an HSSFSheet from an existing sheet in the HSSFWorkbook.
+ *
+ * @return HSSFSheet representing the cloned sheet.
+ */
+
+ public HSSFSheet cloneSheet(int sheetNum) {
+ HSSFSheet srcSheet = (HSSFSheet)sheets.get(sheetNum);
+ String srcName = workbook.getSheetName(sheetNum);
+ if (srcSheet != null) {
+ HSSFSheet clonedSheet = srcSheet.cloneSheet(workbook);
+ WindowTwoRecord windowTwo = (WindowTwoRecord) clonedSheet.getSheet().findFirstRecordBySid(WindowTwoRecord.sid);
+ windowTwo.setSelected(sheets.size() == 1);
+ windowTwo.setPaged(sheets.size() == 1);
+
+ sheets.add(clonedSheet);
+ workbook.setSheetName(sheets.size()-1, srcName+"[1]");
+ return clonedSheet;
+ }
+ return null;
+ }
+
/**
* create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
* the high level representation. Use this to create new sheets.
return this.sid;
}
+ public Object clone() {
+ <xsl:value-of select="@name"/>Record rec = new <xsl:value-of select="@name"/>Record();
+
+<xsl:for-each select="//fields/field"><xsl:text> rec.</xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text> = </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text>;
+</xsl:text></xsl:for-each>
+ return rec;
+ }
+
+
+
<xsl:apply-templates select="//field" mode="getset"/>
<xsl:apply-templates select="//field" mode="bits"/>
sheet.removeRow(row);
}
+ public void testCloneSheet() {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet("Test Clone");
+ HSSFRow row = sheet.createRow((short) 0);
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue("clone_test");
+ HSSFSheet cloned = workbook.cloneSheet(0);
+
+ //Check for a good clone
+ assertEquals(cloned.getRow((short)0).getCell((short)0).getStringCellValue(), "clone_test");
+
+ //Check that the cells are not somehow linked
+ cell.setCellValue("Difference Check");
+ assertEquals(cloned.getRow((short)0).getCell((short)0).getStringCellValue(), "clone_test");
+ }
+
}