move cleaned up jxl into this project, get rid of log4j dependency
This commit is contained in:
parent
fe833de27a
commit
0925fc31f5
451 changed files with 80883 additions and 7 deletions
15
datastructures-xslx/NOTICE.txt
Normal file
15
datastructures-xslx/NOTICE.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
datastructures-xslx is composed of the following works
|
||||
|
||||
jxl
|
||||
https://sourceforge.net/projects/jexcelapi/
|
||||
GNU Library or Lesser General Public License version 2.0 (LGPLv2)
|
||||
|
||||
with the log4j dependency removed
|
||||
|
||||
and
|
||||
|
||||
com.incesoft.tools.excel
|
||||
https://code.google.com/archive/p/sjxslx/ -> https://github.com/davidpelfree/sjxlsx
|
||||
License: Apache License 2.0
|
||||
|
||||
The code will be refactored to the org.xbib package group.
|
|
@ -1,3 +0,0 @@
|
|||
dependencies {
|
||||
implementation libs.jxl
|
||||
}
|
45
datastructures-xslx/src/main/java/jxl/BooleanCell.java
Executable file
45
datastructures-xslx/src/main/java/jxl/BooleanCell.java
Executable file
|
@ -0,0 +1,45 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* This type represents the Microsoft concept of a Boolean. Accordingly, this
|
||||
* cell represents either TRUE, FALSE or an error condition. This third
|
||||
* state naturally makes handling BooleanCells quite tricky, and use of
|
||||
* the specific access methods should be handled with care
|
||||
*/
|
||||
public interface BooleanCell extends Cell {
|
||||
/**
|
||||
* Gets the boolean value stored in this cell. If this cell contains an
|
||||
* error, then returns FALSE. Always query this cell type using the
|
||||
* accessor method isError() prior to calling this method
|
||||
*
|
||||
* @return TRUE if this cell contains TRUE, FALSE if it contains FALSE or
|
||||
* an error code
|
||||
*/
|
||||
boolean getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
27
datastructures-xslx/src/main/java/jxl/BooleanFormulaCell.java
Executable file
27
datastructures-xslx/src/main/java/jxl/BooleanFormulaCell.java
Executable file
|
@ -0,0 +1,27 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* A mixin interface for numerical formulas, which combines the interfaces
|
||||
* for formulas and for numbers
|
||||
*/
|
||||
public interface BooleanFormulaCell extends BooleanCell, FormulaCell {
|
||||
}
|
86
datastructures-xslx/src/main/java/jxl/Cell.java
Executable file
86
datastructures-xslx/src/main/java/jxl/Cell.java
Executable file
|
@ -0,0 +1,86 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import jxl.format.CellFormat;
|
||||
|
||||
/**
|
||||
* Represents an individual Cell within a Sheet. May be queried for its
|
||||
* type and its content
|
||||
*/
|
||||
public interface Cell {
|
||||
/**
|
||||
* Returns the row number of this cell
|
||||
*
|
||||
* @return the row number of this cell
|
||||
*/
|
||||
int getRow();
|
||||
|
||||
/**
|
||||
* Returns the column number of this cell
|
||||
*
|
||||
* @return the column number of this cell
|
||||
*/
|
||||
int getColumn();
|
||||
|
||||
/**
|
||||
* Returns the content type of this cell
|
||||
*
|
||||
* @return the content type for this cell
|
||||
*/
|
||||
CellType getType();
|
||||
|
||||
/**
|
||||
* Indicates whether or not this cell is hidden, by virtue of either
|
||||
* the entire row or column being collapsed
|
||||
*
|
||||
* @return TRUE if this cell is hidden, FALSE otherwise
|
||||
*/
|
||||
boolean isHidden();
|
||||
|
||||
/**
|
||||
* Quick and dirty function to return the contents of this cell as a string.
|
||||
* For more complex manipulation of the contents, it is necessary to cast
|
||||
* this interface to correct subinterface
|
||||
*
|
||||
* @return the contents of this cell as a string
|
||||
*/
|
||||
String getContents();
|
||||
|
||||
/**
|
||||
* Gets the cell format which applies to this cell
|
||||
* Note that for cell with a cell type of EMPTY, which has no formatting
|
||||
* information, this method will return null. Some empty cells (eg. on
|
||||
* template spreadsheets) may have a cell type of EMPTY, but will
|
||||
* actually contain formatting information
|
||||
*
|
||||
* @return the cell format applied to this cell, or NULL if this is an
|
||||
* empty cell
|
||||
*/
|
||||
CellFormat getCellFormat();
|
||||
|
||||
/**
|
||||
* Gets any special cell features, such as comments (notes) or cell
|
||||
* validation present for this cell
|
||||
*
|
||||
* @return the cell features, or NULL if this cell has no special features
|
||||
*/
|
||||
CellFeatures getCellFeatures();
|
||||
}
|
74
datastructures-xslx/src/main/java/jxl/CellFeatures.java
Executable file
74
datastructures-xslx/src/main/java/jxl/CellFeatures.java
Executable file
|
@ -0,0 +1,74 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2004 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import jxl.biff.BaseCellFeatures;
|
||||
|
||||
/**
|
||||
* Container for any additional cell features
|
||||
*/
|
||||
public class CellFeatures extends BaseCellFeatures {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public CellFeatures() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*
|
||||
* @param cf cell to copy
|
||||
*/
|
||||
protected CellFeatures(CellFeatures cf) {
|
||||
super(cf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the cell comment
|
||||
*
|
||||
* @return the cell comment, or NULL if this cell doesn't have
|
||||
* a comment associated with it
|
||||
*/
|
||||
public String getComment() {
|
||||
return super.getComment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data validation list
|
||||
*
|
||||
* @return the data validation list
|
||||
*/
|
||||
public String getDataValidationList() {
|
||||
return super.getDataValidationList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the range of cells to which the data validation applies. If the
|
||||
* validation applies to just this cell, this will be reflected in the
|
||||
* returned range
|
||||
*
|
||||
* @return the range to which the same validation extends, or NULL if this
|
||||
* cell doesn't have a validation
|
||||
*/
|
||||
public Range getSharedDataValidationRange() {
|
||||
return super.getSharedDataValidationRange();
|
||||
}
|
||||
}
|
28
datastructures-xslx/src/main/java/jxl/CellFormat.java
Executable file
28
datastructures-xslx/src/main/java/jxl/CellFormat.java
Executable file
|
@ -0,0 +1,28 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* Interface for cell formats - used for typing information
|
||||
*
|
||||
* @deprecated Repackaged as jxl.format.CellFormat
|
||||
*/
|
||||
public interface CellFormat extends jxl.format.CellFormat {
|
||||
}
|
254
datastructures-xslx/src/main/java/jxl/CellReferenceHelper.java
Executable file
254
datastructures-xslx/src/main/java/jxl/CellReferenceHelper.java
Executable file
|
@ -0,0 +1,254 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2003 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import jxl.write.WritableWorkbook;
|
||||
|
||||
/**
|
||||
* Exposes some cell reference helper methods to the public interface.
|
||||
* This class merely delegates to the internally used reference helper
|
||||
*/
|
||||
public final class CellReferenceHelper {
|
||||
/**
|
||||
* Hide the default constructor
|
||||
*/
|
||||
private CellReferenceHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the cell reference for the column and row passed in to the string
|
||||
* buffer
|
||||
*
|
||||
* @param column the column
|
||||
* @param row the row
|
||||
* @param buf the string buffer to append
|
||||
*/
|
||||
public static void getCellReference(int column, int row, StringBuffer buf) {
|
||||
jxl.biff.CellReferenceHelper.getCellReference(column, row, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded method which prepends $ for absolute reference
|
||||
*
|
||||
* @param column the column number
|
||||
* @param colabs TRUE if the column reference is absolute
|
||||
* @param row the row number
|
||||
* @param rowabs TRUE if the row reference is absolute
|
||||
* @param buf the string buffer
|
||||
*/
|
||||
public static void getCellReference(int column,
|
||||
boolean colabs,
|
||||
int row,
|
||||
boolean rowabs,
|
||||
StringBuffer buf) {
|
||||
jxl.biff.CellReferenceHelper.getCellReference(column, colabs,
|
||||
row, rowabs,
|
||||
buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the cell reference for the specified column and row
|
||||
*
|
||||
* @param column the column
|
||||
* @param row the row
|
||||
* @return the cell reference
|
||||
*/
|
||||
public static String getCellReference(int column, int row) {
|
||||
return jxl.biff.CellReferenceHelper.getCellReference(column, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the columnn number of the string cell reference
|
||||
*
|
||||
* @param s the string to parse
|
||||
* @return the column portion of the cell reference
|
||||
*/
|
||||
public static int getColumn(String s) {
|
||||
return jxl.biff.CellReferenceHelper.getColumn(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the column letter corresponding to the 0-based column number
|
||||
*
|
||||
* @param c the column number
|
||||
* @return the letter for that column number
|
||||
*/
|
||||
public static String getColumnReference(int c) {
|
||||
return jxl.biff.CellReferenceHelper.getColumnReference(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the row number of the cell reference
|
||||
*
|
||||
* @param s the cell reference
|
||||
* @return the row number
|
||||
*/
|
||||
public static int getRow(String s) {
|
||||
return jxl.biff.CellReferenceHelper.getRow(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sees if the column component is relative or not
|
||||
*
|
||||
* @param s the cell
|
||||
* @return TRUE if the column is relative, FALSE otherwise
|
||||
*/
|
||||
public static boolean isColumnRelative(String s) {
|
||||
return jxl.biff.CellReferenceHelper.isColumnRelative(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sees if the row component is relative or not
|
||||
*
|
||||
* @param s the cell
|
||||
* @return TRUE if the row is relative, FALSE otherwise
|
||||
*/
|
||||
public static boolean isRowRelative(String s) {
|
||||
return jxl.biff.CellReferenceHelper.isRowRelative(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified cell reference given the column, row
|
||||
* external sheet reference etc
|
||||
*
|
||||
* @param sheet the sheet index
|
||||
* @param column the column index
|
||||
* @param row the row index
|
||||
* @param workbook the workbook
|
||||
* @param buf a string buffer
|
||||
*/
|
||||
public static void getCellReference
|
||||
(int sheet, int column, int row,
|
||||
Workbook workbook, StringBuffer buf) {
|
||||
jxl.biff.CellReferenceHelper.getCellReference
|
||||
(sheet, column, row, (jxl.biff.formula.ExternalSheet) workbook, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified cell reference given the column, row
|
||||
* external sheet reference etc
|
||||
*
|
||||
* @param sheet the sheet
|
||||
* @param column the column
|
||||
* @param row the row
|
||||
* @param workbook the workbook
|
||||
* @param buf the buffer
|
||||
*/
|
||||
public static void getCellReference(int sheet,
|
||||
int column,
|
||||
int row,
|
||||
WritableWorkbook workbook,
|
||||
StringBuffer buf) {
|
||||
jxl.biff.CellReferenceHelper.getCellReference
|
||||
(sheet, column, row, (jxl.biff.formula.ExternalSheet) workbook, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified cell reference given the column, row
|
||||
* external sheet reference etc
|
||||
*
|
||||
* @param sheet the sheet
|
||||
* @param column the column
|
||||
* @param colabs TRUE if the column is an absolute reference
|
||||
* @param row the row
|
||||
* @param rowabs TRUE if the row is an absolute reference
|
||||
* @param workbook the workbook
|
||||
* @param buf the string buffer
|
||||
*/
|
||||
public static void getCellReference(int sheet,
|
||||
int column,
|
||||
boolean colabs,
|
||||
int row,
|
||||
boolean rowabs,
|
||||
Workbook workbook,
|
||||
StringBuffer buf) {
|
||||
jxl.biff.CellReferenceHelper.getCellReference
|
||||
(sheet, column, colabs, row, rowabs,
|
||||
(jxl.biff.formula.ExternalSheet) workbook, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified cell reference given the column, row
|
||||
* external sheet reference etc
|
||||
*
|
||||
* @param sheet the sheet
|
||||
* @param column the column
|
||||
* @param row the row
|
||||
* @param workbook the workbook
|
||||
* @return the cell reference in the form 'Sheet 1'!A1
|
||||
*/
|
||||
public static String getCellReference(int sheet,
|
||||
int column,
|
||||
int row,
|
||||
Workbook workbook) {
|
||||
return jxl.biff.CellReferenceHelper.getCellReference
|
||||
(sheet, column, row, (jxl.biff.formula.ExternalSheet) workbook);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fully qualified cell reference given the column, row
|
||||
* external sheet reference etc
|
||||
*
|
||||
* @param sheet the sheet
|
||||
* @param column the column
|
||||
* @param row the row
|
||||
* @param workbook the workbook
|
||||
* @return the cell reference in the form 'Sheet 1'!A1
|
||||
*/
|
||||
public static String getCellReference(int sheet,
|
||||
int column,
|
||||
int row,
|
||||
WritableWorkbook workbook) {
|
||||
return jxl.biff.CellReferenceHelper.getCellReference
|
||||
(sheet, column, row, (jxl.biff.formula.ExternalSheet) workbook);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the sheet name from the cell reference string
|
||||
*
|
||||
* @param ref the cell reference
|
||||
* @return the sheet name
|
||||
*/
|
||||
public static String getSheet(String ref) {
|
||||
return jxl.biff.CellReferenceHelper.getSheet(ref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cell reference for the cell
|
||||
*
|
||||
* @param the cell
|
||||
*/
|
||||
public static String getCellReference(Cell c) {
|
||||
return getCellReference(c.getColumn(), c.getRow());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cell reference for the cell
|
||||
*
|
||||
* @param c the cell
|
||||
* @param sb string buffer
|
||||
*/
|
||||
public static void getCellReference(Cell c, StringBuffer sb) {
|
||||
getCellReference(c.getColumn(), c.getRow(), sb);
|
||||
}
|
||||
|
||||
}
|
97
datastructures-xslx/src/main/java/jxl/CellType.java
Executable file
97
datastructures-xslx/src/main/java/jxl/CellType.java
Executable file
|
@ -0,0 +1,97 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* An enumeration type listing the available content types for a cell
|
||||
*/
|
||||
public final class CellType {
|
||||
|
||||
/**
|
||||
* An empty cell can still contain formatting information and comments
|
||||
*/
|
||||
public static final CellType EMPTY = new CellType("Empty");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType LABEL = new CellType("Label");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType NUMBER = new CellType("Number");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType BOOLEAN = new CellType("Boolean");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType ERROR = new CellType("Error");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType NUMBER_FORMULA =
|
||||
new CellType("Numerical Formula");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType DATE_FORMULA = new CellType("Date Formula");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType STRING_FORMULA = new CellType("String Formula");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType BOOLEAN_FORMULA =
|
||||
new CellType("Boolean Formula");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType FORMULA_ERROR = new CellType("Formula Error");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final CellType DATE = new CellType("Date");
|
||||
/**
|
||||
* The text description of this cell type
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* Private constructor
|
||||
*
|
||||
* @param desc the description of this type
|
||||
*/
|
||||
private CellType(String desc) {
|
||||
description = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string description of this cell
|
||||
*
|
||||
* @return the string description for this type
|
||||
*/
|
||||
public String toString() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
196
datastructures-xslx/src/main/java/jxl/CellView.java
Executable file
196
datastructures-xslx/src/main/java/jxl/CellView.java
Executable file
|
@ -0,0 +1,196 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import jxl.format.CellFormat;
|
||||
|
||||
/**
|
||||
* This is a bean which client applications may use to get/set various
|
||||
* properties for a row or column on a spreadsheet
|
||||
*/
|
||||
public final class CellView {
|
||||
/**
|
||||
* The dimension for the associated group of cells. For columns this
|
||||
* will be width in characters, for rows this will be the
|
||||
* height in points
|
||||
* This attribute is deprecated in favour of the size attribute
|
||||
*/
|
||||
private int dimension;
|
||||
|
||||
/**
|
||||
* The size for the associated group of cells. For columns this
|
||||
* will be width in characters multiplied by 256, for rows this will be the
|
||||
* height in points
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* Indicates whether the deprecated function was used to set the dimension
|
||||
*/
|
||||
private boolean depUsed;
|
||||
|
||||
/**
|
||||
* Indicates whether or not this sheet is hidden
|
||||
*/
|
||||
private boolean hidden;
|
||||
|
||||
/**
|
||||
* The cell format for the row/column
|
||||
*/
|
||||
private CellFormat format;
|
||||
|
||||
/**
|
||||
* Indicates that this column/row should be autosized
|
||||
*/
|
||||
private boolean autosize;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public CellView() {
|
||||
hidden = false;
|
||||
depUsed = false;
|
||||
dimension = 1;
|
||||
size = 1;
|
||||
autosize = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public CellView(CellView cv) {
|
||||
hidden = cv.hidden;
|
||||
depUsed = cv.depUsed;
|
||||
dimension = cv.dimension;
|
||||
size = cv.size;
|
||||
autosize = cv.autosize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the hidden nature of this row/column
|
||||
*
|
||||
* @return TRUE if this row/column is hidden, FALSE otherwise
|
||||
*/
|
||||
public boolean isHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hidden status of this row/column
|
||||
*
|
||||
* @param h the hidden flag
|
||||
*/
|
||||
public void setHidden(boolean h) {
|
||||
hidden = h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width of the column in characters or the height of the
|
||||
* row in 1/20ths
|
||||
*
|
||||
* @return the dimension
|
||||
* @deprecated use getSize() instead
|
||||
*/
|
||||
public int getDimension() {
|
||||
return dimension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dimension for this view
|
||||
*
|
||||
* @param d the width of the column in characters, or the height of the
|
||||
* row in 1/20ths of a point
|
||||
* @deprecated use the setSize method instead
|
||||
*/
|
||||
public void setDimension(int d) {
|
||||
dimension = d;
|
||||
depUsed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width of the column in characters multiplied by 256, or the
|
||||
* height of the row in 1/20ths of a point
|
||||
*
|
||||
* @return the dimension
|
||||
*/
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dimension for this view
|
||||
*
|
||||
* @param d the width of the column in characters multiplied by 256,
|
||||
* or the height of the row in 1/20ths of a point
|
||||
*/
|
||||
public void setSize(int d) {
|
||||
size = d;
|
||||
depUsed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the cell format for this group.
|
||||
*
|
||||
* @return the format for the column/row, or NULL if no format was
|
||||
* specified
|
||||
*/
|
||||
public CellFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cell format for this group of cells
|
||||
*
|
||||
* @param cf the format for every cell in the column/row
|
||||
*/
|
||||
public void setFormat(CellFormat cf) {
|
||||
format = cf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the depUsed attribute
|
||||
*
|
||||
* @return TRUE if the deprecated methods were used to set the size,
|
||||
* FALSE otherwise
|
||||
*/
|
||||
public boolean depUsed() {
|
||||
return depUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the autosize flag
|
||||
* NOTE: use of the autosize function is very processor intensive, so
|
||||
* use with care
|
||||
*
|
||||
* @return TRUE if this row/column is to be autosized
|
||||
*/
|
||||
public boolean isAutosize() {
|
||||
return autosize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the autosize flag. Currently, this only works for column views
|
||||
*
|
||||
* @param a autosize
|
||||
*/
|
||||
public void setAutosize(boolean a) {
|
||||
autosize = a;
|
||||
}
|
||||
}
|
53
datastructures-xslx/src/main/java/jxl/DateCell.java
Executable file
53
datastructures-xslx/src/main/java/jxl/DateCell.java
Executable file
|
@ -0,0 +1,53 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* A date cell
|
||||
*/
|
||||
public interface DateCell extends Cell {
|
||||
/**
|
||||
* Gets the date contained in this cell
|
||||
*
|
||||
* @return the cell contents
|
||||
*/
|
||||
Date getDate();
|
||||
|
||||
/**
|
||||
* Indicates whether the date value contained in this cell refers to a date,
|
||||
* or merely a time
|
||||
*
|
||||
* @return TRUE if the value refers to a time
|
||||
*/
|
||||
boolean isTime();
|
||||
|
||||
/**
|
||||
* Gets the DateFormat used to format the cell. This will normally be
|
||||
* the format specified in the excel spreadsheet, but in the event of any
|
||||
* difficulty parsing this, it will revert to the default date/time format.
|
||||
*
|
||||
* @return the DateFormat object used to format the date in the original
|
||||
* excel cell
|
||||
*/
|
||||
DateFormat getDateFormat();
|
||||
}
|
27
datastructures-xslx/src/main/java/jxl/DateFormulaCell.java
Executable file
27
datastructures-xslx/src/main/java/jxl/DateFormulaCell.java
Executable file
|
@ -0,0 +1,27 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2003 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* A mixin interface for date formulas, which combines the interfaces
|
||||
* for formulas and for dates
|
||||
*/
|
||||
public interface DateFormulaCell extends DateCell, FormulaCell {
|
||||
}
|
36
datastructures-xslx/src/main/java/jxl/ErrorCell.java
Executable file
36
datastructures-xslx/src/main/java/jxl/ErrorCell.java
Executable file
|
@ -0,0 +1,36 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* This type represents a cell which contains an error. This error will
|
||||
* usually, but not always be the result of some error resulting from
|
||||
* a formula
|
||||
*/
|
||||
public interface ErrorCell extends Cell {
|
||||
/**
|
||||
* Gets the error code for this cell. If this cell does not represent
|
||||
* an error, then it returns 0. Always use the method isError() to
|
||||
* determine this prior to calling this method
|
||||
*
|
||||
* @return the error code if this cell contains an error, 0 otherwise
|
||||
*/
|
||||
int getErrorCode();
|
||||
}
|
27
datastructures-xslx/src/main/java/jxl/ErrorFormulaCell.java
Executable file
27
datastructures-xslx/src/main/java/jxl/ErrorFormulaCell.java
Executable file
|
@ -0,0 +1,27 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* A mixin interface for numerical formulas, which combines the interfaces
|
||||
* for formulas and for numbers
|
||||
*/
|
||||
public interface ErrorFormulaCell extends ErrorCell, FormulaCell {
|
||||
}
|
35
datastructures-xslx/src/main/java/jxl/FormulaCell.java
Executable file
35
datastructures-xslx/src/main/java/jxl/FormulaCell.java
Executable file
|
@ -0,0 +1,35 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
import jxl.biff.formula.FormulaException;
|
||||
|
||||
/**
|
||||
* Interface for formulas which allow clients to read the Excel formula
|
||||
*/
|
||||
public interface FormulaCell extends Cell {
|
||||
/**
|
||||
* Gets the formula as a string
|
||||
*
|
||||
* @return the formula as a string
|
||||
* @throws FormulaException if an error occurred whilst parsing
|
||||
*/
|
||||
String getFormula() throws FormulaException;
|
||||
}
|
344
datastructures-xslx/src/main/java/jxl/HeaderFooter.java
Executable file
344
datastructures-xslx/src/main/java/jxl/HeaderFooter.java
Executable file
|
@ -0,0 +1,344 @@
|
|||
/*********************************************************************
|
||||
*
|
||||
* Copyright (C) 2002 Andrew Khan, Eric Jung
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
package jxl;
|
||||
|
||||
/**
|
||||
* Class which represents an Excel header or footer.
|
||||
*/
|
||||
public final class HeaderFooter extends jxl.biff.HeaderFooter {
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public HeaderFooter() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*
|
||||
* @param hf the item to copy
|
||||
*/
|
||||
public HeaderFooter(HeaderFooter hf) {
|
||||
super(hf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used when reading workbooks to separate the left, right
|
||||
* a central part of the strings into their constituent parts
|
||||
*
|
||||
* @param s the header string
|
||||
*/
|
||||
public HeaderFooter(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a <code>String</code>ified
|
||||
* version of this object
|
||||
*
|
||||
* @return the header string
|
||||
*/
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the contents which appear on the right hand side of the page
|
||||
*
|
||||
* @return the right aligned contents
|
||||
*/
|
||||
public Contents getRight() {
|
||||
return (Contents) super.getRightText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the contents which in the centre of the page
|
||||
*
|
||||
* @return the centrally aligned contents
|
||||
*/
|
||||
public Contents getCentre() {
|
||||
return (Contents) super.getCentreText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the contents which appear on the left hand side of the page
|
||||
*
|
||||
* @return the left aligned contents
|
||||
*/
|
||||
public Contents getLeft() {
|
||||
return (Contents) super.getLeftText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the contents of the header/footer
|
||||
*/
|
||||
public void clear() {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates internal class of the appropriate type
|
||||
*
|
||||
* @return the created contents
|
||||
*/
|
||||
protected jxl.biff.HeaderFooter.Contents createContents() {
|
||||
return new Contents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates internal class of the appropriate type
|
||||
*
|
||||
* @param s the string to create the contents
|
||||
* @return the created contents
|
||||
*/
|
||||
protected jxl.biff.HeaderFooter.Contents createContents(String s) {
|
||||
return new Contents(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates internal class of the appropriate type
|
||||
*
|
||||
* @param c the contents to copy
|
||||
* @return the new contents
|
||||
*/
|
||||
protected jxl.biff.HeaderFooter.Contents
|
||||
createContents(jxl.biff.HeaderFooter.Contents c) {
|
||||
return new Contents((Contents) c);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contents - a simple wrapper around a string buffer
|
||||
*/
|
||||
public static class Contents extends jxl.biff.HeaderFooter.Contents {
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
Contents() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used when reading worksheets. The string contains all
|
||||
* the formatting (but not alignment characters
|
||||
*
|
||||
* @param s the format string
|
||||
*/
|
||||
Contents(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*
|
||||
* @param copy the contents to copy
|
||||
*/
|
||||
Contents(Contents copy) {
|
||||
super(copy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the text to the string buffer
|
||||
*
|
||||
* @param txt the text to append
|
||||
*/
|
||||
public void append(String txt) {
|
||||
super.append(txt);
|
||||
}
|
||||