mirror of https://github.com/apache/poi.git
Fixing compiler warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@736479 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b5a5ac13db
commit
647f94ed66
|
@ -98,12 +98,12 @@ public class HSSFCell implements Cell {
|
||||||
public final static short ENCODING_COMPRESSED_UNICODE = 0;
|
public final static short ENCODING_COMPRESSED_UNICODE = 0;
|
||||||
public final static short ENCODING_UTF_16 = 1;
|
public final static short ENCODING_UTF_16 = 1;
|
||||||
|
|
||||||
private final HSSFWorkbook book;
|
private final HSSFWorkbook _book;
|
||||||
private final HSSFSheet sheet;
|
private final HSSFSheet _sheet;
|
||||||
private int cellType;
|
private int _cellType;
|
||||||
private HSSFRichTextString stringValue;
|
private HSSFRichTextString _stringValue;
|
||||||
private CellValueRecordInterface record;
|
private CellValueRecordInterface _record;
|
||||||
private HSSFComment comment;
|
private HSSFComment _comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new Cell - Should only be called by HSSFRow. This creates a cell
|
* Creates new Cell - Should only be called by HSSFRow. This creates a cell
|
||||||
|
@ -124,9 +124,9 @@ public class HSSFCell implements Cell {
|
||||||
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
|
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
|
||||||
{
|
{
|
||||||
checkBounds(col);
|
checkBounds(col);
|
||||||
stringValue = null;
|
_stringValue = null;
|
||||||
this.book = book;
|
_book = book;
|
||||||
this.sheet = sheet;
|
_sheet = sheet;
|
||||||
|
|
||||||
// Relying on the fact that by default the cellType is set to 0 which
|
// Relying on the fact that by default the cellType is set to 0 which
|
||||||
// is different to CELL_TYPE_BLANK hence the following method call correctly
|
// is different to CELL_TYPE_BLANK hence the following method call correctly
|
||||||
|
@ -141,7 +141,7 @@ public class HSSFCell implements Cell {
|
||||||
* @return the HSSFSheet that owns this cell
|
* @return the HSSFSheet that owns this cell
|
||||||
*/
|
*/
|
||||||
public HSSFSheet getSheet() {
|
public HSSFSheet getSheet() {
|
||||||
return sheet;
|
return _sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,7 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public HSSFRow getRow() {
|
public HSSFRow getRow() {
|
||||||
int rowIndex = getRowIndex();
|
int rowIndex = getRowIndex();
|
||||||
return sheet.getRow(rowIndex);
|
return _sheet.getRow(rowIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,10 +171,10 @@ public class HSSFCell implements Cell {
|
||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
checkBounds(col);
|
checkBounds(col);
|
||||||
cellType = -1; // Force 'setCellType' to create a first Record
|
_cellType = -1; // Force 'setCellType' to create a first Record
|
||||||
stringValue = null;
|
_stringValue = null;
|
||||||
this.book = book;
|
_book = book;
|
||||||
this.sheet = sheet;
|
_sheet = sheet;
|
||||||
|
|
||||||
short xfindex = sheet.getSheet().getXFIndexForColAt(col);
|
short xfindex = sheet.getSheet().getXFIndexForColAt(col);
|
||||||
setCellType(type,false,row,col,xfindex);
|
setCellType(type,false,row,col,xfindex);
|
||||||
|
@ -189,22 +189,22 @@ public class HSSFCell implements Cell {
|
||||||
* @param cval - the Cell Value Record we wish to represent
|
* @param cval - the Cell Value Record we wish to represent
|
||||||
*/
|
*/
|
||||||
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, CellValueRecordInterface cval) {
|
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, CellValueRecordInterface cval) {
|
||||||
record = cval;
|
_record = cval;
|
||||||
cellType = determineType(cval);
|
_cellType = determineType(cval);
|
||||||
stringValue = null;
|
_stringValue = null;
|
||||||
this.book = book;
|
_book = book;
|
||||||
this.sheet = sheet;
|
_sheet = sheet;
|
||||||
switch (cellType)
|
switch (_cellType)
|
||||||
{
|
{
|
||||||
case CELL_TYPE_STRING :
|
case CELL_TYPE_STRING :
|
||||||
stringValue = new HSSFRichTextString(book.getWorkbook(), (LabelSSTRecord ) cval);
|
_stringValue = new HSSFRichTextString(book.getWorkbook(), (LabelSSTRecord ) cval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_BLANK :
|
case CELL_TYPE_BLANK :
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_FORMULA :
|
case CELL_TYPE_FORMULA :
|
||||||
stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
|
_stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(cval.getXFIndex());
|
ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(cval.getXFIndex());
|
||||||
|
@ -241,14 +241,14 @@ public class HSSFCell implements Cell {
|
||||||
* Returns the Workbook that this Cell is bound to
|
* Returns the Workbook that this Cell is bound to
|
||||||
*/
|
*/
|
||||||
protected Workbook getBoundWorkbook() {
|
protected Workbook getBoundWorkbook() {
|
||||||
return book.getWorkbook();
|
return _book.getWorkbook();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the (zero based) index of the row containing this cell
|
* @return the (zero based) index of the row containing this cell
|
||||||
*/
|
*/
|
||||||
public int getRowIndex() {
|
public int getRowIndex() {
|
||||||
return record.getRow();
|
return _record.getRow();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Set the cell's number within the row (0 based).
|
* Set the cell's number within the row (0 based).
|
||||||
|
@ -257,7 +257,7 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public void setCellNum(short num)
|
public void setCellNum(short num)
|
||||||
{
|
{
|
||||||
record.setColumn(num);
|
_record.setColumn(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -267,7 +267,7 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
protected void updateCellNum(short num)
|
protected void updateCellNum(short num)
|
||||||
{
|
{
|
||||||
record.setColumn(num);
|
_record.setColumn(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,7 +278,7 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnIndex() {
|
public int getColumnIndex() {
|
||||||
return record.getColumn() & 0xFFFF;
|
return _record.getColumn() & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,9 +292,9 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public void setCellType(int cellType) {
|
public void setCellType(int cellType) {
|
||||||
notifyFormulaChanging();
|
notifyFormulaChanging();
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
setCellType(cellType, true, row, col, styleIndex);
|
setCellType(cellType, true, row, col, styleIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,10 +320,10 @@ public class HSSFCell implements Cell {
|
||||||
case CELL_TYPE_FORMULA :
|
case CELL_TYPE_FORMULA :
|
||||||
FormulaRecordAggregate frec;
|
FormulaRecordAggregate frec;
|
||||||
|
|
||||||
if (cellType != this.cellType) {
|
if (cellType != _cellType) {
|
||||||
frec = sheet.getSheet().getRowsAggregate().createFormula(row, col);
|
frec = _sheet.getSheet().getRowsAggregate().createFormula(row, col);
|
||||||
} else {
|
} else {
|
||||||
frec = (FormulaRecordAggregate) record;
|
frec = (FormulaRecordAggregate) _record;
|
||||||
frec.setRow(row);
|
frec.setRow(row);
|
||||||
frec.setColumn(col);
|
frec.setColumn(col);
|
||||||
}
|
}
|
||||||
|
@ -332,19 +332,19 @@ public class HSSFCell implements Cell {
|
||||||
frec.getFormulaRecord().setValue(getNumericCellValue());
|
frec.getFormulaRecord().setValue(getNumericCellValue());
|
||||||
}
|
}
|
||||||
frec.setXFIndex(styleIndex);
|
frec.setXFIndex(styleIndex);
|
||||||
record = frec;
|
_record = frec;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_NUMERIC :
|
case CELL_TYPE_NUMERIC :
|
||||||
NumberRecord nrec = null;
|
NumberRecord nrec = null;
|
||||||
|
|
||||||
if (cellType != this.cellType)
|
if (cellType != _cellType)
|
||||||
{
|
{
|
||||||
nrec = new NumberRecord();
|
nrec = new NumberRecord();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nrec = ( NumberRecord ) record;
|
nrec = ( NumberRecord ) _record;
|
||||||
}
|
}
|
||||||
nrec.setColumn(col);
|
nrec.setColumn(col);
|
||||||
if (setValue)
|
if (setValue)
|
||||||
|
@ -353,14 +353,14 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
nrec.setXFIndex(styleIndex);
|
nrec.setXFIndex(styleIndex);
|
||||||
nrec.setRow(row);
|
nrec.setRow(row);
|
||||||
record = nrec;
|
_record = nrec;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_STRING :
|
case CELL_TYPE_STRING :
|
||||||
LabelSSTRecord lrec;
|
LabelSSTRecord lrec;
|
||||||
|
|
||||||
if (cellType == this.cellType) {
|
if (cellType == _cellType) {
|
||||||
lrec = (LabelSSTRecord) record;
|
lrec = (LabelSSTRecord) _record;
|
||||||
} else {
|
} else {
|
||||||
lrec = new LabelSSTRecord();
|
lrec = new LabelSSTRecord();
|
||||||
lrec.setColumn(col);
|
lrec.setColumn(col);
|
||||||
|
@ -369,44 +369,44 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
if (setValue) {
|
if (setValue) {
|
||||||
String str = convertCellValueToString();
|
String str = convertCellValueToString();
|
||||||
int sstIndex = book.getWorkbook().addSSTString(new UnicodeString(str));
|
int sstIndex = _book.getWorkbook().addSSTString(new UnicodeString(str));
|
||||||
lrec.setSSTIndex(sstIndex);
|
lrec.setSSTIndex(sstIndex);
|
||||||
UnicodeString us = book.getWorkbook().getSSTString(sstIndex);
|
UnicodeString us = _book.getWorkbook().getSSTString(sstIndex);
|
||||||
stringValue = new HSSFRichTextString();
|
_stringValue = new HSSFRichTextString();
|
||||||
stringValue.setUnicodeString(us);
|
_stringValue.setUnicodeString(us);
|
||||||
}
|
}
|
||||||
record = lrec;
|
_record = lrec;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_BLANK :
|
case CELL_TYPE_BLANK :
|
||||||
BlankRecord brec = null;
|
BlankRecord brec = null;
|
||||||
|
|
||||||
if (cellType != this.cellType)
|
if (cellType != _cellType)
|
||||||
{
|
{
|
||||||
brec = new BlankRecord();
|
brec = new BlankRecord();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
brec = ( BlankRecord ) record;
|
brec = ( BlankRecord ) _record;
|
||||||
}
|
}
|
||||||
brec.setColumn(col);
|
brec.setColumn(col);
|
||||||
|
|
||||||
// During construction the cellStyle may be null for a Blank cell.
|
// During construction the cellStyle may be null for a Blank cell.
|
||||||
brec.setXFIndex(styleIndex);
|
brec.setXFIndex(styleIndex);
|
||||||
brec.setRow(row);
|
brec.setRow(row);
|
||||||
record = brec;
|
_record = brec;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_BOOLEAN :
|
case CELL_TYPE_BOOLEAN :
|
||||||
BoolErrRecord boolRec = null;
|
BoolErrRecord boolRec = null;
|
||||||
|
|
||||||
if (cellType != this.cellType)
|
if (cellType != _cellType)
|
||||||
{
|
{
|
||||||
boolRec = new BoolErrRecord();
|
boolRec = new BoolErrRecord();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boolRec = ( BoolErrRecord ) record;
|
boolRec = ( BoolErrRecord ) _record;
|
||||||
}
|
}
|
||||||
boolRec.setColumn(col);
|
boolRec.setColumn(col);
|
||||||
if (setValue)
|
if (setValue)
|
||||||
|
@ -415,19 +415,19 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
boolRec.setXFIndex(styleIndex);
|
boolRec.setXFIndex(styleIndex);
|
||||||
boolRec.setRow(row);
|
boolRec.setRow(row);
|
||||||
record = boolRec;
|
_record = boolRec;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CELL_TYPE_ERROR :
|
case CELL_TYPE_ERROR :
|
||||||
BoolErrRecord errRec = null;
|
BoolErrRecord errRec = null;
|
||||||
|
|
||||||
if (cellType != this.cellType)
|
if (cellType != _cellType)
|
||||||
{
|
{
|
||||||
errRec = new BoolErrRecord();
|
errRec = new BoolErrRecord();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errRec = ( BoolErrRecord ) record;
|
errRec = ( BoolErrRecord ) _record;
|
||||||
}
|
}
|
||||||
errRec.setColumn(col);
|
errRec.setColumn(col);
|
||||||
if (setValue)
|
if (setValue)
|
||||||
|
@ -436,15 +436,15 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
errRec.setXFIndex(styleIndex);
|
errRec.setXFIndex(styleIndex);
|
||||||
errRec.setRow(row);
|
errRec.setRow(row);
|
||||||
record = errRec;
|
_record = errRec;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cellType != this.cellType &&
|
if (cellType != _cellType &&
|
||||||
this.cellType!=-1 ) // Special Value to indicate an uninitialized Cell
|
_cellType!=-1 ) // Special Value to indicate an uninitialized Cell
|
||||||
{
|
{
|
||||||
sheet.getSheet().replaceValueRecord(record);
|
_sheet.getSheet().replaceValueRecord(_record);
|
||||||
}
|
}
|
||||||
this.cellType = cellType;
|
_cellType = cellType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -458,7 +458,7 @@ public class HSSFCell implements Cell {
|
||||||
|
|
||||||
public int getCellType()
|
public int getCellType()
|
||||||
{
|
{
|
||||||
return cellType;
|
return _cellType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -469,18 +469,18 @@ public class HSSFCell implements Cell {
|
||||||
* will change the cell to a numeric cell and set its value.
|
* will change the cell to a numeric cell and set its value.
|
||||||
*/
|
*/
|
||||||
public void setCellValue(double value) {
|
public void setCellValue(double value) {
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
|
|
||||||
switch (cellType) {
|
switch (_cellType) {
|
||||||
default:
|
default:
|
||||||
setCellType(CELL_TYPE_NUMERIC, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_NUMERIC, false, row, col, styleIndex);
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
(( NumberRecord ) record).setValue(value);
|
(( NumberRecord ) _record).setValue(value);
|
||||||
break;
|
break;
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
((FormulaRecordAggregate)record).setCachedDoubleResult(value);
|
((FormulaRecordAggregate)_record).setCachedDoubleResult(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public void setCellValue(Date value)
|
public void setCellValue(Date value)
|
||||||
{
|
{
|
||||||
setCellValue(HSSFDateUtil.getExcelDate(value, this.book.getWorkbook().isUsing1904DateWindowing()));
|
setCellValue(HSSFDateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -515,7 +515,7 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public void setCellValue(Calendar value)
|
public void setCellValue(Calendar value)
|
||||||
{
|
{
|
||||||
setCellValue( HSSFDateUtil.getExcelDate(value, this.book.getWorkbook().isUsing1904DateWindowing()) );
|
setCellValue( HSSFDateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -543,22 +543,22 @@ public class HSSFCell implements Cell {
|
||||||
public void setCellValue(RichTextString value)
|
public void setCellValue(RichTextString value)
|
||||||
{
|
{
|
||||||
HSSFRichTextString hvalue = (HSSFRichTextString) value;
|
HSSFRichTextString hvalue = (HSSFRichTextString) value;
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
if (hvalue == null)
|
if (hvalue == null)
|
||||||
{
|
{
|
||||||
notifyFormulaChanging();
|
notifyFormulaChanging();
|
||||||
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cellType == CELL_TYPE_FORMULA) {
|
if (_cellType == CELL_TYPE_FORMULA) {
|
||||||
// Set the 'pre-evaluated result' for the formula
|
// Set the 'pre-evaluated result' for the formula
|
||||||
// note - formulas do not preserve text formatting.
|
// note - formulas do not preserve text formatting.
|
||||||
FormulaRecordAggregate fr = (FormulaRecordAggregate) record;
|
FormulaRecordAggregate fr = (FormulaRecordAggregate) _record;
|
||||||
fr.setCachedStringResult(hvalue.getString());
|
fr.setCachedStringResult(hvalue.getString());
|
||||||
// Update our local cache to the un-formatted version
|
// Update our local cache to the un-formatted version
|
||||||
stringValue = new HSSFRichTextString(value.getString());
|
_stringValue = new HSSFRichTextString(value.getString());
|
||||||
|
|
||||||
// All done
|
// All done
|
||||||
return;
|
return;
|
||||||
|
@ -567,17 +567,17 @@ public class HSSFCell implements Cell {
|
||||||
// If we get here, we're not dealing with a formula,
|
// If we get here, we're not dealing with a formula,
|
||||||
// so handle things as a normal rich text cell
|
// so handle things as a normal rich text cell
|
||||||
|
|
||||||
if (cellType != CELL_TYPE_STRING) {
|
if (_cellType != CELL_TYPE_STRING) {
|
||||||
setCellType(CELL_TYPE_STRING, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_STRING, false, row, col, styleIndex);
|
||||||
}
|
}
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
UnicodeString str = hvalue.getUnicodeString();
|
UnicodeString str = hvalue.getUnicodeString();
|
||||||
index = book.getWorkbook().addSSTString(str);
|
index = _book.getWorkbook().addSSTString(str);
|
||||||
(( LabelSSTRecord ) record).setSSTIndex(index);
|
(( LabelSSTRecord ) _record).setSSTIndex(index);
|
||||||
stringValue = hvalue;
|
_stringValue = hvalue;
|
||||||
stringValue.setWorkbookReferences(book.getWorkbook(), (( LabelSSTRecord ) record));
|
_stringValue.setWorkbookReferences(_book.getWorkbook(), (( LabelSSTRecord ) _record));
|
||||||
stringValue.setUnicodeString(book.getWorkbook().getSSTString(index));
|
_stringValue.setUnicodeString(_book.getWorkbook().getSSTString(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -592,19 +592,19 @@ public class HSSFCell implements Cell {
|
||||||
* @throws IllegalArgumentException if the formula is unparsable
|
* @throws IllegalArgumentException if the formula is unparsable
|
||||||
*/
|
*/
|
||||||
public void setCellFormula(String formula) {
|
public void setCellFormula(String formula) {
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
|
|
||||||
if (formula==null) {
|
if (formula==null) {
|
||||||
notifyFormulaChanging();
|
notifyFormulaChanging();
|
||||||
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int sheetIndex = book.getSheetIndex(sheet);
|
int sheetIndex = _book.getSheetIndex(_sheet);
|
||||||
Ptg[] ptgs = HSSFFormulaParser.parse(formula, book, FormulaType.CELL, sheetIndex);
|
Ptg[] ptgs = HSSFFormulaParser.parse(formula, _book, FormulaType.CELL, sheetIndex);
|
||||||
setCellType(CELL_TYPE_FORMULA, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_FORMULA, false, row, col, styleIndex);
|
||||||
FormulaRecordAggregate agg = (FormulaRecordAggregate) record;
|
FormulaRecordAggregate agg = (FormulaRecordAggregate) _record;
|
||||||
FormulaRecord frec = agg.getFormulaRecord();
|
FormulaRecord frec = agg.getFormulaRecord();
|
||||||
frec.setOptions((short) 2);
|
frec.setOptions((short) 2);
|
||||||
frec.setValue(0);
|
frec.setValue(0);
|
||||||
|
@ -620,13 +620,13 @@ public class HSSFCell implements Cell {
|
||||||
* Does nothing if this cell currently does not hold a formula
|
* Does nothing if this cell currently does not hold a formula
|
||||||
*/
|
*/
|
||||||
private void notifyFormulaChanging() {
|
private void notifyFormulaChanging() {
|
||||||
if (record instanceof FormulaRecordAggregate) {
|
if (_record instanceof FormulaRecordAggregate) {
|
||||||
((FormulaRecordAggregate)record).notifyFormulaChanging();
|
((FormulaRecordAggregate)_record).notifyFormulaChanging();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCellFormula() {
|
public String getCellFormula() {
|
||||||
return HSSFFormulaParser.toFormulaString(book, ((FormulaRecordAggregate)record).getFormulaTokens());
|
return HSSFFormulaParser.toFormulaString(_book, ((FormulaRecordAggregate)_record).getFormulaTokens());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -667,17 +667,17 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public double getNumericCellValue() {
|
public double getNumericCellValue() {
|
||||||
|
|
||||||
switch(cellType) {
|
switch(_cellType) {
|
||||||
case CELL_TYPE_BLANK:
|
case CELL_TYPE_BLANK:
|
||||||
return 0.0;
|
return 0.0;
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
return ((NumberRecord)record).getValue();
|
return ((NumberRecord)_record).getValue();
|
||||||
default:
|
default:
|
||||||
throw typeMismatch(CELL_TYPE_NUMERIC, cellType, false);
|
throw typeMismatch(CELL_TYPE_NUMERIC, _cellType, false);
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FormulaRecord fr = ((FormulaRecordAggregate)record).getFormulaRecord();
|
FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
|
||||||
checkFormulaCachedValueType(CELL_TYPE_NUMERIC, fr);
|
checkFormulaCachedValueType(CELL_TYPE_NUMERIC, fr);
|
||||||
return fr.getValue();
|
return fr.getValue();
|
||||||
}
|
}
|
||||||
|
@ -691,11 +691,11 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public Date getDateCellValue() {
|
public Date getDateCellValue() {
|
||||||
|
|
||||||
if (cellType == CELL_TYPE_BLANK) {
|
if (_cellType == CELL_TYPE_BLANK) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double value = getNumericCellValue();
|
double value = getNumericCellValue();
|
||||||
if (book.getWorkbook().isUsing1904DateWindowing()) {
|
if (_book.getWorkbook().isUsing1904DateWindowing()) {
|
||||||
return HSSFDateUtil.getJavaDate(value, true);
|
return HSSFDateUtil.getJavaDate(value, true);
|
||||||
}
|
}
|
||||||
return HSSFDateUtil.getJavaDate(value, false);
|
return HSSFDateUtil.getJavaDate(value, false);
|
||||||
|
@ -719,17 +719,17 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public HSSFRichTextString getRichStringCellValue() {
|
public HSSFRichTextString getRichStringCellValue() {
|
||||||
|
|
||||||
switch(cellType) {
|
switch(_cellType) {
|
||||||
case CELL_TYPE_BLANK:
|
case CELL_TYPE_BLANK:
|
||||||
return new HSSFRichTextString("");
|
return new HSSFRichTextString("");
|
||||||
case CELL_TYPE_STRING:
|
case CELL_TYPE_STRING:
|
||||||
return stringValue;
|
return _stringValue;
|
||||||
default:
|
default:
|
||||||
throw typeMismatch(CELL_TYPE_STRING, cellType, false);
|
throw typeMismatch(CELL_TYPE_STRING, _cellType, false);
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FormulaRecordAggregate fra = ((FormulaRecordAggregate)record);
|
FormulaRecordAggregate fra = ((FormulaRecordAggregate)_record);
|
||||||
checkFormulaCachedValueType(CELL_TYPE_STRING, fra.getFormulaRecord());
|
checkFormulaCachedValueType(CELL_TYPE_STRING, fra.getFormulaRecord());
|
||||||
String strVal = fra.getStringValue();
|
String strVal = fra.getStringValue();
|
||||||
return new HSSFRichTextString(strVal == null ? "" : strVal);
|
return new HSSFRichTextString(strVal == null ? "" : strVal);
|
||||||
|
@ -743,18 +743,18 @@ public class HSSFCell implements Cell {
|
||||||
* will change the cell to a boolean cell and set its value.
|
* will change the cell to a boolean cell and set its value.
|
||||||
*/
|
*/
|
||||||
public void setCellValue(boolean value) {
|
public void setCellValue(boolean value) {
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
|
|
||||||
switch (cellType) {
|
switch (_cellType) {
|
||||||
default:
|
default:
|
||||||
setCellType(CELL_TYPE_BOOLEAN, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_BOOLEAN, false, row, col, styleIndex);
|
||||||
case CELL_TYPE_BOOLEAN:
|
case CELL_TYPE_BOOLEAN:
|
||||||
(( BoolErrRecord ) record).setValue(value);
|
(( BoolErrRecord ) _record).setValue(value);
|
||||||
break;
|
break;
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
((FormulaRecordAggregate)record).setCachedBooleanResult(value);
|
((FormulaRecordAggregate)_record).setCachedBooleanResult(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,17 +768,17 @@ public class HSSFCell implements Cell {
|
||||||
* cell and set its value.
|
* cell and set its value.
|
||||||
*/
|
*/
|
||||||
public void setCellErrorValue(byte errorCode) {
|
public void setCellErrorValue(byte errorCode) {
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
switch (cellType) {
|
switch (_cellType) {
|
||||||
default:
|
default:
|
||||||
setCellType(CELL_TYPE_ERROR, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_ERROR, false, row, col, styleIndex);
|
||||||
case CELL_TYPE_ERROR:
|
case CELL_TYPE_ERROR:
|
||||||
(( BoolErrRecord ) record).setValue(errorCode);
|
(( BoolErrRecord ) _record).setValue(errorCode);
|
||||||
break;
|
break;
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
((FormulaRecordAggregate)record).setCachedErrorResult(errorCode);
|
((FormulaRecordAggregate)_record).setCachedErrorResult(errorCode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,19 +792,19 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
private boolean convertCellValueToBoolean() {
|
private boolean convertCellValueToBoolean() {
|
||||||
|
|
||||||
switch (cellType) {
|
switch (_cellType) {
|
||||||
case CELL_TYPE_BOOLEAN:
|
case CELL_TYPE_BOOLEAN:
|
||||||
return (( BoolErrRecord ) record).getBooleanValue();
|
return (( BoolErrRecord ) _record).getBooleanValue();
|
||||||
case CELL_TYPE_STRING:
|
case CELL_TYPE_STRING:
|
||||||
int sstIndex = ((LabelSSTRecord)record).getSSTIndex();
|
int sstIndex = ((LabelSSTRecord)_record).getSSTIndex();
|
||||||
String text = book.getWorkbook().getSSTString(sstIndex).getString();
|
String text = _book.getWorkbook().getSSTString(sstIndex).getString();
|
||||||
return Boolean.valueOf(text).booleanValue();
|
return Boolean.valueOf(text).booleanValue();
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
return ((NumberRecord)record).getValue() != 0;
|
return ((NumberRecord)_record).getValue() != 0;
|
||||||
|
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
// use cached formula result if it's the right type:
|
// use cached formula result if it's the right type:
|
||||||
FormulaRecord fr = ((FormulaRecordAggregate)record).getFormulaRecord();
|
FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
|
||||||
checkFormulaCachedValueType(CELL_TYPE_BOOLEAN, fr);
|
checkFormulaCachedValueType(CELL_TYPE_BOOLEAN, fr);
|
||||||
return fr.getCachedBooleanValue();
|
return fr.getCachedBooleanValue();
|
||||||
// Other cases convert to false
|
// Other cases convert to false
|
||||||
|
@ -813,27 +813,27 @@ public class HSSFCell implements Cell {
|
||||||
case CELL_TYPE_BLANK:
|
case CELL_TYPE_BLANK:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Unexpected cell type (" + cellType + ")");
|
throw new RuntimeException("Unexpected cell type (" + _cellType + ")");
|
||||||
}
|
}
|
||||||
private String convertCellValueToString() {
|
private String convertCellValueToString() {
|
||||||
|
|
||||||
switch (cellType) {
|
switch (_cellType) {
|
||||||
case CELL_TYPE_BLANK:
|
case CELL_TYPE_BLANK:
|
||||||
return "";
|
return "";
|
||||||
case CELL_TYPE_BOOLEAN:
|
case CELL_TYPE_BOOLEAN:
|
||||||
return ((BoolErrRecord) record).getBooleanValue() ? "TRUE" : "FALSE";
|
return ((BoolErrRecord) _record).getBooleanValue() ? "TRUE" : "FALSE";
|
||||||
case CELL_TYPE_STRING:
|
case CELL_TYPE_STRING:
|
||||||
int sstIndex = ((LabelSSTRecord)record).getSSTIndex();
|
int sstIndex = ((LabelSSTRecord)_record).getSSTIndex();
|
||||||
return book.getWorkbook().getSSTString(sstIndex).getString();
|
return _book.getWorkbook().getSSTString(sstIndex).getString();
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
return String.valueOf(((NumberRecord)record).getValue());
|
return String.valueOf(((NumberRecord)_record).getValue());
|
||||||
case CELL_TYPE_ERROR:
|
case CELL_TYPE_ERROR:
|
||||||
return HSSFErrorConstants.getText(((BoolErrRecord) record).getErrorValue());
|
return HSSFErrorConstants.getText(((BoolErrRecord) _record).getErrorValue());
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
// should really evaluate, but HSSFCell can't call HSSFFormulaEvaluator
|
// should really evaluate, but HSSFCell can't call HSSFFormulaEvaluator
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Unexpected cell type (" + cellType + ")");
|
throw new RuntimeException("Unexpected cell type (" + _cellType + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -842,17 +842,17 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public boolean getBooleanCellValue() {
|
public boolean getBooleanCellValue() {
|
||||||
|
|
||||||
switch(cellType) {
|
switch(_cellType) {
|
||||||
case CELL_TYPE_BLANK:
|
case CELL_TYPE_BLANK:
|
||||||
return false;
|
return false;
|
||||||
case CELL_TYPE_BOOLEAN:
|
case CELL_TYPE_BOOLEAN:
|
||||||
return (( BoolErrRecord ) record).getBooleanValue();
|
return (( BoolErrRecord ) _record).getBooleanValue();
|
||||||
default:
|
default:
|
||||||
throw typeMismatch(CELL_TYPE_BOOLEAN, cellType, false);
|
throw typeMismatch(CELL_TYPE_BOOLEAN, _cellType, false);
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FormulaRecord fr = ((FormulaRecordAggregate)record).getFormulaRecord();
|
FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
|
||||||
checkFormulaCachedValueType(CELL_TYPE_BOOLEAN, fr);
|
checkFormulaCachedValueType(CELL_TYPE_BOOLEAN, fr);
|
||||||
return fr.getCachedBooleanValue();
|
return fr.getCachedBooleanValue();
|
||||||
}
|
}
|
||||||
|
@ -862,15 +862,15 @@ public class HSSFCell implements Cell {
|
||||||
* For blank cells we return a 0.
|
* For blank cells we return a 0.
|
||||||
*/
|
*/
|
||||||
public byte getErrorCellValue() {
|
public byte getErrorCellValue() {
|
||||||
switch(cellType) {
|
switch(_cellType) {
|
||||||
case CELL_TYPE_ERROR:
|
case CELL_TYPE_ERROR:
|
||||||
return (( BoolErrRecord ) record).getErrorValue();
|
return (( BoolErrRecord ) _record).getErrorValue();
|
||||||
default:
|
default:
|
||||||
throw typeMismatch(CELL_TYPE_ERROR, cellType, false);
|
throw typeMismatch(CELL_TYPE_ERROR, _cellType, false);
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
FormulaRecord fr = ((FormulaRecordAggregate)record).getFormulaRecord();
|
FormulaRecord fr = ((FormulaRecordAggregate)_record).getFormulaRecord();
|
||||||
checkFormulaCachedValueType(CELL_TYPE_ERROR, fr);
|
checkFormulaCachedValueType(CELL_TYPE_ERROR, fr);
|
||||||
return (byte) fr.getCachedErrorValue();
|
return (byte) fr.getCachedErrorValue();
|
||||||
}
|
}
|
||||||
|
@ -888,10 +888,10 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
public void setCellStyle(HSSFCellStyle style) {
|
public void setCellStyle(HSSFCellStyle style) {
|
||||||
// Verify it really does belong to our workbook
|
// Verify it really does belong to our workbook
|
||||||
style.verifyBelongsToWorkbook(book);
|
style.verifyBelongsToWorkbook(_book);
|
||||||
|
|
||||||
// Change our cell record to use this style
|
// Change our cell record to use this style
|
||||||
record.setXFIndex(style.getIndex());
|
_record.setXFIndex(style.getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -901,9 +901,9 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public HSSFCellStyle getCellStyle()
|
public HSSFCellStyle getCellStyle()
|
||||||
{
|
{
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=_record.getXFIndex();
|
||||||
ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(styleIndex);
|
ExtendedFormatRecord xf = _book.getWorkbook().getExFormatAt(styleIndex);
|
||||||
return new HSSFCellStyle(styleIndex, xf, book);
|
return new HSSFCellStyle(styleIndex, xf, _book);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -914,7 +914,7 @@ public class HSSFCell implements Cell {
|
||||||
|
|
||||||
protected CellValueRecordInterface getCellValueRecord()
|
protected CellValueRecordInterface getCellValueRecord()
|
||||||
{
|
{
|
||||||
return record;
|
return _record;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -933,10 +933,10 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
public void setAsActiveCell()
|
public void setAsActiveCell()
|
||||||
{
|
{
|
||||||
int row=record.getRow();
|
int row=_record.getRow();
|
||||||
short col=record.getColumn();
|
short col=_record.getColumn();
|
||||||
this.sheet.getSheet().setActiveCellRow(row);
|
_sheet.getSheet().setActiveCellRow(row);
|
||||||
this.sheet.getSheet().setActiveCellCol(col);
|
_sheet.getSheet().setActiveCellCol(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -958,7 +958,7 @@ public class HSSFCell implements Cell {
|
||||||
case CELL_TYPE_BOOLEAN:
|
case CELL_TYPE_BOOLEAN:
|
||||||
return getBooleanCellValue()?"TRUE":"FALSE";
|
return getBooleanCellValue()?"TRUE":"FALSE";
|
||||||
case CELL_TYPE_ERROR:
|
case CELL_TYPE_ERROR:
|
||||||
return ErrorEval.getText((( BoolErrRecord ) record).getErrorValue());
|
return ErrorEval.getText((( BoolErrRecord ) _record).getErrorValue());
|
||||||
case CELL_TYPE_FORMULA:
|
case CELL_TYPE_FORMULA:
|
||||||
return getCellFormula();
|
return getCellFormula();
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
|
@ -966,9 +966,8 @@ public class HSSFCell implements Cell {
|
||||||
if (HSSFDateUtil.isCellDateFormatted(this)) {
|
if (HSSFDateUtil.isCellDateFormatted(this)) {
|
||||||
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
|
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
|
||||||
return sdf.format(getDateCellValue());
|
return sdf.format(getDateCellValue());
|
||||||
} else {
|
|
||||||
return getNumericCellValue() + "";
|
|
||||||
}
|
}
|
||||||
|
return String.valueOf(getNumericCellValue());
|
||||||
case CELL_TYPE_STRING:
|
case CELL_TYPE_STRING:
|
||||||
return getStringCellValue();
|
return getStringCellValue();
|
||||||
default:
|
default:
|
||||||
|
@ -989,9 +988,9 @@ public class HSSFCell implements Cell {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
comment.setRow((short)record.getRow());
|
comment.setRow((short)_record.getRow());
|
||||||
comment.setColumn(record.getColumn());
|
comment.setColumn(_record.getColumn());
|
||||||
this.comment = (HSSFComment)comment;
|
_comment = (HSSFComment)comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1000,10 +999,10 @@ public class HSSFCell implements Cell {
|
||||||
* @return comment associated with this cell
|
* @return comment associated with this cell
|
||||||
*/
|
*/
|
||||||
public HSSFComment getCellComment(){
|
public HSSFComment getCellComment(){
|
||||||
if (comment == null) {
|
if (_comment == null) {
|
||||||
comment = findCellComment(sheet.getSheet(), record.getRow(), record.getColumn());
|
_comment = findCellComment(_sheet.getSheet(), _record.getRow(), _record.getColumn());
|
||||||
}
|
}
|
||||||
return comment;
|
return _comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1013,8 +1012,8 @@ public class HSSFCell implements Cell {
|
||||||
* all comments after performing this action!
|
* all comments after performing this action!
|
||||||
*/
|
*/
|
||||||
public void removeCellComment() {
|
public void removeCellComment() {
|
||||||
HSSFComment comment = findCellComment(sheet.getSheet(), record.getRow(), record.getColumn());
|
HSSFComment comment = findCellComment(_sheet.getSheet(), _record.getRow(), _record.getColumn());
|
||||||
this.comment = null;
|
_comment = null;
|
||||||
|
|
||||||
if(comment == null) {
|
if(comment == null) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
|
@ -1022,7 +1021,7 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zap the underlying NoteRecord
|
// Zap the underlying NoteRecord
|
||||||
List sheetRecords = sheet.getSheet().getRecords();
|
List<RecordBase> sheetRecords = _sheet.getSheet().getRecords();
|
||||||
sheetRecords.remove(comment.getNoteRecord());
|
sheetRecords.remove(comment.getNoteRecord());
|
||||||
|
|
||||||
// If we have a TextObjectRecord, is should
|
// If we have a TextObjectRecord, is should
|
||||||
|
@ -1058,13 +1057,13 @@ public class HSSFCell implements Cell {
|
||||||
*/
|
*/
|
||||||
protected static HSSFComment findCellComment(Sheet sheet, int row, int column){
|
protected static HSSFComment findCellComment(Sheet sheet, int row, int column){
|
||||||
HSSFComment comment = null;
|
HSSFComment comment = null;
|
||||||
HashMap txshapes = new HashMap(); //map shapeId and TextObjectRecord
|
HashMap<Integer, TextObjectRecord> txshapesByShapeId = new HashMap<Integer, TextObjectRecord>();
|
||||||
for (Iterator it = sheet.getRecords().iterator(); it.hasNext(); ) {
|
for (Iterator<RecordBase> it = sheet.getRecords().iterator(); it.hasNext(); ) {
|
||||||
RecordBase rec = (RecordBase) it.next();
|
RecordBase rec = it.next();
|
||||||
if (rec instanceof NoteRecord){
|
if (rec instanceof NoteRecord){
|
||||||
NoteRecord note = (NoteRecord)rec;
|
NoteRecord note = (NoteRecord)rec;
|
||||||
if (note.getRow() == row && note.getColumn() == column){
|
if (note.getRow() == row && note.getColumn() == column){
|
||||||
TextObjectRecord txo = (TextObjectRecord)txshapes.get(new Integer(note.getShapeId()));
|
TextObjectRecord txo = txshapesByShapeId.get(new Integer(note.getShapeId()));
|
||||||
comment = new HSSFComment(note, txo);
|
comment = new HSSFComment(note, txo);
|
||||||
comment.setRow(note.getRow());
|
comment.setRow(note.getRow());
|
||||||
comment.setColumn(note.getColumn());
|
comment.setColumn(note.getColumn());
|
||||||
|
@ -1081,9 +1080,9 @@ public class HSSFCell implements Cell {
|
||||||
if (cmo.getObjectType() == CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT){
|
if (cmo.getObjectType() == CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT){
|
||||||
//find the nearest TextObjectRecord which holds comment's text and map it to its shapeId
|
//find the nearest TextObjectRecord which holds comment's text and map it to its shapeId
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
rec = ( Record ) it.next();
|
rec = it.next();
|
||||||
if (rec instanceof TextObjectRecord) {
|
if (rec instanceof TextObjectRecord) {
|
||||||
txshapes.put(new Integer(cmo.getObjectId()), rec);
|
txshapesByShapeId.put(new Integer(cmo.getObjectId()), (TextObjectRecord)rec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1096,16 +1095,14 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns hyperlink associated with this cell
|
* @return hyperlink associated with this cell or <code>null</code> if not found
|
||||||
*
|
|
||||||
* @return hyperlink associated with this cell or null if not found
|
|
||||||
*/
|
*/
|
||||||
public HSSFHyperlink getHyperlink(){
|
public HSSFHyperlink getHyperlink(){
|
||||||
for (Iterator it = sheet.getSheet().getRecords().iterator(); it.hasNext(); ) {
|
for (Iterator<RecordBase> it = _sheet.getSheet().getRecords().iterator(); it.hasNext(); ) {
|
||||||
RecordBase rec = (RecordBase) it.next();
|
RecordBase rec = it.next();
|
||||||
if (rec instanceof HyperlinkRecord){
|
if (rec instanceof HyperlinkRecord){
|
||||||
HyperlinkRecord link = (HyperlinkRecord)rec;
|
HyperlinkRecord link = (HyperlinkRecord)rec;
|
||||||
if(link.getFirstColumn() == record.getColumn() && link.getFirstRow() == record.getRow()){
|
if(link.getFirstColumn() == _record.getColumn() && link.getFirstRow() == _record.getRow()){
|
||||||
return new HSSFHyperlink(link);
|
return new HSSFHyperlink(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1114,17 +1111,17 @@ public class HSSFCell implements Cell {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a hypelrink to this cell
|
* Assign a hyperlink to this cell
|
||||||
*
|
*
|
||||||
* @param hyperlink hypelrink associated with this cell
|
* @param hyperlink hyperlink associated with this cell
|
||||||
*/
|
*/
|
||||||
public void setHyperlink(Hyperlink hyperlink){
|
public void setHyperlink(Hyperlink hyperlink){
|
||||||
HSSFHyperlink link = (HSSFHyperlink)hyperlink;
|
HSSFHyperlink link = (HSSFHyperlink)hyperlink;
|
||||||
|
|
||||||
link.setFirstRow(record.getRow());
|
link.setFirstRow(_record.getRow());
|
||||||
link.setLastRow(record.getRow());
|
link.setLastRow(_record.getRow());
|
||||||
link.setFirstColumn(record.getColumn());
|
link.setFirstColumn(_record.getColumn());
|
||||||
link.setLastColumn(record.getColumn());
|
link.setLastColumn(_record.getColumn());
|
||||||
|
|
||||||
switch(link.getType()){
|
switch(link.getType()){
|
||||||
case HSSFHyperlink.LINK_EMAIL:
|
case HSSFHyperlink.LINK_EMAIL:
|
||||||
|
@ -1139,8 +1136,8 @@ public class HSSFCell implements Cell {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int eofLoc = sheet.getSheet().findFirstRecordLocBySid( EOFRecord.sid );
|
int eofLoc = _sheet.getSheet().findFirstRecordLocBySid( EOFRecord.sid );
|
||||||
sheet.getSheet().getRecords().add( eofLoc, link.record );
|
_sheet.getSheet().getRecords().add( eofLoc, link.record );
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Only valid for formula cells
|
* Only valid for formula cells
|
||||||
|
@ -1149,9 +1146,9 @@ public class HSSFCell implements Cell {
|
||||||
* on the cached value of the formula
|
* on the cached value of the formula
|
||||||
*/
|
*/
|
||||||
public int getCachedFormulaResultType() {
|
public int getCachedFormulaResultType() {
|
||||||
if (this.cellType != CELL_TYPE_FORMULA) {
|
if (_cellType != CELL_TYPE_FORMULA) {
|
||||||
throw new IllegalStateException("Only formula cells have cached results");
|
throw new IllegalStateException("Only formula cells have cached results");
|
||||||
}
|
}
|
||||||
return ((FormulaRecordAggregate)record).getFormulaRecord().getCachedResultType();
|
return ((FormulaRecordAggregate)_record).getFormulaRecord().getCachedResultType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue