warn-unless-xslt-is-available"
description="Generates the API documentation">
<javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
- windowtitle="POI API Documentation" use="true" version="true">
+ windowtitle="POI API Documentation" use="true" version="true" maxmemory="256M">
<packageset dir="${main.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
<packageset dir="${contrib.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
</packageset>
- <packageset dir="${examples.src}" defaultexcludes="yes">
+ <packageset dir="${ooxml.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
</packageset>
<path refid="main.classpath"/>
<path refid="scratchpad.classpath"/>
<path refid="contrib.classpath"/>
- <path refid="examples.classpath"/>
+ <path refid="ooxml.classpath"/>
<path path="${env.CLASSPATH}"/>
</classpath>
/**
* Create an array of records from an input stream
*
- *@param in the InputStream from which the records will be obtained
+ *@param is the InputStream from which the records will be obtained
*@return an array of Records created from the InputStream
*@exception RecordFormatException on error processing the InputStream
*/
* to the passed in records and references to those records held. This function
* is normally called via Workbook.
*
- * @param inRecs array containing those records in the sheet in sequence (normally obtained from RecordFactory)
- * @param sheetnum integer specifying the sheet's number (0,1 or 2 in this release)
- * @param offset of the sheet's BOF record
+ * @param rs the stream to read records from
*
* @return Sheet object with all values set to those read from the file
*
* at what this sets it to.
*
* @param row the row record to be added
- * @see #setLoc(int)
*/
public void addRow(RowRecord row)
* subsequent calls will return values in (physical) sequence or NULL when you get to the end.
*
* @return CellValueRecordInterface representing the next value record or NULL if there are no more
- * @see #setLoc(int)
*/
public CellValueRecordInterface[] getValueRecords() {
return _rowsAggregate.getValueRecords();
* subsequent calls will return rows in (physical) sequence or NULL when you get to the end.
*
* @return RowRecord representing the next row record or NULL if there are no more
- * @see #setLoc(int)
- *
*/
public RowRecord getNextRow() {
if (rowRecIterator == null)
*
* @param rownum which row to return (careful with LOC)
* @return RowRecord representing the next row record or NULL if there are no more
- * @see #setLoc(int)
*
*/
public RowRecord getRow(int rownum) {
* @param columnIndex index
* @see org.apache.poi.hssf.record.DefaultColWidthRecord
* @see org.apache.poi.hssf.record.ColumnInfoRecord
- * @see #setColumnWidth(short,short)
+ * @see #setColumnWidth(int, int)
* @return column width in units of 1/256th of a character width
*/
/**
* Get the hidden property for a given column.
- * @param column index
+ * @param columnIndex column index
* @see org.apache.poi.hssf.record.DefaultColWidthRecord
* @see org.apache.poi.hssf.record.ColumnInfoRecord
- * @see #setColumnHidden(short,boolean)
+ * @see #setColumnHidden(int, boolean)
* @return whether the column is hidden or not.
*/
public boolean isColumnHidden(int columnIndex) {
/**
* Set cell ranges list to a single cell range and
* modify the enclosing cell range accordingly.
- * @param List cellRanges - list of CellRange objects
+ * @param cellRanges - list of CellRange objects
*/
public void setCellRanges(CellRangeAddress[] cellRanges)
{
* Subclasses should implement this so that their data is passed back in a
* byte array.
*
- * @param offset to begin writing at
+ * @param pOffset to begin writing at
* @param data byte array containing instance data
* @return number of bytes written
*/
/**
* set whether or not these cells are hidden
* @param ishidden - whether the cells are hidden.
- * @see #setOptions(short)
+ * @see #setOptions(int)
*/
public void setHidden(boolean ishidden)
/**
* set the outline level for the cells
- * @see #setOptions(short)
+ * @see #setOptions(int)
* @param olevel -outline level for the cells
*/
/**
* set whether the cells are collapsed
* @param iscollapsed - wether the cells are collapsed
- * @see #setOptions(short)
+ * @see #setOptions(int)
*/
public void setCollapsed(boolean iscollapsed)
/**
* get whether or not these cells are hidden
* @return whether the cells are hidden.
- * @see #setOptions(short)
+ * @see #setOptions(int)
*/
public boolean getHidden()
/**
* get the outline level for the cells
- * @see #setOptions(short)
+ * @see #setOptions(int)
* @return outline level for the cells
*/
/**
* get whether the cells are collapsed
* @return wether the cells are collapsed
- * @see #setOptions(short)
+ * @see #setOptions(int)
*/
public boolean getCollapsed()
}
/**
- * @returns the size of the group of <tt>DBCellRecord</tt>s needed to encode
+ * @return the size of the group of <tt>DBCellRecord</tt>s needed to encode
* the specified number of blocks and rows
*/
public static int calculateSizeOfRecords(int nBlocks, int nRows) {
/**
* Option flags field
*
- * @see org.apache.poi.hssf.util.HSSFDataValidation utility class
+ * @see HSSFDataValidation utility class
*/
private static final BitField opt_data_type = new BitField(0x0000000F);
private static final BitField opt_error_style = new BitField(0x00000070);
// --> start option flags
/**
* @return the condition data type
- * @see DVConstraint.ValidationType
+ * @see org.apache.poi.hssf.usermodel.DVConstraint.ValidationType
*/
public int getDataType() {
return opt_data_type.getValue(_option_flags);
/**
* @return the condition error style
- * @see HSSFDataValidation.ErrorStyle
+ * @see org.apache.poi.hssf.usermodel.HSSFDataValidation.ErrorStyle
*/
public int getErrorStyle() {
return opt_error_style.getValue(_option_flags);
/**
* get the condition operator
* @return the condition operator
- * @see org.apache.poi.hssf.util.HSSFDataValidation utility class
+ * @see HSSFDataValidation utility class
*/
public int getConditionOperator() {
return opt_condition_operator.getValue(_option_flags);
}
/**
- * @param hashed password
+ * @param password hashed password
*/
public void setPassword(short password) {
field_2_password = password;
}
/**
- * @returns password hashed with hashPassword() (very lame)
+ * @return password hashed with hashPassword() (very lame)
*/
public short getPassword() {
return field_2_password;
}
/**
- * @returns byte representing the length of the username field
+ * @return byte representing the length of the username field
*/
public short getUsernameLength() {
return (short) field_3_username_value.length();
}
/**
- * @returns username of the user that created the file
+ * @return username of the user that created the file
*/
public String getUsername() {
return field_3_username_value;
}
/**
- * Returns a 16-byte guid identifier. Seems to always equal {@link STD_MONIKER}
+ * Returns a 16-byte guid identifier. Seems to always equal {@link #STD_MONIKER}
*
* @return 16-byte guid identifier
*/
* called by the constructor, should set class level fields. Should throw
* runtime exception for bad/icomplete data.
*
- * @param in the RecordInputstream to read the record from
+ * @param ris the RecordInputstream to read the record from
*/
public NameRecord(RecordInputStream ris) {
LittleEndianInput in = ris;
/**
* Construct a new <code>NoteStructureSubRecord</code> and
* fill its data with the default values
- * @param size
- * @param in
*/
public NoteStructureSubRecord()
{
/**
* Serialize the record data into the supplied array of bytes
*
- * @param offset offset in the <code>data</code>
- * @param data the data to serialize into
- *
- * @return size of the record
+ * @param out the stream to serialize into
*/
public void serialize(LittleEndianOutput out) {
out.writeShort(sid);
}
/**
- * @returns the number of bytes available in the current BIFF record
+ * @return the number of bytes available in the current BIFF record
* @see #remaining()
*/
public int available() {
/**
* Reads a 16 bit, unsigned value.
- * @return
*/
public int readUShort() {
checkRecordPosition(LittleEndian.SHORT_SIZE);
/**
* get the actual index of the style extended format record
- * @see #getIndex()
+ * @see #getXFIndex()
* @return index of the xf record
*/
public int getXFIndex() {
* called by the constructor, should set class level fields. Should throw
* runtime exception for bad/incomplete data.
*
- * @param data raw data
- * @param size size of data
- * @param offset of the record's data (provided a big array of the file)
+ * @param in the stream to read from
*/
public SupBookRecord(RecordInputStream in) {
int recLen = in.remaining();
/**
* Create CFRecordsAggregate from a list of CF Records
- * @param recs - list of {@link Record} objects
- * @param offset - position of {@link CFHeaderRecord} object in the list of Record objects
+ * @param rs - the stream to read from
* @return CFRecordsAggregate object
*/
public static CFRecordsAggregate createCFAggregate(RecordStream rs) {
/**
* Create a deep clone of the record
- * @return
*/
public CFRecordsAggregate cloneCFAggregate()
{
/**
* Create a row record.
*
- * @param row number
+ * @param rowNumber row number
* @return RowRecord created for the passed in row number
* @see org.apache.poi.hssf.record.RowRecord
*/
_groupsBySharedFormulaRecord = m;
}
- /**
- * @param recs list of sheet records (possibly contains records for other parts of the Excel file)
- * @param startIx index of first row/cell record for current sheet
- * @param endIx one past index of last row/cell record for current sheet. It is important
- * that this code does not inadvertently collect <tt>SharedFormulaRecord</tt>s from any other
- * sheet (which could happen if endIx is chosen poorly). (see bug 44449)
- */
public static SharedValueManager create(SharedFormulaRecord[] sharedFormulaRecords,
ArrayRecord[] arrayRecords, TableRecord[] tableRecords) {
if (sharedFormulaRecords.length + arrayRecords.length + tableRecords.length < 1) {
/**
* get the color to use for the left border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public int getLeftBorderColor() {
return bordLeftLineColor.getValue(field_13_border_styles1);
/**
* get the color to use for the right border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public int getRightBorderColor() {
return bordRightLineColor.getValue(field_13_border_styles1);
/**
* get the color to use for the top border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public int getTopBorderColor() {
return bordTopLineColor.getValue(field_14_border_styles2);
/**
* get the color to use for the bottom border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public int getBottomBorderColor() {
return bordBottomLineColor.getValue(field_14_border_styles2);
/**
* get the color to use for the diagonal border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public int getDiagonalBorderColor() {
return bordDiagLineColor.getValue(field_14_border_styles2);
* Do all possible cell merges between cells of the list so that:<br>
* <li>if a cell range is completely inside of another cell range, it gets removed from the list
* <li>if two cells have a shared border, merge them into one bigger cell range
- * @param cellRangeList
+ * @param cellRanges
* @return updated List of cell ranges
*/
public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges) {
/**
* set the font to be italics or not
*
- * @param italics - whether the font is italics or not
- * @see #setAttributes(short)
+ * @param italic - whether the font is italics or not
+ * @see #setFontOption(boolean, org.apache.poi.util.BitField)
*/
public void setItalic(boolean italic)
* get whether the font is to be italics or not
*
* @return italics - whether the font is italics or not
- * @see #getAttributes()
+ * @see #getFontOption(org.apache.poi.util.BitField)
*/
public boolean isItalic()
* get whether the font is to be stricken out or not
*
* @return strike - whether the font is stricken out or not
- * @see #getAttributes()
+ * @see #getFontOption(org.apache.poi.util.BitField)
*/
public boolean isStruckout()
public abstract int getSize();
/**
- * @return the encoded length of this Ptg, not including the initial Ptg type identifier byte.
+ * //@return the encoded length of this Ptg, not including the initial Ptg type identifier byte.
*/
// public abstract int getDataSize();
* "5**2" -> 500<br/>
* "250%" -> 2.5<br/>
*
- * @param text
+ * @param pText
* @return <code>null</code> if the specified text cannot be parsed as a number
*/
public static Double parseDouble(String pText) {
* An implementation of the TRIM function:
* Removes leading and trailing spaces from value if evaluated operand
* value is string.
- * @author Manda Wilson < wilson at c bio dot msk cc dot org >
+ * Author: Manda Wilson < wilson at c bio dot msk cc dot org >
*/
public static final Function TRIM = new SingleArgTextFunc() {
protected ValueEval evaluate(String arg) {
* <b>Syntax<b>:<br/> <b>MID</b>(<b>text</b>, <b>start_num</b>,
* <b>num_chars</b>)<br/>
*
- * @author Manda Wilson < wilson at c bio dot msk cc dot org >
+ * Author: Manda Wilson < wilson at c bio dot msk cc dot org >
*/
public static final Function MID = new TextFunction() {
/**
* Returns the Workbook that this Cell is bound to
- * @return
*/
protected Workbook getBoundWorkbook() {
return book.getWorkbook();
/**
* Assign a hypelrink to this cell
*
- * @param link hypelrink associated with this cell
+ * @param hyperlink hypelrink associated with this cell
*/
public void setHyperlink(Hyperlink hyperlink){
HSSFHyperlink link = (HSSFHyperlink)hyperlink;
return format.getAlignment();
}
- /**
- * get whether this cell is to be part of a merged block of cells
- *
- * @returns merged or not
- */
-
-// public boolean getMergeCells()
-// {
-// return format.getMergeCells();
-// }
-
- /**
- * set whether this cell is to be part of a merged block of cells
- *
- * @param merge merged or not
- */
-
-// public void setMergeCells(boolean merge)
-// {
-// format.setMergeCells(merge);
-// }
-
/**
* set whether the text should be wrapped
* @param wrapped wrap text or not
/**
* get the color to use for the left border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public short getLeftBorderColor()
{
/**
* get the color to use for the left border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public short getRightBorderColor()
{
/**
* get the color to use for the top border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public short getTopBorderColor()
{
/**
* get the color to use for the left border
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return The index of the color definition
*/
public short getBottomBorderColor()
{
* </LI>
* </UL>
*
- * Use {@link HSSFSheet#getConditionalFormattingAt(int)} to get access to an instance of this class.
+ * Use {@link org.apache.poi.hssf.usermodel.HSSFSheet#getSheetConditionalFormatting()} to get access to an instance of this class.
* <P>
* To create a new Conditional Formatting set use the following approach:
*
}
/**
- * @param show <code>true</code> if an prompt box should be displayed , <code>false</code> otherwise
+ * @return <code>true</code> if an prompt box should be displayed , <code>false</code> otherwise
*/
public boolean getShowPromptBox() {
return _showPromptBox;
}
/**
- * @return
* @see org.apache.poi.hssf.record.cf.FontFormatting#getRawRecord()
*/
protected byte[] getRawRecord()
* set font style options.
*
* @param italic - if true, set posture style to italic, otherwise to normal
- * @param bold- if true, set font weight to bold, otherwise to normal
+ * @param bold if true, set font weight to bold, otherwise to normal
*/
public void setFontStyle(boolean italic, boolean bold)
/**
* @param height
- * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(short)
+ * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(int)
*/
public void setFontHeight(int height)
{
/**
* set the type of underlining type for the font
*
- * @param u super or subscript option
+ * @param underlineType super or subscript option
*
* @see #U_NONE
* @see #U_SINGLE
* Evaluates formula cells.<p/>\r
*\r
* For performance reasons, this class keeps a cache of all previously calculated intermediate\r
- * cell values. Be sure to call {@link #clearCache()} if any workbook cells are changed between\r
+ * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between\r
* calls to evaluate~ methods on this class.\r
*\r
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >\r
* int evaluatedCellType = evaluator.evaluateFormulaCell(cell);\r
* </pre>\r
* Be aware that your cell will hold both the formula, and the result. If you want the cell \r
- * replaced with the result of the formula, use {@link #evaluateInCell(HSSFCell)}\r
+ * replaced with the result of the formula, use {@link #evaluateInCell(org.apache.poi.ss.usermodel.Cell)}\r
* @param cell The cell to evaluate\r
* @return -1 for non-formula cells, or the type of the <em>formula result</em>\r
*/\r
* </pre>\r
* Be aware that your cell value will be changed to hold the\r
* result of the formula. If you simply want the formula\r
- * value computed for you, use {@link #evaluateFormulaCell(HSSFCell)}\r
+ * value computed for you, use {@link #evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)}}\r
* @param cell\r
*/\r
public HSSFCell evaluateInCell(Cell cell) {\r
}
/**
- * @return
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillBackgroundColor()
*/
public short getFillBackgroundColor()
}
/**
- * @return
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillForegroundColor()
*/
public short getFillForegroundColor()
}
/**
- * @return
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillPattern()
*/
public short getFillPattern()
/**
* @param bg
- * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillBackgroundColor(short)
+ * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillBackgroundColor(int)
*/
public void setFillBackgroundColor(short bg)
{
/**
* @param fg
- * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillForegroundColor(short)
+ * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillForegroundColor(int)
*/
public void setFillForegroundColor(short fg)
{
/**
* @param fp
- * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillPattern(short)
+ * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillPattern(int)
*/
public void setFillPattern(short fp)
{
* Get the hssfcell representing a given column (logical cell)
* 0-based. If you ask for a cell that is not defined then
* you get a null, unless you have set a different
- * {@link MissingCellPolicy} on the base workbook.
+ * {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy} on the base workbook.
*
* @param cellnum 0 based column number
* @return HSSFCell representing that column or null if undefined.
* will not return un-defined (null) cells.
* Call getCellNum() on the returned cells to know which cell they are.
* As this only ever works on physically defined cells,
- * the {@link MissingCellPolicy} has no effect.
+ * the {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy} has no effect.
*/
public Iterator cellIterator()
{
* @param rownum row number
* @return High level HSSFRow object representing a row in the sheet
* @see org.apache.poi.hssf.usermodel.HSSFRow
- * @see #removeRow(HSSFRow)
+ * @see #removeRow(org.apache.poi.ss.usermodel.Row)
*/
public HSSFRow createRow(int rownum)
{
* TODO - formulas containing cell references are currently not parsed properly \r
*\r
* @param comparisonOperation - a constant value from\r
- * <tt>{@link HSSFConditionalFormattingRule.ComparisonOperator}</tt>: <p>\r
+ * <tt>{@link org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator}</tt>: <p>\r
* <ul>\r
* <li>BETWEEN</li>\r
* <li>NOT_BETWEEN</li>\r
* </p>\r
* @param formula1 - formula for the valued, compared with the cell\r
* @param formula2 - second formula (only used with\r
- * {@link HSSFConditionalFormattingRule#COMPARISON_OPERATOR_BETWEEN}) and\r
- * {@link HSSFConditionalFormattingRule#COMPARISON_OPERATOR_NOT_BETWEEN} operations)\r
+ * {@link org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator#BETWEEN}) and\r
+ * {@link org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator#NOT_BETWEEN} operations)\r
*/\r
public HSSFConditionalFormattingRule createConditionalFormattingRule(\r
byte comparisonOperation,\r
* Sets the policy on what to do when
* getting missing or blank cells from a row.
* This will then apply to all calls to
- * {@link HSSFRow.getCell()}. See
+ * {@link HSSFRow#getCell(int)}}. See
* {@link MissingCellPolicy}.
* Note that this has no effect on any
* iterators, only on when fetching Cells
* Abstracts a cell for the purpose of formula evaluation. This interface represents both formula
* and non-formula cells.<br/>
*
- * Implementors of this class must implement {@link #hashCode()} and {@link #equals(Object)}
+ * Implementors of this class must implement {@link Object#hashCode()} and {@link Object#equals(Object)}
* to provide an <em>identity</em> relationship based on the underlying HSSF or XSSF cell <p/>
*
* For POI internal use only
package org.apache.poi.ss.formula;
/**
- * Should be implemented by any {@link Ptg} subclass that needs has an extern sheet index <br/>
+ * Should be implemented by any {@link org.apache.poi.hssf.record.formula.Ptg} subclass that needs has an extern sheet index <br/>
*
* For POI internal use only
*
package org.apache.poi.ss.formula;\r
\r
/**\r
- * Should be implemented by any {@link Ptg} subclass that needs a workbook to render its formula.\r
+ * Should be implemented by any {@link org.apache.poi.hssf.record.formula.Ptg} subclass that needs a workbook to render its formula.\r
* <br/>\r
* \r
* For POI internal use only\r
* Evaluates formula cells.<p/>
*
* For performance reasons, this class keeps a cache of all previously calculated intermediate
- * cell values. Be sure to call {@link #clearCache()} if any workbook cells are changed between
+ * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between
* calls to evaluate~ methods on this class.<br/>
*
* For POI internal use only
package org.apache.poi.ss.usermodel;
-import org.apache.poi.hssf.record.formula.eval.BlankEval;
-import org.apache.poi.hssf.record.formula.eval.BoolEval;
-import org.apache.poi.hssf.record.formula.eval.ErrorEval;
-import org.apache.poi.hssf.record.formula.eval.NumberEval;
-import org.apache.poi.hssf.record.formula.eval.StringEval;
-import org.apache.poi.hssf.record.formula.eval.ValueEval;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-
-
/**
* Evaluates formula cells.<p/>
*
* For performance reasons, this class keeps a cache of all previously calculated intermediate
- * cell values. Be sure to call {@link #clearCache()} if any workbook cells are changed between
+ * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between
* calls to evaluate~ methods on this class.
*
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
package org.apache.poi.ss.usermodel;
/**
- * Common interface for {@link Header} and
- * {@link Footer}.
+ * Common interface for {@link org.apache.poi.ss.usermodel.Header} and
+ * {@link org.apache.poi.ss.usermodel.Footer}.
*/
public interface HeaderFooter {
/**
}
/**
- * @param _firstCol column number for the upper left hand corner
+ * @param firstCol column number for the upper left hand corner
*/
public final void setFirstColumn(int firstCol) {
_firstCol = firstCol;
}
/**
- * @param rowFrom row number for the upper left hand corner
+ * @param firstRow row number for the upper left hand corner
*/
public final void setFirstRow(int firstRow) {
_firstRow = firstRow;
}
/**
- * @param colTo column number for the lower right hand corner
+ * @param lastCol column number for the lower right hand corner
*/
public final void setLastColumn(int lastCol) {
_lastCol = lastCol;
}
/**
- * @param rowTo row number for the lower right hand corner
+ * @param lastRow row number for the lower right hand corner
*/
public final void setLastRow(int lastRow) {
_lastRow = lastRow;
* @param firstCol - the upper left hand corner's col
* @param lastRow - the lower right hand corner's row
* @param lastCol - the lower right hand corner's col
- * @return the index of this ADDR structure
*/
public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol) {
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
/**
* Convert a List of CellRange objects to an array of regions
*
- * @param List of CellRange objects
+ * @param cellRanges list of CellRange objects
* @return regions
*/
public static Region[] convertCellRangesToRegions(CellRangeAddress[] cellRanges) {
/**
* Title: String Utility Description: Collection of string handling utilities<p/>
*
- * Note - none of the methods in this class deals with {@link ContinueRecord}s. For such
+ * Note - none of the methods in this class deals with {@link org.apache.poi.hssf.record.ContinueRecord}s. For such
* functionality, consider using {@link RecordInputStream
} *
*
}\r
\r
/**\r
- *\r
- * @return\r
- * @throws IOException\r
+ * Creates an empty file in the default temporary-file directory, \r
*/\r
public static File createTempFile() throws IOException {\r
File file = File.createTempFile("poi-ooxml-", ".tmp");\r
* appropriate model or usermodel thing can be
* created for it.
* @param childPart The PackagePart of the child
- * @param childId the ID of the relationship the child comes from
+ * @param childRelId the ID of the relationship the child comes from
*/
public void generateChild(PackagePart childPart, String childRelId);
/**
* Construct a XSSFCell.
*
- * @param row the xml bean containing information about the cell.
* @param row the parent row.
+ * @param cell the xml bean containing information about the cell.
*/
protected XSSFCell(XSSFRow row, CTCell cell) {
this.cell = cell;
* Get the type of horizontal alignment for the cell
*
* @return short - the type of alignment
- * @see #ALIGN_GENERAL
- * @see #ALIGN_LEFT
- * @see #ALIGN_CENTER
- * @see #ALIGN_RIGHT
- * @see #ALIGN_FILL
- * @see #ALIGN_JUSTIFY
- * @see #ALIGN_CENTER_SELECTION
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
*/
public short getAlignment() {
return (short)(getAlignmentEnum().ordinal());
* Get the type of horizontal alignment for the cell
*
* @return HorizontalAlignment - the type of alignment
+ * @see org.apache.poi.ss.usermodel.HorizontalAlignment
*/
public HorizontalAlignment getAlignmentEnum() {
CTCellAlignment align = cellXf.getAlignment();
* Get the type of border to use for the bottom border of the cell
*
* @return short - border type
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderBottom() {
if(!cellXf.getApplyBorder()) return BORDER_NONE;
/**
* Get the type of border to use for the left border of the cell
*
- * @return short - border type, default value is {@link #BORDER_NONE}
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderLeft() {
if(!cellXf.getApplyBorder()) return BORDER_NONE;
/**
* Get the type of border to use for the left border of the cell
*
- * @return border type, default value is {@link BorderStyle.NONE}
+ * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderLeftEnum() {
int style = getBorderLeft();
/**
* Get the type of border to use for the right border of the cell
*
- * @return short - border type, default value is {@link #BORDER_NONE}
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderRight() {
if(!cellXf.getApplyBorder()) return BORDER_NONE;
/**
* Get the type of border to use for the right border of the cell
*
- * @return border type, default value is {@link BorderStyle.NONE}
+ * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderRightEnum() {
int style = getBorderRight();
/**
* Get the type of border to use for the top border of the cell
*
- * @return short - border type, default value is {@link #BORDER_NONE}
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle #BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderTop() {
if(!cellXf.getApplyBorder()) return BORDER_NONE;
/**
* Get the type of border to use for the top border of the cell
*
- * @return border type, default value is {@link BorderStyle.NONE}
+ * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderTopEnum() {
int style = getBorderTop();
* Get the color to use for the bottom border
* <br/>
* Color is optional. When missing, IndexedColors.AUTOMATIC is implied.
- * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors.AUTOMATIC}
- * @see IndexedColors
+ * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getBottomBorderColor() {
XSSFColor clr = getBottomBorderXSSFColor();
* Note - many cells are actually filled with a foreground
* fill, not a background fill - see {@link #getFillForegroundColor()}
* </p>
- * @return fill color, default value is {@link IndexedColors.AUTOMATIC}
- * @see IndexedColors
+ * @return fill color, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getFillBackgroundColor() {
XSSFColor clr = getFillBackgroundXSSFColor();
* background color ({@link #getFillBackgroundColor()})
* </p>
* @see IndexedColors
- * @return fill color, default value is {@link IndexedColors.AUTOMATIC}
+ * @return fill color, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
*/
public short getFillForegroundColor() {
XSSFColor clr = getFillForegroundXSSFColor();
/**
* Get the fill pattern
- * @return fill pattern, default value is {@link #NO_FILL}
- *
- * @see #NO_FILL
- * @see #SOLID_FOREGROUND
- * @see #FINE_DOTS
- * @see #ALT_BARS
- * @see #SPARSE_DOTS
- * @see #THICK_HORZ_BANDS
- * @see #THICK_VERT_BANDS
- * @see #THICK_BACKWARD_DIAG
- * @see #THICK_FORWARD_DIAG
- * @see #BIG_SPOTS
- * @see #BRICKS
- * @see #THIN_HORZ_BANDS
- * @see #THIN_VERT_BANDS
- * @see #THIN_BACKWARD_DIAG
- * @see #THIN_FORWARD_DIAG
- * @see #SQUARES
- * @see #DIAMONDS
+ * @return fill pattern, default value is {@link org.apache.poi.ss.usermodel.CellStyle#NO_FILL}
+ *
+ * @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
+ * @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
+ * @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
+ * @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
+ * @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
*/
public short getFillPattern() {
if(!cellXf.getApplyFill()) return 0;
/**
* Get the fill pattern
*
- * @return the fill pattern, default value is {@link FillPatternType.NO_FILL}
+ * @return the fill pattern, default value is {@link org.apache.poi.ss.usermodel.FillPatternType#NO_FILL}
*/
public FillPatternType getFillPatternEnum() {
int style = getFillPattern();
/**
* Get the color to use for the left border
*
- * @return the index of the color definition, default value is {@link IndexedColors.BLACK}
- * @see IndexedColors
+ * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getLeftBorderColor() {
XSSFColor clr = getLeftBorderXSSFColor();
* Get the color to use for the left border
*
* @return the index of the color definition or <code>null</code> if not set
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public XSSFColor getLeftBorderXSSFColor() {
if(!cellXf.getApplyBorder()) return null;
/**
* Get the color to use for the right border
*
- * @return the index of the color definition, default value is {@link IndexedColors.BLACK}
- * @see IndexedColors
+ * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getRightBorderColor() {
XSSFColor clr = getRightBorderXSSFColor();
/**
* Get the color to use for the top border
*
- * @return the index of the color definition, default value is {@link IndexedColors.BLACK}
- * @see IndexedColors
+ * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getTopBorderColor() {
XSSFColor clr = getTopBorderXSSFColor();
/**
* Get the type of vertical alignment for the cell
*
- * @return align the type of alignment, default value is {@link #VERTICAL_BOTTOM}
- * @see #VERTICAL_TOP
- * @see #VERTICAL_CENTER
- * @see #VERTICAL_BOTTOM
- * @see #VERTICAL_JUSTIFY
+ * @return align the type of alignment, default value is {@link org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM}
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
*/
public short getVerticalAlignment() {
return (short) (getVerticalAlignmentEnum().ordinal());
/**
* Get the type of vertical alignment for the cell
*
- * @return the type of alignment, default value is {@link VerticalAlignment.BOTTOM}
- * @see VerticalAlignment
+ * @return the type of alignment, default value is {@link org.apache.poi.ss.usermodel.VerticalAlignment#BOTTOM}
+ * @see org.apache.poi.ss.usermodel.VerticalAlignment
*/
public VerticalAlignment getVerticalAlignmentEnum() {
CTCellAlignment align = cellXf.getAlignment();
* Set the type of horizontal alignment for the cell
*
* @param align - the type of alignment
- * @see #ALIGN_GENERAL
- * @see #ALIGN_LEFT
- * @see #ALIGN_CENTER
- * @see #ALIGN_RIGHT
- * @see #ALIGN_FILL
- * @see #ALIGN_JUSTIFY
- * @see #ALIGN_CENTER_SELECTION
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
*/
public void setAlignment(short align) {
getCellAlignment().setHorizontal(HorizontalAlignment.values()[align]);
* Set the type of border to use for the bottom border of the cell
*
* @param border the type of border to use
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderBottom(short border) {
CTBorder ct = getCTBorder();
* Set the type of border to use for the bottom border of the cell
*
* @param border - type of border to use
- * @see BorderStyle
+ * @see org.apache.poi.ss.usermodel.BorderStyle
*/
public void setBorderBottom(BorderStyle border) {
setBorderBottom((short)border.ordinal());
/**
* Set the type of border to use for the left border of the cell
* @param border the type of border to use
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderLeft(short border) {
CTBorder ct = getCTBorder();
* Set the type of border to use for the right border of the cell
*
* @param border the type of border to use
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderRight(short border) {
CTBorder ct = getCTBorder();
* Set the type of border to use for the top border of the cell
*
* @param border the type of border to use
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
+ * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderTop(short border) {
CTBorder ct = getCTBorder();
/**
* Set the color to use for the bottom border
* @param color the index of the color definition
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setBottomBorderColor(short color) {
XSSFColor clr = new XSSFColor();
* for the color to be shown in the cell.
*
* @param bg - the color to use
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setFillBackgroundColor(short bg) {
XSSFColor clr = new XSSFColor();
* <br/>
* <i>Note: Ensure Foreground color is set prior to background color.</i>
* @param fg the color to use
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setFillForegroundColor(short fg) {
XSSFColor clr = new XSSFColor();
* For solid cell fills (no pattern), foregorund color is used.
* For cell fills with patterns specified, then the cell fill color is specified by the background color.
*
- * @see #NO_FILL
- * @see #SOLID_FOREGROUND
- * @see #FINE_DOTS
- * @see #ALT_BARS
- * @see #SPARSE_DOTS
- * @see #THICK_HORZ_BANDS
- * @see #THICK_VERT_BANDS
- * @see #THICK_BACKWARD_DIAG
- * @see #THICK_FORWARD_DIAG
- * @see #BIG_SPOTS
- * @see #BRICKS
- * @see #THIN_HORZ_BANDS
- * @see #THIN_VERT_BANDS
- * @see #THIN_BACKWARD_DIAG
- * @see #THIN_FORWARD_DIAG
- * @see #SQUARES
- * @see #DIAMONDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
+ * @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
+ * @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
+ * @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
+ * @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
+ * @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
+ * @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
* @see #setFillBackgroundColor(short)
* @see #setFillForegroundColor(short)
- * @param fp fill pattern (set to {@link #SOLID_FOREGROUND} to fill w/foreground color)
+ * @param fp fill pattern (set to {@link org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND} to fill w/foreground color)
*/
public void setFillPattern(short fp) {
CTFill ct = getCTFill();
* @param ptrn the fill pattern to use
* @see #setFillBackgroundColor(short)
* @see #setFillForegroundColor(short)
- * @see FillPatternType
+ * @see org.apache.poi.ss.usermodel.FillPatternType
*/
public void setFillPattern(FillPatternType ptrn) {
setFillPattern((short)ptrn.ordinal());
* Set the color to use for the left border as a indexed color value
*
* @param color the index of the color definition
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setLeftBorderColor(short color) {
XSSFColor clr = new XSSFColor();
* Set the color to use for the right border
*
* @param color the index of the color definition
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setRightBorderColor(short color) {
XSSFColor clr = new XSSFColor();
* Set the type of vertical alignment for the cell
*
* @param align - align the type of alignment
- * @see #VERTICAL_TOP
- * @see #VERTICAL_CENTER
- * @see #VERTICAL_BOTTOM
- * @see #VERTICAL_JUSTIFY
- * @see VerticalAlignment
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
+ * @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
+ * @see org.apache.poi.ss.usermodel.VerticalAlignment
*/
public void setVerticalAlignment(short align) {
getCellAlignment().setVertical(VerticalAlignment.values()[align]);
public static final short DEFAULT_FONT_SIZE = 11;
/**
* Default font color is black
- * @see IndexedColors.BLACK
+ * @see org.apache.poi.ss.usermodel.IndexedColors#BLACK
*/
public static final short DEFAULT_FONT_COLOR = IndexedColors.BLACK.getIndex();
-/* ====================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-==================================================================== */\r
-\r
-package org.apache.poi.xssf.usermodel;\r
-\r
-import java.util.Iterator;\r
-\r
-import org.apache.poi.hssf.record.formula.eval.BoolEval;\r
-import org.apache.poi.hssf.record.formula.eval.ErrorEval;\r
-import org.apache.poi.hssf.record.formula.eval.NumberEval;\r
-import org.apache.poi.hssf.record.formula.eval.StringEval;\r
-import org.apache.poi.hssf.record.formula.eval.ValueEval;\r
-import org.apache.poi.hssf.usermodel.HSSFCell;\r
-import org.apache.poi.ss.formula.WorkbookEvaluator;\r
-import org.apache.poi.ss.usermodel.Cell;\r
-import org.apache.poi.ss.usermodel.CellValue;\r
-import org.apache.poi.ss.usermodel.FormulaEvaluator;\r
-import org.apache.poi.ss.usermodel.Row;\r
-import org.apache.poi.ss.usermodel.Sheet;\r
-\r
-/**\r
- * Evaluates formula cells.<p/>\r
- *\r
- * For performance reasons, this class keeps a cache of all previously calculated intermediate\r
- * cell values. Be sure to call {@link #clearCache()} if any workbook cells are changed between\r
- * calls to evaluate~ methods on this class.\r
- *\r
- * @author Amol S. Deshmukh < amolweb at ya hoo dot com >\r
- * @author Josh Micich\r
- */\r
-public class XSSFFormulaEvaluator implements FormulaEvaluator {\r
-\r
- private WorkbookEvaluator _bookEvaluator;\r
-\r
- public XSSFFormulaEvaluator(XSSFWorkbook workbook) {\r
- _bookEvaluator = new WorkbookEvaluator(XSSFEvaluationWorkbook.create(workbook));\r
- }\r
-\r
- /**\r
- * Should be called whenever there are major changes (e.g. moving sheets) to input cells\r
- * in the evaluated workbook.\r
- * Failure to call this method after changing cell values will cause incorrect behaviour\r
- * of the evaluate~ methods of this class\r
- */\r
- public void clearAllCachedResultValues() {\r
- _bookEvaluator.clearAllCachedResultValues();\r
- }\r
- public void notifySetFormula(Cell cell) {\r
- _bookEvaluator.notifyUpdateCell(new XSSFEvaluationCell((XSSFCell)cell));\r
- }\r
- public void notifyDeleteCell(Cell cell) {\r
- _bookEvaluator.notifyDeleteCell(new XSSFEvaluationCell((XSSFCell)cell));\r
- }\r
-\r
- /**\r
- * If cell contains a formula, the formula is evaluated and returned,\r
- * else the CellValue simply copies the appropriate cell value from\r
- * the cell and also its cell type. This method should be preferred over\r
- * evaluateInCell() when the call should not modify the contents of the\r
- * original cell.\r
- * @param cell\r
- */\r
- public CellValue evaluate(Cell cell) {\r
- if (cell == null) {\r
- return null;\r
- }\r
-\r
- switch (cell.getCellType()) {\r
- case XSSFCell.CELL_TYPE_BOOLEAN:\r
- return CellValue.valueOf(cell.getBooleanCellValue());\r
- case XSSFCell.CELL_TYPE_ERROR:\r
- return CellValue.getError(cell.getErrorCellValue());\r
- case XSSFCell.CELL_TYPE_FORMULA:\r
- return evaluateFormulaCellValue(cell);\r
- case XSSFCell.CELL_TYPE_NUMERIC:\r
- return new CellValue(cell.getNumericCellValue());\r
- case XSSFCell.CELL_TYPE_STRING:\r
- return new CellValue(cell.getRichStringCellValue().getString());\r
- }\r
- throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");\r
- }\r
-\r
-\r
- /**\r
- * If cell contains formula, it evaluates the formula,\r
- * and saves the result of the formula. The cell\r
- * remains as a formula cell.\r
- * Else if cell does not contain formula, this method leaves\r
- * the cell unchanged.\r
- * Note that the type of the formula result is returned,\r
- * so you know what kind of value is also stored with\r
- * the formula.\r
- * <pre>\r
- * int evaluatedCellType = evaluator.evaluateFormulaCell(cell);\r
- * </pre>\r
- * Be aware that your cell will hold both the formula,\r
- * and the result. If you want the cell replaced with\r
- * the result of the formula, use {@link #evaluateInCell(HSSFCell)}\r
- * @param cell The cell to evaluate\r
- * @return The type of the formula result (the cell's type remains as HSSFCell.CELL_TYPE_FORMULA however)\r
- */\r
- public int evaluateFormulaCell(Cell cell) {\r
- if (cell == null || cell.getCellType() != XSSFCell.CELL_TYPE_FORMULA) {\r
- return -1;\r
- }\r
- CellValue cv = evaluateFormulaCellValue(cell);\r
- // cell remains a formula cell, but the cached value is changed\r
- setCellValue(cell, cv);\r
- return cv.getCellType();\r
- }\r
-\r
- /**\r
- * If cell contains formula, it evaluates the formula, and\r
- * puts the formula result back into the cell, in place\r
- * of the old formula.\r
- * Else if cell does not contain formula, this method leaves\r
- * the cell unchanged.\r
- * Note that the same instance of HSSFCell is returned to\r
- * allow chained calls like:\r
- * <pre>\r
- * int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();\r
- * </pre>\r
- * Be aware that your cell value will be changed to hold the\r
- * result of the formula. If you simply want the formula\r
- * value computed for you, use {@link #evaluateFormulaCell(HSSFCell)}\r
- * @param cell\r
- */\r
- public XSSFCell evaluateInCell(Cell cell) {\r
- if (cell == null) {\r
- return null;\r
- }\r
- XSSFCell result = (XSSFCell) cell;\r
- if (cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA) {\r
- CellValue cv = evaluateFormulaCellValue(cell);\r
- setCellType(cell, cv); // cell will no longer be a formula cell\r
- setCellValue(cell, cv);\r
- }\r
- return result;\r
- }\r
- private static void setCellType(Cell cell, CellValue cv) {\r
- int cellType = cv.getCellType();\r
- switch (cellType) {\r
- case XSSFCell.CELL_TYPE_BOOLEAN:\r
- case XSSFCell.CELL_TYPE_ERROR:\r
- case XSSFCell.CELL_TYPE_NUMERIC:\r
- case XSSFCell.CELL_TYPE_STRING:\r
- cell.setCellType(cellType);\r
- return;\r
- case XSSFCell.CELL_TYPE_BLANK:\r
- // never happens - blanks eventually get translated to zero\r
- case XSSFCell.CELL_TYPE_FORMULA:\r
- // this will never happen, we have already evaluated the formula\r
- }\r
- throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");\r
- }\r
-\r
- private static void setCellValue(Cell cell, CellValue cv) {\r
- int cellType = cv.getCellType();\r
- switch (cellType) {\r
- case XSSFCell.CELL_TYPE_BOOLEAN:\r
- cell.setCellValue(cv.getBooleanValue());\r
- break;\r
- case XSSFCell.CELL_TYPE_ERROR:\r
- cell.setCellErrorValue(cv.getErrorValue());\r
- break;\r
- case XSSFCell.CELL_TYPE_NUMERIC:\r
- cell.setCellValue(cv.getNumberValue());\r
- break;\r
- case XSSFCell.CELL_TYPE_STRING:\r
- cell.setCellValue(new XSSFRichTextString(cv.getStringValue()));\r
- break;\r
- case XSSFCell.CELL_TYPE_BLANK:\r
- // never happens - blanks eventually get translated to zero\r
- case XSSFCell.CELL_TYPE_FORMULA:\r
- // this will never happen, we have already evaluated the formula\r
- default:\r
- throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");\r
- }\r
- }\r
-\r
- /**\r
- * Loops over all cells in all sheets of the supplied\r
- * workbook.\r
- * For cells that contain formulas, their formulas are\r
- * evaluated, and the results are saved. These cells\r
- * remain as formula cells.\r
- * For cells that do not contain formulas, no changes\r
- * are made.\r
- * This is a helpful wrapper around looping over all\r
- * cells, and calling evaluateFormulaCell on each one.\r
- */\r
- public static void evaluateAllFormulaCells(XSSFWorkbook wb) {\r
- XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);\r
- for(int i=0; i<wb.getNumberOfSheets(); i++) {\r
- Sheet sheet = wb.getSheetAt(i);\r
-\r
- for (Iterator<Row> rit = sheet.rowIterator(); rit.hasNext();) {\r
- Row r = rit.next();\r
-\r
- for (Iterator cit = r.cellIterator(); cit.hasNext();) {\r
- XSSFCell c = (XSSFCell) cit.next();\r
- if (c.getCellType() == XSSFCell.CELL_TYPE_FORMULA)\r
- evaluator.evaluateFormulaCell(c);\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Returns a CellValue wrapper around the supplied ValueEval instance.\r
- * @param eval\r
- */\r
- private CellValue evaluateFormulaCellValue(Cell cell) {\r
- ValueEval eval = _bookEvaluator.evaluate(new XSSFEvaluationCell((XSSFCell) cell));\r
- if (eval instanceof NumberEval) {\r
- NumberEval ne = (NumberEval) eval;\r
- return new CellValue(ne.getNumberValue());\r
- }\r
- if (eval instanceof BoolEval) {\r
- BoolEval be = (BoolEval) eval;\r
- return CellValue.valueOf(be.getBooleanValue());\r
- }\r
- if (eval instanceof StringEval) {\r
- StringEval ne = (StringEval) eval;\r
- return new CellValue(ne.getStringValue());\r
- }\r
- if (eval instanceof ErrorEval) {\r
- return CellValue.getError(((ErrorEval)eval).getErrorCode());\r
- }\r
- throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");\r
- }\r
-}\r
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.xssf.usermodel;
+
+import java.util.Iterator;
+
+import org.apache.poi.hssf.record.formula.eval.BoolEval;
+import org.apache.poi.hssf.record.formula.eval.ErrorEval;
+import org.apache.poi.hssf.record.formula.eval.NumberEval;
+import org.apache.poi.hssf.record.formula.eval.StringEval;
+import org.apache.poi.hssf.record.formula.eval.ValueEval;
+import org.apache.poi.ss.formula.WorkbookEvaluator;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.ss.usermodel.FormulaEvaluator;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+
+/**
+ * Evaluates formula cells.<p/>
+ *
+ * For performance reasons, this class keeps a cache of all previously calculated intermediate
+ * cell values. Be sure to call {@link #clearAllCachedResultValues()} if any workbook cells are changed between
+ * calls to evaluate~ methods on this class.
+ *
+ * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
+ * @author Josh Micich
+ */
+public class XSSFFormulaEvaluator implements FormulaEvaluator {
+
+ private WorkbookEvaluator _bookEvaluator;
+
+ public XSSFFormulaEvaluator(XSSFWorkbook workbook) {
+ _bookEvaluator = new WorkbookEvaluator(XSSFEvaluationWorkbook.create(workbook));
+ }
+
+ /**
+ * Should be called whenever there are major changes (e.g. moving sheets) to input cells
+ * in the evaluated workbook.
+ * Failure to call this method after changing cell values will cause incorrect behaviour
+ * of the evaluate~ methods of this class
+ */
+ public void clearAllCachedResultValues() {
+ _bookEvaluator.clearAllCachedResultValues();
+ }
+ public void notifySetFormula(Cell cell) {
+ _bookEvaluator.notifyUpdateCell(new XSSFEvaluationCell((XSSFCell)cell));
+ }
+ public void notifyDeleteCell(Cell cell) {
+ _bookEvaluator.notifyDeleteCell(new XSSFEvaluationCell((XSSFCell)cell));
+ }
+
+ /**
+ * If cell contains a formula, the formula is evaluated and returned,
+ * else the CellValue simply copies the appropriate cell value from
+ * the cell and also its cell type. This method should be preferred over
+ * evaluateInCell() when the call should not modify the contents of the
+ * original cell.
+ * @param cell
+ */
+ public CellValue evaluate(Cell cell) {
+ if (cell == null) {
+ return null;
+ }
+
+ switch (cell.getCellType()) {
+ case XSSFCell.CELL_TYPE_BOOLEAN:
+ return CellValue.valueOf(cell.getBooleanCellValue());
+ case XSSFCell.CELL_TYPE_ERROR:
+ return CellValue.getError(cell.getErrorCellValue());
+ case XSSFCell.CELL_TYPE_FORMULA:
+ return evaluateFormulaCellValue(cell);
+ case XSSFCell.CELL_TYPE_NUMERIC:
+ return new CellValue(cell.getNumericCellValue());
+ case XSSFCell.CELL_TYPE_STRING:
+ return new CellValue(cell.getRichStringCellValue().getString());
+ }
+ throw new IllegalStateException("Bad cell type (" + cell.getCellType() + ")");
+ }
+
+
+ /**
+ * If cell contains formula, it evaluates the formula,
+ * and saves the result of the formula. The cell
+ * remains as a formula cell.
+ * Else if cell does not contain formula, this method leaves
+ * the cell unchanged.
+ * Note that the type of the formula result is returned,
+ * so you know what kind of value is also stored with
+ * the formula.
+ * <pre>
+ * int evaluatedCellType = evaluator.evaluateFormulaCell(cell);
+ * </pre>
+ * Be aware that your cell will hold both the formula,
+ * and the result. If you want the cell replaced with
+ * the result of the formula, use {@link #evaluate(org.apache.poi.ss.usermodel.Cell)} }
+ * @param cell The cell to evaluate
+ * @return The type of the formula result (the cell's type remains as HSSFCell.CELL_TYPE_FORMULA however)
+ */
+ public int evaluateFormulaCell(Cell cell) {
+ if (cell == null || cell.getCellType() != XSSFCell.CELL_TYPE_FORMULA) {
+ return -1;
+ }
+ CellValue cv = evaluateFormulaCellValue(cell);
+ // cell remains a formula cell, but the cached value is changed
+ setCellValue(cell, cv);
+ return cv.getCellType();
+ }
+
+ /**
+ * If cell contains formula, it evaluates the formula, and
+ * puts the formula result back into the cell, in place
+ * of the old formula.
+ * Else if cell does not contain formula, this method leaves
+ * the cell unchanged.
+ * Note that the same instance of HSSFCell is returned to
+ * allow chained calls like:
+ * <pre>
+ * int evaluatedCellType = evaluator.evaluateInCell(cell).getCellType();
+ * </pre>
+ * Be aware that your cell value will be changed to hold the
+ * result of the formula. If you simply want the formula
+ * value computed for you, use {@link #evaluateFormulaCell(org.apache.poi.ss.usermodel.Cell)} }
+ * @param cell
+ */
+ public XSSFCell evaluateInCell(Cell cell) {
+ if (cell == null) {
+ return null;
+ }
+ XSSFCell result = (XSSFCell) cell;
+ if (cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA) {
+ CellValue cv = evaluateFormulaCellValue(cell);
+ setCellType(cell, cv); // cell will no longer be a formula cell
+ setCellValue(cell, cv);
+ }
+ return result;
+ }
+ private static void setCellType(Cell cell, CellValue cv) {
+ int cellType = cv.getCellType();
+ switch (cellType) {
+ case XSSFCell.CELL_TYPE_BOOLEAN:
+ case XSSFCell.CELL_TYPE_ERROR:
+ case XSSFCell.CELL_TYPE_NUMERIC:
+ case XSSFCell.CELL_TYPE_STRING:
+ cell.setCellType(cellType);
+ return;
+ case XSSFCell.CELL_TYPE_BLANK:
+ // never happens - blanks eventually get translated to zero
+ case XSSFCell.CELL_TYPE_FORMULA:
+ // this will never happen, we have already evaluated the formula
+ }
+ throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");
+ }
+
+ private static void setCellValue(Cell cell, CellValue cv) {
+ int cellType = cv.getCellType();
+ switch (cellType) {
+ case XSSFCell.CELL_TYPE_BOOLEAN:
+ cell.setCellValue(cv.getBooleanValue());
+ break;
+ case XSSFCell.CELL_TYPE_ERROR:
+ cell.setCellErrorValue(cv.getErrorValue());
+ break;
+ case XSSFCell.CELL_TYPE_NUMERIC:
+ cell.setCellValue(cv.getNumberValue());
+ break;
+ case XSSFCell.CELL_TYPE_STRING:
+ cell.setCellValue(new XSSFRichTextString(cv.getStringValue()));
+ break;
+ case XSSFCell.CELL_TYPE_BLANK:
+ // never happens - blanks eventually get translated to zero
+ case XSSFCell.CELL_TYPE_FORMULA:
+ // this will never happen, we have already evaluated the formula
+ default:
+ throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");
+ }
+ }
+
+ /**
+ * Loops over all cells in all sheets of the supplied
+ * workbook.
+ * For cells that contain formulas, their formulas are
+ * evaluated, and the results are saved. These cells
+ * remain as formula cells.
+ * For cells that do not contain formulas, no changes
+ * are made.
+ * This is a helpful wrapper around looping over all
+ * cells, and calling evaluateFormulaCell on each one.
+ */
+ public static void evaluateAllFormulaCells(XSSFWorkbook wb) {
+ XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);
+ for(int i=0; i<wb.getNumberOfSheets(); i++) {
+ Sheet sheet = wb.getSheetAt(i);
+
+ for (Iterator<Row> rit = sheet.rowIterator(); rit.hasNext();) {
+ Row r = rit.next();
+
+ for (Iterator cit = r.cellIterator(); cit.hasNext();) {
+ XSSFCell c = (XSSFCell) cit.next();
+ if (c.getCellType() == XSSFCell.CELL_TYPE_FORMULA)
+ evaluator.evaluateFormulaCell(c);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a CellValue wrapper around the supplied ValueEval instance.
+ */
+ private CellValue evaluateFormulaCellValue(Cell cell) {
+ ValueEval eval = _bookEvaluator.evaluate(new XSSFEvaluationCell((XSSFCell) cell));
+ if (eval instanceof NumberEval) {
+ NumberEval ne = (NumberEval) eval;
+ return new CellValue(ne.getNumberValue());
+ }
+ if (eval instanceof BoolEval) {
+ BoolEval be = (BoolEval) eval;
+ return CellValue.valueOf(be.getBooleanValue());
+ }
+ if (eval instanceof StringEval) {
+ StringEval ne = (StringEval) eval;
+ return new CellValue(ne.getStringValue());
+ }
+ if (eval instanceof ErrorEval) {
+ return CellValue.getError(((ErrorEval)eval).getErrorCode());
+ }
+ throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
+ }
+}
* Return the dimension of this image\r
*\r
* @param part the package part holding raw picture data\r
- * @param type type of the picture: {@link Workbook#PICTURE_TYPE_JPEG, Workbook#PICTURE_TYPE_PNG or Workbook#PICTURE_TYPE_DIB)\r
+ * @param type type of the picture: {@link Workbook#PICTURE_TYPE_JPEG},\r
+ * {@link Workbook#PICTURE_TYPE_PNG} or {@link Workbook#PICTURE_TYPE_DIB}\r
*\r
* @return image dimension in pixels\r
*/\r
* Return an integer constant that specifies type of this picture
*
* @return an integer constant that specifies type of this picture
- * @see Workbook#PICTURE_TYPE_EMF
- * @see Workbook#PICTURE_TYPE_WMF
- * @see Workbook#PICTURE_TYPE_PICT
- * @see Workbook#PICTURE_TYPE_JPEG
- * @see Workbook#PICTURE_TYPE_PNG
- * @see Workbook#PICTURE_TYPE_DIB
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_EMF
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_WMF
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_PICT
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_JPEG
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_PNG
+ * @see org.apache.poi.ss.usermodel.Workbook#PICTURE_TYPE_DIB
*/
public int getPictureType(){
String contentType = getPackagePart().getContentType();
/**
* Returns the cell at the given (0 based) index,
- * with the {@link MissingCellPolicy} from the parent Workbook.
+ * with the {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy} from the parent Workbook.
*
* @return the cell at the given (0 based) index
*/
}
/**
- * Returns the cell at the given (0 based) index, with the specified {@link MissingCellPolicy}
+ * Returns the cell at the given (0 based) index, with the specified {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy}
*
* @return the cell at the given (0 based) index
* @throws IllegalArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid
* @param format The format of the picture.
*
* @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} .
- * @see #PICTURE_TYPE_EMF
- * @see #PICTURE_TYPE_WMF
- * @see #PICTURE_TYPE_PICT
- * @see #PICTURE_TYPE_JPEG
- * @see #PICTURE_TYPE_PNG
- * @see #PICTURE_TYPE_DIB
+ * @see Workbook#PICTURE_TYPE_EMF
+ * @see Workbook#PICTURE_TYPE_WMF
+ * @see Workbook#PICTURE_TYPE_PICT
+ * @see Workbook#PICTURE_TYPE_JPEG
+ * @see Workbook#PICTURE_TYPE_PNG
+ * @see Workbook#PICTURE_TYPE_DIB
* @see #getAllPictures()
*/
public int addPicture(byte[] pictureData, int format) {
* @param format The format of the picture.
*
* @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} .
- * @see #PICTURE_TYPE_EMF
- * @see #PICTURE_TYPE_WMF
- * @see #PICTURE_TYPE_PICT
- * @see #PICTURE_TYPE_JPEG
- * @see #PICTURE_TYPE_PNG
- * @see #PICTURE_TYPE_DIB
+ * @see Workbook#PICTURE_TYPE_EMF
+ * @see Workbook#PICTURE_TYPE_WMF
+ * @see Workbook#PICTURE_TYPE_PICT
+ * @see Workbook#PICTURE_TYPE_JPEG
+ * @see Workbook#PICTURE_TYPE_PNG
+ * @see Workbook#PICTURE_TYPE_DIB
* @see #getAllPictures()
*/
public int addPicture(InputStream is, int format) throws IOException {
return this.headerFooter;
}
- /**
- *
- * @return
- */
public String getValue() {
String value = getText();
if(value == null)
/**\r
* Assign a control to this shape\r
*\r
- * @see {@link org.apache.poi.hslf.usermodel.SlideShow#addMovie(String, int)}\r
+ * @see org.apache.poi.hslf.usermodel.SlideShow#addMovie(String, int)\r
* @param idx the index of the movie\r
*/\r
public void setActiveXIndex(int idx){\r
/**\r
* Assign a movie to this shape\r
*\r
- * @see {@link org.apache.poi.hslf.usermodel.SlideShow#addMovie(String, int)}\r
+ * @see org.apache.poi.hslf.usermodel.SlideShow#addMovie(String, int)\r
* @param idx the index of the movie\r
*/\r
public void setMovieIndex(int idx){\r
* 5. CString (4026), Instance ClipboardName (3) that appears in the paste special dialog.\r
* 6. MetaFile( 4033), optional\r
* </p>\r
- * @return\r
*/\r
public ExEmbed getExEmbed(){\r
if(_exEmbed == null){\r
\r
/**\r
* A signed integer that specifies the delay time, in milliseconds, before the animation starts to play.\r
- * If {@link Automatic} is 0x1, this value MUST be greater than or equal to 0; otherwise, this field MUST be ignored.\r
+ * If {@link #Automatic} is 0x1, this value MUST be greater than or equal to 0; otherwise, this field MUST be ignored.\r
*/\r
public int getDelayTime(){\r
return LittleEndian.getInt(_recdata, 12);\r
}\r
/**\r
* A signed integer that specifies the delay time, in milliseconds, before the animation starts to play.\r
- * If {@link Automatic} is 0x1, this value MUST be greater than or equal to 0; otherwise, this field MUST be ignored.\r
+ * If {@link #Automatic} is 0x1, this value MUST be greater than or equal to 0; otherwise, this field MUST be ignored.\r
*/\r
public void setDelayTime(int id){\r
LittleEndian.putInt(_recdata, 12, id);\r
\r
/**\r
* A bit that specifies whether the date is displayed in the footer.\r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasDate = 1;\r
\r
/**\r
* A bit that specifies whether the current datetime is used for displaying the datetime.\r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasTodayDate = 2;\r
\r
* A bit that specifies whether the date specified in UserDateAtom record\r
* is used for displaying the datetime.\r
*\r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasUserDate = 4;\r
\r
/**\r
* A bit that specifies whether the slide number is displayed in the footer.\r
* \r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasSlideNumber = 8;\r
\r
/**\r
* bit that specifies whether the header text is displayed.\r
*\r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasHeader = 16;\r
\r
/**\r
* bit that specifies whether the footer text is displayed.\r
*\r
- * @see {@link #getMask()}, {@link #setMask(int)}},\r
+ * @see #getMask()\r
+ * @see #setMask(int)\r
*/\r
public static final int fHasFooter = 32;\r
\r
/**
* Gets a string value based on the passed chunk.
* @param chunk
- * @return
* @throws ChunkNotFoundException
*/
public String getStringFromChunk(StringChunk chunk) throws ChunkNotFoundException {
/**
* Gets the subject line of the Outlook Message
- * @return
* @throws ChunkNotFoundException
*/
public String getSubject() throws ChunkNotFoundException {
/**
* Gets the display value of the "TO" line of the outlook message
* This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
- * @return
* @throws ChunkNotFoundException
*/
public String getDisplayTo() throws ChunkNotFoundException {
/**
* Gets the display value of the "FROM" line of the outlook message
* This is not the actual address that was sent from but the formated display of the user name.
- * @return
* @throws ChunkNotFoundException
*/
public String getDisplayFrom() throws ChunkNotFoundException {
/**
* Gets the display value of the "TO" line of the outlook message
* This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
- * @return
* @throws ChunkNotFoundException
*/
public String getDisplayCC() throws ChunkNotFoundException {
/**
* Gets the display value of the "TO" line of the outlook message
* This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
- * @return
* @throws ChunkNotFoundException
*/
public String getDisplayBCC() throws ChunkNotFoundException {
/**
* Gets the conversation topic of the parsed Outlook Message.
* This is the part of the subject line that is after the RE: and FWD:
- * @return
* @throws ChunkNotFoundException
*/
public String getConversationTopic() throws ChunkNotFoundException {
* (Yes, you can use this to determine if a message is a calendar item, note, or actual outlook Message)
* For emails the class will be IPM.Note
*
- * @return
* @throws ChunkNotFoundException
*/
public String getMessageClass() throws ChunkNotFoundException {
/**
* Gets the id of this chunk
- * @return
*/
public int getChunkId() {
return this.chunkId;
/**
* Gets the numeric type of this chunk.
- * @return
*/
public int getType() {
return this.type;
/**
* Creates a string to use to identify this chunk in the POI file system object.
- * @return
*/
public String getEntryName() {
String type = Integer.toHexString(this.type);
/**
* Gets a reference to a ByteArrayOutputStream that contains the value of this chunk.
- * @return
*/
public abstract ByteArrayOutputStream getValueByteArray();
/**
* Get a reference to the FileSystem object that this object is currently using.
- * @return
*/
public POIFSFileSystem getFileSystem() {
return this.fs;
/**
* Pull the chunk data that's stored in this object's hashmap out and return it as a HashMap.
* @param entryName
- * @return
*/
public Object getChunk(HashMap dirMap, String entryName) {
if(dirMap == null) return null;
/**
* Pulls a ByteArrayOutputStream from this objects HashMap, this can be used to read a byte array of the contents of the given chunk.
- * @param directoryMap, chunk
- * @return
+ * @param dirNode
+ * @param chunk
* @throws ChunkNotFoundException
*/
public Chunk getDocumentNode(HashMap dirNode, Chunk chunk) throws ChunkNotFoundException {
/**
* Pulls a Chunk out of this objects root Node tree.
* @param chunk
- * @return
* @throws ChunkNotFoundException
*/
public Chunk getDocumentNode(Chunk chunk) throws ChunkNotFoundException {
/**
*
- * @param document
+ * @param _document
* @param _dataStream
*/
public PicturesTable(HWPFDocument _document, byte[] _dataStream, byte[] _mainStream, FSPATable fspa, EscherRecordHolder dgg)
* Works only in characters, not in bytes!
* @param start Local start position, in characters
* @param end Local end position, in characters
- * @return
*/
public String substring(int start, int end)
{
* In a very evil fashion, you have to actually
* know this to make sense of character and
* paragraph properties :(
- * @param cp The character offset to check about
+ * @param bytePos The character offset to check about
*/
public boolean isUnicodeAtByteOffset(int bytePos) {
boolean lastWas = false;
* Returns the correct, defined header for the given
* one based page
* @param pageNumber The one based page number
- * @return
*/
public String getHeader(int pageNumber) {
// First page header is optional, only return
* Returns the correct, defined footer for the given
* one based page
* @param pageNumber The one based page number
- * @return
*/
public String getFooter(int pageNumber) {
// First page footer is optional, only return
}
/**
- * {@link HSSFFormulaEvaluator#evaluate(HSSFCell)} should behave the same whether the cell
+ * {@link HSSFFormulaEvaluator#evaluate(org.apache.poi.ss.usermodel.Cell)} should behave the same whether the cell
* is <code>null</code> or blank.
*/
public void testEvaluateBlank() {
import org.apache.poi.hssf.record.formula.eval.ValueEval;
/**
- * Tests {@link CellCacheEntry}.
+ * Tests {@link org.apache.poi.ss.formula.CellCacheEntry}.
*
* @author Josh Micich
*/
import org.apache.poi.ss.usermodel.CellValue;
/**
- * Tests {@link EvaluationCache}. Makes sure that where possible (previously calculated) cached
+ * Tests {@link org.apache.poi.ss.formula.EvaluationCache}. Makes sure that where possible (previously calculated) cached
* values are used. Also checks that changing cell values causes the correct (minimal) set of
* dependent cached values to be cleared.
*