crazy test
This commit is contained in:
parent
c850d4af6a
commit
ba73368cea
@ -109,7 +109,7 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
|
||||
throw new RuntimeException("Shared Formula Conversion: Coding Error");
|
||||
}
|
||||
|
||||
SharedFormula sf = new SharedFormula(SpreadsheetVersion.EXCEL97);
|
||||
SharedFormula sf = new SharedFormula(org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion);
|
||||
return sf.convertSharedFormulas(field_7_parsed_expr.getTokens(), formulaRow, formulaColumn);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public final class RowRecordsAggregate extends RecordAggregate {
|
||||
}
|
||||
|
||||
public RowRecord getRow(int rowIndex) {
|
||||
int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxrow = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
if (rowIndex < 0 || rowIndex > maxrow) {
|
||||
throw new IllegalArgumentException("The row number must be between 0 and " + maxrow + ", but had: " + rowIndex);
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ public class HSSFCell implements Cell {
|
||||
/**
|
||||
* The maximum number of columns in BIFF8
|
||||
*/
|
||||
public static final int LAST_COLUMN_NUMBER = SpreadsheetVersion.EXCEL97.getLastColumnIndex(); // 2^8 - 1
|
||||
private static final String LAST_COLUMN_NAME = SpreadsheetVersion.EXCEL97.getLastColumnName();
|
||||
public static final int LAST_COLUMN_NUMBER = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex(); // 2^8 - 1
|
||||
private static final String LAST_COLUMN_NAME = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnName();
|
||||
|
||||
public final static short ENCODING_UNCHANGED = -1;
|
||||
public final static short ENCODING_COMPRESSED_UNICODE = 0;
|
||||
@ -570,7 +570,7 @@ public class HSSFCell implements Cell {
|
||||
return;
|
||||
}
|
||||
|
||||
if(value.length() > SpreadsheetVersion.EXCEL97.getMaxTextLength()){
|
||||
if(value.length() > org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getMaxTextLength()){
|
||||
throw new IllegalArgumentException("The maximum length of cell contents (text) is 32,767 characters");
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ import org.apache.poi.util.Removal;
|
||||
*/
|
||||
public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||
|
||||
public static final int MAX_COL = SpreadsheetVersion.EXCEL97.getLastColumnIndex();
|
||||
public static final int MAX_ROW = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
public static final int MAX_COL = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex();
|
||||
public static final int MAX_ROW = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
|
||||
private EscherClientAnchorRecord _escherClientAnchor;
|
||||
|
||||
|
@ -296,7 +296,7 @@ public final class HSSFEvaluationWorkbook implements FormulaRenderingWorkbook, E
|
||||
|
||||
@Override
|
||||
public SpreadsheetVersion getSpreadsheetVersion(){
|
||||
return SpreadsheetVersion.EXCEL97;
|
||||
return org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +212,7 @@ public final class HSSFName implements Name {
|
||||
if (name.matches("[A-Za-z]+\\d+")) {
|
||||
String col = name.replaceAll("\\d", "");
|
||||
String row = name.replaceAll("[A-Za-z]", "");
|
||||
if (CellReference.cellReferenceIsWithinRange(col, row, SpreadsheetVersion.EXCEL97)) {
|
||||
if (CellReference.cellReferenceIsWithinRange(col, row, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion)) {
|
||||
throw new IllegalArgumentException("Invalid name: '"+name+"': cannot be $A$1-style cell reference");
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
||||
*/
|
||||
@Override
|
||||
public void setRowNum(int rowIndex) {
|
||||
int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxrow = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
if ((rowIndex < 0) || (rowIndex > maxrow)) {
|
||||
throw new IllegalArgumentException("Invalid row number (" + rowIndex
|
||||
+ ") outside allowable range (0.." + maxrow + ")");
|
||||
|
@ -715,7 +715,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
if (region.getNumberOfCells() < 2) {
|
||||
throw new IllegalArgumentException("Merged region " + region.formatAsString() + " must contain 2 or more cells");
|
||||
}
|
||||
region.validate(SpreadsheetVersion.EXCEL97);
|
||||
region.validate(org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion);
|
||||
|
||||
if (validate) {
|
||||
// throw IllegalStateException if the argument CellRangeAddress intersects with
|
||||
@ -1453,7 +1453,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
*/
|
||||
@Override
|
||||
public void showInPane(int toprow, int leftcol) {
|
||||
int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxrow = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
if (toprow > maxrow) throw new IllegalArgumentException("Maximum row number is " + maxrow);
|
||||
|
||||
showInPane((short)toprow, (short)leftcol);
|
||||
@ -1533,7 +1533,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
private static int clip(int row) {
|
||||
return Math.min(
|
||||
Math.max(0, row),
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex());
|
||||
org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1677,7 +1677,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
}
|
||||
}
|
||||
if (endRow + n > _lastrow) {
|
||||
_lastrow = Math.min(endRow + n, SpreadsheetVersion.EXCEL97.getLastRowIndex());
|
||||
_lastrow = Math.min(endRow + n, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex());
|
||||
}
|
||||
} else {
|
||||
// Rows are moving up
|
||||
@ -1687,7 +1687,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
if (endRow == _lastrow) {
|
||||
// Need to walk backward to find the last non-blank row
|
||||
// NOTE: n is always negative here
|
||||
_lastrow = Math.min(endRow + n, SpreadsheetVersion.EXCEL97.getLastRowIndex());
|
||||
_lastrow = Math.min(endRow + n, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex());
|
||||
for (int i = endRow - 1; i > endRow + n; i--) {
|
||||
if (getRow(i) != null) {
|
||||
_lastrow = i;
|
||||
@ -1703,7 +1703,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
String sheetName = _workbook.getSheetName(sheetIndex);
|
||||
short externSheetIndex = _book.checkExternSheet(sheetIndex);
|
||||
FormulaShifter shifter = FormulaShifter.createForRowShift(
|
||||
externSheetIndex, sheetName, startRow, endRow, n, SpreadsheetVersion.EXCEL97);
|
||||
externSheetIndex, sheetName, startRow, endRow, n, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion);
|
||||
_sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
|
||||
|
||||
int nSheets = _workbook.getNumberOfSheets();
|
||||
@ -1923,7 +1923,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
@Override
|
||||
public void setColumnBreak(int column) {
|
||||
validateColumn((short) column);
|
||||
_sheet.getPageSettings().setColumnBreak((short) column, (short) 0, (short) SpreadsheetVersion.EXCEL97.getLastRowIndex());
|
||||
_sheet.getPageSettings().setColumnBreak((short) column, (short) 0, (short) org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1953,7 +1953,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
* @param row the index of the row to validate, zero-based
|
||||
*/
|
||||
protected void validateRow(int row) {
|
||||
int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxrow = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
if (row > maxrow) throw new IllegalArgumentException("Maximum row number is " + maxrow);
|
||||
if (row < 0) throw new IllegalArgumentException("Minumum row number is 0");
|
||||
}
|
||||
@ -1964,7 +1964,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
* @param column the index of the column to validate, zero-based
|
||||
*/
|
||||
protected void validateColumn(int column) {
|
||||
int maxcol = SpreadsheetVersion.EXCEL97.getLastColumnIndex();
|
||||
int maxcol = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex();
|
||||
if (column > maxcol) throw new IllegalArgumentException("Maximum column number is " + maxcol);
|
||||
if (column < 0) throw new IllegalArgumentException("Minimum column number is 0");
|
||||
}
|
||||
@ -2496,8 +2496,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
private void setRepeatingRowsAndColumns(
|
||||
CellRangeAddress rowDef, CellRangeAddress colDef) {
|
||||
int sheetIndex = _workbook.getSheetIndex(this);
|
||||
int maxRowIndex = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxColIndex = SpreadsheetVersion.EXCEL97.getLastColumnIndex();
|
||||
int maxRowIndex = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
int maxColIndex = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex();
|
||||
|
||||
int col1 = -1;
|
||||
int col2 = -1;
|
||||
@ -2582,8 +2582,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||
return null;
|
||||
}
|
||||
|
||||
int maxRowIndex = SpreadsheetVersion.EXCEL97.getLastRowIndex();
|
||||
int maxColIndex = SpreadsheetVersion.EXCEL97.getLastColumnIndex();
|
||||
int maxRowIndex = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex();
|
||||
int maxColIndex = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex();
|
||||
|
||||
for (Ptg ptg : nameDefinition) {
|
||||
|
||||
|
@ -174,7 +174,7 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor
|
||||
if (regions == null) {
|
||||
throw new IllegalArgumentException("regions must not be null");
|
||||
}
|
||||
for(CellRangeAddress range : regions) range.validate(SpreadsheetVersion.EXCEL97);
|
||||
for(CellRangeAddress range : regions) range.validate(org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion);
|
||||
|
||||
if (cfRules == null) {
|
||||
throw new IllegalArgumentException("cfRules must not be null");
|
||||
|
@ -123,6 +123,9 @@ import org.apache.poi.util.Removal;
|
||||
public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.usermodel.Workbook {
|
||||
private static final Pattern COMMA_PATTERN = Pattern.compile(",");
|
||||
|
||||
// org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion
|
||||
public static SpreadsheetVersion spreadsheetVersion = SpreadsheetVersion. EXCEL97;
|
||||
|
||||
/**
|
||||
* The maximum number of cell styles in a .xls workbook.
|
||||
* The 'official' limit is 4,000, but POI allows a slightly larger number.
|
||||
@ -2325,6 +2328,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
*/
|
||||
@Override
|
||||
public SpreadsheetVersion getSpreadsheetVersion() {
|
||||
return SpreadsheetVersion.EXCEL97;
|
||||
return org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public final class FormulaParser {
|
||||
_formulaString = formula;
|
||||
_pointer=0;
|
||||
_book = book;
|
||||
_ssVersion = book == null ? SpreadsheetVersion.EXCEL97 : book.getSpreadsheetVersion();
|
||||
_ssVersion = book == null ? org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion : book.getSpreadsheetVersion();
|
||||
_formulaLength = _formulaString.length();
|
||||
_sheetIndex = sheetIndex;
|
||||
_rowIndex = rowIndex;
|
||||
|
@ -28,7 +28,7 @@ import org.apache.poi.ss.util.CellReference;
|
||||
* Optimization - compacts many blank cell references used by a single formula.
|
||||
*/
|
||||
final class FormulaUsedBlankCellSet {
|
||||
public static final class BookSheetKey {
|
||||
public static final class BookSheetKey {// 253mb 10,567,793
|
||||
|
||||
private final int _bookIndex;
|
||||
private final int _sheetIndex;
|
||||
|
@ -184,7 +184,7 @@ public final class SheetNameFormatter {
|
||||
* @see org.apache.poi.ss.util.CellReference
|
||||
*/
|
||||
/* package */ static boolean cellReferenceIsWithinRange(String lettersPrefix, String numbersSuffix) {
|
||||
return CellReference.cellReferenceIsWithinRange(lettersPrefix, numbersSuffix, SpreadsheetVersion.EXCEL97);
|
||||
return CellReference.cellReferenceIsWithinRange(lettersPrefix, numbersSuffix, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,7 +286,7 @@ public abstract class AreaPtgBase extends OperandPtg implements AreaI {
|
||||
CellReference topLeft = new CellReference(getFirstRow(),getFirstColumn(),!isFirstRowRelative(),!isFirstColRelative());
|
||||
CellReference botRight = new CellReference(getLastRow(),getLastColumn(),!isLastRowRelative(),!isLastColRelative());
|
||||
|
||||
if(AreaReference.isWholeColumnReference(SpreadsheetVersion.EXCEL97, topLeft, botRight)) {
|
||||
if(AreaReference.isWholeColumnReference(org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion, topLeft, botRight)) {
|
||||
return (new AreaReference(topLeft, botRight)).formatAsString();
|
||||
}
|
||||
return topLeft.formatAsString() + ":" + botRight.formatAsString();
|
||||
|
@ -31,7 +31,7 @@ public class AreaReference {
|
||||
private static final char CELL_DELIMITER = ':';
|
||||
/** The character (') used to quote sheet names when they contain special characters */
|
||||
private static final char SPECIAL_NAME_DELIMITER = '\'';
|
||||
private static final SpreadsheetVersion DEFAULT_SPREADSHEET_VERSION = SpreadsheetVersion.EXCEL97;
|
||||
private static final SpreadsheetVersion DEFAULT_SPREADSHEET_VERSION = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion;
|
||||
|
||||
private final CellReference _firstCell;
|
||||
private final CellReference _lastCell;
|
||||
|
@ -75,12 +75,12 @@ public abstract class CellRangeAddressBase {
|
||||
|
||||
//TODO use the correct SpreadsheetVersion
|
||||
public final boolean isFullColumnRange() {
|
||||
return (_firstRow == 0 && _lastRow == SpreadsheetVersion.EXCEL97.getLastRowIndex())
|
||||
return (_firstRow == 0 && _lastRow == org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastRowIndex())
|
||||
|| (_firstRow == -1 && _lastRow == -1);
|
||||
}
|
||||
//TODO use the correct SpreadsheetVersion
|
||||
public final boolean isFullRowRange() {
|
||||
return (_firstCol == 0 && _lastCol == SpreadsheetVersion.EXCEL97.getLastColumnIndex())
|
||||
return (_firstCol == 0 && _lastCol == org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnIndex())
|
||||
|| (_firstCol == -1 && _lastCol == -1);
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,9 @@ public class CellReference {
|
||||
* digits or dot. (They can even end in dot).
|
||||
*/
|
||||
private static final Pattern NAMED_RANGE_NAME_PATTERN = Pattern.compile("[_A-Z][_.A-Z0-9]*", Pattern.CASE_INSENSITIVE);
|
||||
//private static final String BIFF8_LAST_COLUMN = SpreadsheetVersion.EXCEL97.getLastColumnName();
|
||||
//private static final String BIFF8_LAST_COLUMN = org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getLastColumnName();
|
||||
//private static final int BIFF8_LAST_COLUMN_TEXT_LEN = BIFF8_LAST_COLUMN.length();
|
||||
//private static final String BIFF8_LAST_ROW = String.valueOf(SpreadsheetVersion.EXCEL97.getMaxRows());
|
||||
//private static final String BIFF8_LAST_ROW = String.valueOf(org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion.getMaxRows());
|
||||
//private static final int BIFF8_LAST_ROW_TEXT_LEN = BIFF8_LAST_ROW.length();
|
||||
|
||||
// FIXME: _sheetName may be null, depending on the entry point.
|
||||
|
@ -402,7 +402,7 @@ public final class XSSFName implements Name {
|
||||
if (name.matches("[A-Za-z]+\\d+")) {
|
||||
String col = name.replaceAll("\\d", "");
|
||||
String row = name.replaceAll("[A-Za-z]", "");
|
||||
if (CellReference.cellReferenceIsWithinRange(col, row, SpreadsheetVersion.EXCEL97)) {
|
||||
if (CellReference.cellReferenceIsWithinRange(col, row, org.apache.poi.hssf.usermodel.HSSFWorkbook.spreadsheetVersion)) {
|
||||
throw new IllegalArgumentException("Invalid name: '"+name+"': cannot be $A$1-style cell reference");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user