aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2009-04-08 17:51:33 +0000
committerYegor Kozlov <yegor@apache.org>2009-04-08 17:51:33 +0000
commit0c1095db7616a38a6f320d8a1fd15b149f9c59d8 (patch)
tree375e9bbd7b53fedd94d8abb8b5182daf3c95d075 /src/java/org/apache/poi
parentb302384e4dafd948df99e4ef79f187460c02358f (diff)
downloadpoi-0c1095db7616a38a6f320d8a1fd15b149f9c59d8.tar.gz
poi-0c1095db7616a38a6f320d8a1fd15b149f9c59d8.zip
moved common interfaces from src/ooxml/interfaces-jdk15 to src/java, they do belong there
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@763332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/common/usermodel/Fill.java24
-rw-r--r--src/java/org/apache/poi/common/usermodel/Hyperlink.java78
-rw-r--r--src/java/org/apache/poi/common/usermodel/LineStyle.java21
-rw-r--r--src/java/org/apache/poi/ss/extractor/ExcelExtractor.java44
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/BorderStyle.java111
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Cell.java359
-rw-r--r--src/java/org/apache/poi/ss/usermodel/CellStyle.java684
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/ClientAnchor.java202
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Comment.java90
-rw-r--r--src/java/org/apache/poi/ss/usermodel/CreationHelper.java56
-rw-r--r--src/java/org/apache/poi/ss/usermodel/DataFormat.java35
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/Drawing.java24
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FillPatternType.java83
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Font.java277
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FontCharset.java75
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FontFamily.java62
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FontScheme.java57
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FontUnderline.java121
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Footer.java63
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/FormulaError.java140
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Header.java69
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/HorizontalAlignment.java95
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Hyperlink.java78
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/IndexedColors.java97
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Name.java184
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/PageOrder.java59
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/PaperSize.java43
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/Picture.java42
-rw-r--r--src/java/org/apache/poi/ss/usermodel/PictureData.java36
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/PrintCellComments.java61
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/PrintOrientation.java63
-rw-r--r--src/java/org/apache/poi/ss/usermodel/PrintSetup.java256
-rw-r--r--src/java/org/apache/poi/ss/usermodel/RichTextString.java88
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Row.java210
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/ShapeTypes.java212
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Sheet.java783
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Textbox.java74
-rwxr-xr-xsrc/java/org/apache/poi/ss/usermodel/VerticalAlignment.java69
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Workbook.java465
39 files changed, 5590 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/common/usermodel/Fill.java b/src/java/org/apache/poi/common/usermodel/Fill.java
new file mode 100644
index 0000000000..9e1ab4521b
--- /dev/null
+++ b/src/java/org/apache/poi/common/usermodel/Fill.java
@@ -0,0 +1,24 @@
+/* ====================================================================
+ 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.common.usermodel;
+
+import java.awt.Color;
+
+public interface Fill {
+ public Color getColor();
+ public void setColor(Color color);
+}
diff --git a/src/java/org/apache/poi/common/usermodel/Hyperlink.java b/src/java/org/apache/poi/common/usermodel/Hyperlink.java
new file mode 100644
index 0000000000..90e26927bf
--- /dev/null
+++ b/src/java/org/apache/poi/common/usermodel/Hyperlink.java
@@ -0,0 +1,78 @@
+/* ====================================================================
+ 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.common.usermodel;
+
+/**
+ * Represents a hyperlink.
+ */
+public interface Hyperlink {
+ /**
+ * Link to a existing file or web page
+ */
+ public static final int LINK_URL = 1;
+
+ /**
+ * Link to a place in this document
+ */
+ public static final int LINK_DOCUMENT = 2;
+
+ /**
+ * Link to an E-mail address
+ */
+ public static final int LINK_EMAIL = 3;
+
+ /**
+ * Link to a file
+ */
+ public static final int LINK_FILE = 4;
+
+
+ /**
+ * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.
+ *
+ * @return the address of this hyperlink
+ */
+ public String getAddress();
+
+ /**
+ * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc.
+ *
+ * @param address the address of this hyperlink
+ */
+ public void setAddress(String address);
+
+ /**
+ * Return text label for this hyperlink
+ *
+ * @return text to display
+ */
+ public String getLabel();
+
+ /**
+ * Sets text label for this hyperlink
+ *
+ * @param label text label for this hyperlink
+ */
+ public void setLabel(String label);
+
+ /**
+ * Return the type of this hyperlink
+ *
+ * @return the type of this hyperlink
+ */
+ public int getType();
+}
diff --git a/src/java/org/apache/poi/common/usermodel/LineStyle.java b/src/java/org/apache/poi/common/usermodel/LineStyle.java
new file mode 100644
index 0000000000..db676f529a
--- /dev/null
+++ b/src/java/org/apache/poi/common/usermodel/LineStyle.java
@@ -0,0 +1,21 @@
+/* ====================================================================
+ 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.common.usermodel;
+
+public interface LineStyle {
+
+}
diff --git a/src/java/org/apache/poi/ss/extractor/ExcelExtractor.java b/src/java/org/apache/poi/ss/extractor/ExcelExtractor.java
new file mode 100644
index 0000000000..8817bc7e29
--- /dev/null
+++ b/src/java/org/apache/poi/ss/extractor/ExcelExtractor.java
@@ -0,0 +1,44 @@
+/* ====================================================================
+ 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.ss.extractor;
+
+/**
+ * Common interface for Excel text extractors, covering
+ * HSSF and XSSF
+ */
+public interface ExcelExtractor {
+ /**
+ * Should sheet names be included? Default is true
+ */
+ public void setIncludeSheetNames(boolean includeSheetNames);
+
+ /**
+ * Should we return the formula itself, and not
+ * the result it produces? Default is false
+ */
+ public void setFormulasNotResults(boolean formulasNotResults);
+
+ /**
+ * Should cell comments be included? Default is false
+ */
+ public void setIncludeCellComments(boolean includeCellComments);
+
+ /**
+ * Retreives the text contents of the file
+ */
+ public String getText();
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/BorderStyle.java b/src/java/org/apache/poi/ss/usermodel/BorderStyle.java
new file mode 100755
index 0000000000..7342c52261
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/BorderStyle.java
@@ -0,0 +1,111 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * The enumeration value indicating the line style of a border in a cell,
+ * i.e., whether it is borded dash dot, dash dot dot, dashed, dotted, double, hair, medium,
+ * medium dash dot, medium dash dot dot, medium dashed, none, slant dash dot, thick or thin.
+ */
+ public enum BorderStyle {
+
+ /**
+ * No border
+ */
+
+ NONE,
+
+ /**
+ * Thin border
+ */
+
+ THIN,
+
+ /**
+ * Medium border
+ */
+
+ MEDIUM,
+
+ /**
+ * dash border
+ */
+
+ DASHED,
+
+ /**
+ * dot border
+ */
+
+ HAIR,
+
+ /**
+ * Thick border
+ */
+
+ THICK,
+
+ /**
+ * double-line border
+ */
+
+ DOUBLE,
+
+ /**
+ * hair-line border
+ */
+
+ DOTTED,
+
+ /**
+ * Medium dashed border
+ */
+
+ MEDIUM_DASHED,
+
+ /**
+ * dash-dot border
+ */
+
+ DASH_DOT,
+
+ /**
+ * medium dash-dot border
+ */
+
+ MEDIUM_DASH_DOT,
+
+ /**
+ * dash-dot-dot border
+ */
+
+ DASH_DOT_DOT,
+
+ /**
+ * medium dash-dot-dot border
+ */
+
+ MEDIUM_DASH_DOT_DOTC,
+
+ /**
+ * slanted dash-dot border
+ */
+
+ SLANTED_DASH_DOT;
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Cell.java b/src/java/org/apache/poi/ss/usermodel/Cell.java
new file mode 100644
index 0000000000..aa1e8c3955
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Cell.java
@@ -0,0 +1,359 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * High level representation of a cell in a row of a spreadsheet.
+ * <p>
+ * Cells can be numeric, formula-based or string-based (text). The cell type
+ * specifies this. String cells cannot conatin numbers and numeric cells cannot
+ * contain strings (at least according to our model). Client apps should do the
+ * conversions themselves. Formula cells have the formula string, as well as
+ * the formula result, which can be numeric or string.
+ * </p>
+ * <p>
+ * Cells should have their number (0 based) before being added to a row.
+ * </p>
+ */
+public interface Cell {
+
+ /**
+ * Numeric Cell type (0)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_NUMERIC = 0;
+
+ /**
+ * String Cell type (1)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_STRING = 1;
+
+ /**
+ * Formula Cell type (2)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_FORMULA = 2;
+
+ /**
+ * Blank Cell type (3)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_BLANK = 3;
+
+ /**
+ * Boolean Cell type (4)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_BOOLEAN = 4;
+
+ /**
+ * Error Cell type (5)
+ * @see #setCellType(int)
+ * @see #getCellType()
+ */
+ public final static int CELL_TYPE_ERROR = 5;
+
+ /**
+ * Returns column index of this cell
+ *
+ * @return zero-based column index of a column in a sheet.
+ */
+ int getColumnIndex();
+
+ /**
+ * Returns row index of a row in the sheet that contains this cell
+ *
+ * @return zero-based row index of a row in the sheet that contains this cell
+ */
+ int getRowIndex();
+
+ /**
+ * Returns the sheet this cell belongs to
+ *
+ * @return the sheet this cell belongs to
+ */
+ Sheet getSheet();
+
+ /**
+ * Returns the Row this cell belongs to
+ *
+ * @return the Row that owns this cell
+ */
+ Row getRow();
+
+ /**
+ * Set the cells type (numeric, formula or string)
+ *
+ * @throws IllegalArgumentException if the specified cell type is invalid
+ * @see #CELL_TYPE_NUMERIC
+ * @see #CELL_TYPE_STRING
+ * @see #CELL_TYPE_FORMULA
+ * @see #CELL_TYPE_BLANK
+ * @see #CELL_TYPE_BOOLEAN
+ * @see #CELL_TYPE_ERROR
+ */
+ void setCellType(int cellType);
+
+ /**
+ * Return the cell type.
+ *
+ * @return the cell type
+ * @see Cell#CELL_TYPE_BLANK
+ * @see Cell#CELL_TYPE_NUMERIC
+ * @see Cell#CELL_TYPE_STRING
+ * @see Cell#CELL_TYPE_FORMULA
+ * @see Cell#CELL_TYPE_BOOLEAN
+ * @see Cell#CELL_TYPE_ERROR
+ */
+ int getCellType();
+
+ /**
+ * Only valid for formula cells
+ * @return one of ({@link #CELL_TYPE_NUMERIC}, {@link #CELL_TYPE_STRING},
+ * {@link #CELL_TYPE_BOOLEAN}, {@link #CELL_TYPE_ERROR}) depending
+ * on the cached value of the formula
+ */
+ int getCachedFormulaResultType();
+
+ /**
+ * Set a numeric value for the cell
+ *
+ * @param value the numeric value to set this cell to. For formulas we'll set the
+ * precalculated value, for numerics we'll set its value. For other types we
+ * will change the cell to a numeric cell and set its value.
+ */
+ void setCellValue(double value);
+
+ /**
+ * Set a boolean value for the cell
+ *
+ * @param value the boolean value to set this cell to. For formulas we'll set the
+ * precalculated value, for booleans we'll set its value. For other types we
+ * will change the cell to a boolean cell and set its value.
+ */
+ void setCellValue(Date value);
+
+ /**
+ * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as
+ * a date.
+ * <p>
+ * This will set the cell value based on the Calendar's timezone. As Excel
+ * does not support timezones this means that both 20:00+03:00 and
+ * 20:00-03:00 will be reported as the same value (20:00) even that there
+ * are 6 hours difference between the two times. This difference can be
+ * preserved by using <code>setCellValue(value.getTime())</code> which will
+ * automatically shift the times to the default timezone.
+ * </p>
+ *
+ * @param value the date value to set this cell to. For formulas we'll set the
+ * precalculated value, for numerics we'll set its value. For othertypes we
+ * will change the cell to a numeric cell and set its value.
+ */
+ void setCellValue(Calendar value);
+
+ /**
+ * Set a rich string value for the cell.
+ *
+ * @param value value to set the cell to. For formulas we'll set the formula
+ * string, for String cells we'll set its value. For other types we will
+ * change the cell to a string cell and set its value.
+ * If value is null then we will change the cell to a Blank cell.
+ */
+ void setCellValue(RichTextString value);
+
+ /**
+ * Set a string value for the cell.
+ *
+ * @param value value to set the cell to. For formulas we'll set the formula
+ * string, for String cells we'll set its value. For other types we will
+ * change the cell to a string cell and set its value.
+ * If value is null then we will change the cell to a Blank cell.
+ */
+ void setCellValue(String value);
+
+ /**
+ * Sets formula for this cell.
+ * <p>
+ * Note, this method only sets the formula string and does not calculate the formula value.
+ * To set the precalculated value use {@link #setCellValue(double)} or {@link #setCellValue(String)}
+ * </p>
+ *
+ * @param formula the formula to set, e.g. <code>SUM(C4:E4)</code>.
+ * If the argument is <code>null</code> then the current formula is removed.
+ * @throws IllegalArgumentException if the formula is unparsable
+ */
+ void setCellFormula(String formula);
+
+ /**
+ * Return a formula for the cell, for example, <code>SUM(C4:E4)</code>
+ *
+ * @return a formula for the cell
+ * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is not CELL_TYPE_FORMULA
+ */
+ String getCellFormula();
+
+ /**
+ * Get the value of the cell as a number.
+ * <p>
+ * For strings we throw an exception. For blank cells we return a 0.
+ * For formulas or error cells we return the precalculated value;
+ * </p>
+ * @return the value of the cell as a number
+ * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CELL_TYPE_STRING
+ * @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
+ * @see DataFormatter for turning this number into a string similar to that which Excel would render this number as.
+ */
+ double getNumericCellValue();
+
+ /**
+ * Get the value of the cell as a date.
+ * <p>
+ * For strings we throw an exception. For blank cells we return a null.
+ * </p>
+ * @return the value of the cell as a date
+ * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CELL_TYPE_STRING
+ * @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
+ * @see DataFormatter for formatting this date into a string similar to how excel does.
+ */
+ Date getDateCellValue();
+
+ /**
+ * Get the value of the cell as a XSSFRichTextString
+ * <p>
+ * For numeric cells we throw an exception. For blank cells we return an empty string.
+ * For formula cells we return the pre-calculated value.
+ * </p>
+ * @return the value of the cell as a XSSFRichTextString
+ */
+ RichTextString getRichStringCellValue();
+
+ /**
+ * Get the value of the cell as a string
+ * <p>
+ * For numeric cells we throw an exception. For blank cells we return an empty string.
+ * For formulaCells that are not string Formulas, we return empty String.
+ * </p>
+ * @return the value of the cell as a string
+ */
+ String getStringCellValue();
+
+ /**
+ * Set a boolean value for the cell
+ *
+ * @param value the boolean value to set this cell to. For formulas we'll set the
+ * precalculated value, for booleans we'll set its value. For other types we
+ * will change the cell to a boolean cell and set its value.
+ */
+ void setCellValue(boolean value);
+
+ /**
+ * Set a error value for the cell
+ *
+ * @param value the error value to set this cell to. For formulas we'll set the
+ * precalculated value , for errors we'll set
+ * its value. For other types we will change the cell to an error
+ * cell and set its value.
+ * @see FormulaError
+ */
+ void setCellErrorValue(byte value);
+
+ /**
+ * Get the value of the cell as a boolean.
+ * <p>
+ * For strings, numbers, and errors, we throw an exception. For blank cells we return a false.
+ * </p>
+ * @return the value of the cell as a boolean
+ * @throws IllegalStateException if the cell type returned by {@link #getCellType()}
+ * is not CELL_TYPE_BOOLEAN, CELL_TYPE_BLANK or CELL_TYPE_FORMULA
+ */
+ boolean getBooleanCellValue();
+
+ /**
+ * Get the value of the cell as an error code.
+ * <p>
+ * For strings, numbers, and booleans, we throw an exception.
+ * For blank cells we return a 0.
+ * </p>
+ *
+ * @return the value of the cell as an error code
+ * @throws IllegalStateException if the cell type returned by {@link #getCellType()} isn't CELL_TYPE_ERROR
+ * @see FormulaError for error codes
+ */
+ byte getErrorCellValue();
+
+ /**
+ * Set the style for the cell. The style should be an CellStyle created/retreived from
+ * the Workbook.
+ *
+ * @param style reference contained in the workbook.
+ * If the value is null then the style information is removed causing the cell to used the default workbook style.
+ * @see org.apache.poi.ss.usermodel.Workbook#createCellStyle()
+ */
+ void setCellStyle(CellStyle style);
+
+ /**
+ * Return the cell's style.
+ *
+ * @return the cell's style. Always not-null. Default cell style has zero index and can be obtained as
+ * <code>workbook.getCellStyleAt(0)</code>
+ * @see Workbook#getCellStyleAt(short)
+ */
+ CellStyle getCellStyle();
+
+ /**
+ * Sets this cell as the active cell for the worksheet
+ */
+ void setAsActiveCell();
+
+ /**
+ * Assign a comment to this cell
+ *
+ * @param comment comment associated with this cell
+ */
+ void setCellComment(Comment comment);
+
+ /**
+ * Returns comment associated with this cell
+ *
+ * @return comment associated with this cell or <code>null</code> if not found
+ */
+ Comment getCellComment();
+
+ /**
+ * Returns hyperlink associated with this cell
+ *
+ * @return hyperlink associated with this cell or <code>null</code> if not found
+ */
+ Hyperlink getHyperlink();
+
+ /**
+ * Assign a hypelrink to this cell
+ *
+ * @param link hypelrink associated with this cell
+ */
+ void setHyperlink(Hyperlink link);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java
new file mode 100644
index 0000000000..ec4fd3b377
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java
@@ -0,0 +1,684 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface CellStyle {
+
+ /**
+ * general (normal) horizontal alignment
+ */
+
+ public final static short ALIGN_GENERAL = 0x0;
+
+ /**
+ * left-justified horizontal alignment
+ */
+
+ public final static short ALIGN_LEFT = 0x1;
+
+ /**
+ * center horizontal alignment
+ */
+
+ public final static short ALIGN_CENTER = 0x2;
+
+ /**
+ * right-justified horizontal alignment
+ */
+
+ public final static short ALIGN_RIGHT = 0x3;
+
+ /**
+ * fill? horizontal alignment
+ */
+
+ public final static short ALIGN_FILL = 0x4;
+
+ /**
+ * justified horizontal alignment
+ */
+
+ public final static short ALIGN_JUSTIFY = 0x5;
+
+ /**
+ * center-selection? horizontal alignment
+ */
+
+ public final static short ALIGN_CENTER_SELECTION = 0x6;
+
+ /**
+ * top-aligned vertical alignment
+ */
+
+ public final static short VERTICAL_TOP = 0x0;
+
+ /**
+ * center-aligned vertical alignment
+ */
+
+ public final static short VERTICAL_CENTER = 0x1;
+
+ /**
+ * bottom-aligned vertical alignment
+ */
+
+ public final static short VERTICAL_BOTTOM = 0x2;
+
+ /**
+ * vertically justified vertical alignment
+ */
+
+ public final static short VERTICAL_JUSTIFY = 0x3;
+
+ /**
+ * No border
+ */
+
+ public final static short BORDER_NONE = 0x0;
+
+ /**
+ * Thin border
+ */
+
+ public final static short BORDER_THIN = 0x1;
+
+ /**
+ * Medium border
+ */
+
+ public final static short BORDER_MEDIUM = 0x2;
+
+ /**
+ * dash border
+ */
+
+ public final static short BORDER_DASHED = 0x3;
+
+ /**
+ * dot border
+ */
+
+ public final static short BORDER_HAIR = 0x4;
+
+ /**
+ * Thick border
+ */
+
+ public final static short BORDER_THICK = 0x5;
+
+ /**
+ * double-line border
+ */
+
+ public final static short BORDER_DOUBLE = 0x6;
+
+ /**
+ * hair-line border
+ */
+
+ public final static short BORDER_DOTTED = 0x7;
+
+ /**
+ * Medium dashed border
+ */
+
+ public final static short BORDER_MEDIUM_DASHED = 0x8;
+
+ /**
+ * dash-dot border
+ */
+
+ public final static short BORDER_DASH_DOT = 0x9;
+
+ /**
+ * medium dash-dot border
+ */
+
+ public final static short BORDER_MEDIUM_DASH_DOT = 0xA;
+
+ /**
+ * dash-dot-dot border
+ */
+
+ public final static short BORDER_DASH_DOT_DOT = 0xB;
+
+ /**
+ * medium dash-dot-dot border
+ */
+
+ public final static short BORDER_MEDIUM_DASH_DOT_DOT = 0xC;
+
+ /**
+ * slanted dash-dot border
+ */
+
+ public final static short BORDER_SLANTED_DASH_DOT = 0xD;
+
+ /** No background */
+ public final static short NO_FILL = 0;
+
+ /** Solidly filled */
+ public final static short SOLID_FOREGROUND = 1;
+
+ /** Small fine dots */
+ public final static short FINE_DOTS = 2;
+
+ /** Wide dots */
+ public final static short ALT_BARS = 3;
+
+ /** Sparse dots */
+ public final static short SPARSE_DOTS = 4;
+
+ /** Thick horizontal bands */
+ public final static short THICK_HORZ_BANDS = 5;
+
+ /** Thick vertical bands */
+ public final static short THICK_VERT_BANDS = 6;
+
+ /** Thick backward facing diagonals */
+ public final static short THICK_BACKWARD_DIAG = 7;
+
+ /** Thick forward facing diagonals */
+ public final static short THICK_FORWARD_DIAG = 8;
+
+ /** Large spots */
+ public final static short BIG_SPOTS = 9;
+
+ /** Brick-like layout */
+ public final static short BRICKS = 10;
+
+ /** Thin horizontal bands */
+ public final static short THIN_HORZ_BANDS = 11;
+
+ /** Thin vertical bands */
+ public final static short THIN_VERT_BANDS = 12;
+
+ /** Thin backward diagonal */
+ public final static short THIN_BACKWARD_DIAG = 13;
+
+ /** Thin forward diagonal */
+ public final static short THIN_FORWARD_DIAG = 14;
+
+ /** Squares */
+ public final static short SQUARES = 15;
+
+ /** Diamonds */
+ public final static short DIAMONDS = 16;
+
+ /** Less Dots */
+ public final static short LESS_DOTS = 17;
+
+ /** Least Dots */
+ public final static short LEAST_DOTS = 18;
+
+ /**
+ * get the index within the Workbook (sequence within the collection of ExtnededFormat objects)
+ * @return unique index number of the underlying record this style represents (probably you don't care
+ * unless you're comparing which one is which)
+ */
+
+ short getIndex();
+
+ /**
+ * set the data format (must be a valid format)
+ * @see DataFormat
+ */
+
+ void setDataFormat(short fmt);
+
+ /**
+ * get the index of the format
+ * @see DataFormat
+ */
+ short getDataFormat();
+
+ /**
+ * Get the format string
+ */
+ public String getDataFormatString();
+
+ /**
+ * set the font for this style
+ * @param font a font object created or retreived from the Workbook object
+ * @see Workbook#createFont()
+ * @see Workbook#getFontAt(short)
+ */
+
+ void setFont(Font font);
+
+ /**
+ * gets the index of the font for this style
+ * @see Workbook#getFontAt(short)
+ */
+ short getFontIndex();
+
+ /**
+ * set the cell's using this style to be hidden
+ * @param hidden - whether the cell using this style should be hidden
+ */
+
+ void setHidden(boolean hidden);
+
+ /**
+ * get whether the cell's using this style are to be hidden
+ * @return hidden - whether the cell using this style should be hidden
+ */
+
+ boolean getHidden();
+
+ /**
+ * set the cell's using this style to be locked
+ * @param locked - whether the cell using this style should be locked
+ */
+
+ void setLocked(boolean locked);
+
+ /**
+ * get whether the cell's using this style are to be locked
+ * @return hidden - whether the cell using this style should be locked
+ */
+
+ boolean getLocked();
+
+ /**
+ * 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
+ */
+
+ void setAlignment(short align);
+
+ /**
+ * get the type of horizontal alignment for the cell
+ * @return 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
+ */
+
+ short getAlignment();
+
+ /**
+ * Set whether the text should be wrapped.
+ * Setting this flag to <code>true</code> make all content visible
+ * whithin a cell by displaying it on multiple lines
+ *
+ * @param wrapped wrap text or not
+ */
+
+ void setWrapText(boolean wrapped);
+
+ /**
+ * get whether the text should be wrapped
+ * @return wrap text or not
+ */
+
+ boolean getWrapText();
+
+ /**
+ * set the type of vertical alignment for the cell
+ * @param align the type of alignment
+ * @see #VERTICAL_TOP
+ * @see #VERTICAL_CENTER
+ * @see #VERTICAL_BOTTOM
+ * @see #VERTICAL_JUSTIFY
+ */
+
+ void setVerticalAlignment(short align);
+
+ /**
+ * get the type of vertical alignment for the cell
+ * @return align the type of alignment
+ * @see #VERTICAL_TOP
+ * @see #VERTICAL_CENTER
+ * @see #VERTICAL_BOTTOM
+ * @see #VERTICAL_JUSTIFY
+ */
+
+ short getVerticalAlignment();
+
+ /**
+ * set the degree of rotation for the text in the cell
+ * @param rotation degrees (between -90 and 90 degrees)
+ */
+
+ void setRotation(short rotation);
+
+ /**
+ * get the degree of rotation for the text in the cell
+ * @return rotation degrees (between -90 and 90 degrees)
+ */
+
+ short getRotation();
+
+ /**
+ * set the number of spaces to indent the text in the cell
+ * @param indent - number of spaces
+ */
+
+ void setIndention(short indent);
+
+ /**
+ * get the number of spaces to indent the text in the cell
+ * @return indent - number of spaces
+ */
+
+ short getIndention();
+
+ /**
+ * set the type of border to use for the left border of the cell
+ * @param 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
+ */
+
+ void setBorderLeft(short border);
+
+ /**
+ * get the type of border to use for the left border of the cell
+ * @return 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
+ */
+
+ short getBorderLeft();
+
+ /**
+ * set the type of border to use for the right border of the cell
+ * @param 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
+ */
+
+ void setBorderRight(short border);
+
+ /**
+ * get the type of border to use for the right border of the cell
+ * @return 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
+ */
+
+ short getBorderRight();
+
+ /**
+ * set the type of border to use for the top border of the cell
+ * @param 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
+ */
+
+ void setBorderTop(short border);
+
+ /**
+ * get the type of border to use for the top border of the cell
+ * @return 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
+ */
+
+ short getBorderTop();
+
+ /**
+ * set the type of border to use for the bottom border of the cell
+ * @param 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
+ */
+
+ void setBorderBottom(short border);
+
+ /**
+ * get the type of border to use for the bottom border of the cell
+ * @return 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
+ */
+ short getBorderBottom();
+
+ /**
+ * set the color to use for the left border
+ * @param color The index of the color definition
+ */
+ void setLeftBorderColor(short color);
+
+ /**
+ * get the color to use for the left border
+ */
+ short getLeftBorderColor();
+
+ /**
+ * set the color to use for the right border
+ * @param color The index of the color definition
+ */
+ void setRightBorderColor(short color);
+
+ /**
+ * get the color to use for the left border
+ * @return the index of the color definition
+ */
+ short getRightBorderColor();
+
+ /**
+ * set the color to use for the top border
+ * @param color The index of the color definition
+ */
+ void setTopBorderColor(short color);
+
+ /**
+ * get the color to use for the top border
+ * @return hhe index of the color definition
+ */
+ short getTopBorderColor();
+
+ /**
+ * set the color to use for the bottom border
+ * @param color The index of the color definition
+ */
+ void setBottomBorderColor(short color);
+
+ /**
+ * get the color to use for the left border
+ * @return the index of the color definition
+ */
+ short getBottomBorderColor();
+
+ /**
+ * setting to one fills the cell with the foreground color... No idea about
+ * other values
+ *
+ * @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
+ *
+ * @param fp fill pattern (set to 1 to fill w/foreground color)
+ */
+ void setFillPattern(short fp);
+
+ /**
+ * get the fill pattern (??) - set to 1 to fill with foreground color
+ * @return fill pattern
+ */
+
+ short getFillPattern();
+
+ /**
+ * set the background fill color.
+ *
+ * @param bg color
+ */
+
+ void setFillBackgroundColor(short bg);
+
+ /**
+ * get the background fill color
+ * @return fill color
+ */
+ short getFillBackgroundColor();
+
+ /**
+ * set the foreground fill color
+ * <i>Note: Ensure Foreground color is set prior to background color.</i>
+ * @param bg color
+ */
+ void setFillForegroundColor(short bg);
+
+ /**
+ * get the foreground fill color
+ * @return fill color
+ */
+ short getFillForegroundColor();
+
+ /**
+ * Clones all the style information from another
+ * CellStyle, onto this one. This
+ * CellStyle will then have all the same
+ * properties as the source, but the two may
+ * be edited independently.
+ * Any stylings on this CellStyle will be lost!
+ *
+ * The source CellStyle could be from another
+ * Workbook if you like. This allows you to
+ * copy styles from one Workbook to another.
+ *
+ * However, both of the CellStyles will need
+ * to be of the same type (HSSFCellStyle or
+ * XSSFCellStyle)
+ */
+ public void cloneStyleFrom(CellStyle source);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java b/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
new file mode 100755
index 0000000000..6a51a7288c
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
@@ -0,0 +1,202 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * A client anchor is attached to an excel worksheet. It anchors against a
+ * top-left and bottom-right cell.
+ *
+ * @author Yegor Kozlov
+ */
+public interface ClientAnchor {
+ /**
+ * Move and Resize With Anchor Cells
+ * <p>
+ * Specifies that the current drawing shall move and
+ * resize to maintain its row and column anchors (i.e. the
+ * object is anchored to the actual from and to row and column)
+ * </p>
+ */
+ public static final int MOVE_AND_RESIZE = 0;
+
+ /**
+ * Move With Cells but Do Not Resize
+ * <p>
+ * Specifies that the current drawing shall move with its
+ * row and column (i.e. the object is anchored to the
+ * actual from row and column), but that the size shall remain absolute.
+ * </p>
+ * <p>
+ * If additional rows/columns are added between the from and to locations of the drawing,
+ * the drawing shall move its to anchors as needed to maintain this same absolute size.
+ * </p>
+ */
+ public static final int MOVE_DONT_RESIZE = 2;
+
+ /**
+ * Do Not Move or Resize With Underlying Rows/Columns
+ * <p>
+ * Specifies that the current start and end positions shall
+ * be maintained with respect to the distances from the
+ * absolute start point of the worksheet.
+ * </p>
+ * <p>
+ * If additional rows/columns are added before the
+ * drawing, the drawing shall move its anchors as needed
+ * to maintain this same absolute position.
+ * </p>
+ */
+ public static final int DONT_MOVE_AND_RESIZE = 3;
+
+ /**
+ * Returns the column (0 based) of the first cell.
+ *
+ * @return 0-based column of the first cell.
+ */
+ public short getCol1();
+
+ /**
+ * Sets the column (0 based) of the first cell.
+ *
+ * @param col1 0-based column of the first cell.
+ */
+ public void setCol1(int col1);
+
+ /**
+ * Returns the column (0 based) of the second cell.
+ *
+ * @return 0-based column of the second cell.
+ */
+ public short getCol2();
+
+ /**
+ * Returns the column (0 based) of the second cell.
+ *
+ * @param col2 0-based column of the second cell.
+ */
+ public void setCol2(int col2);
+
+ /**
+ * Returns the row (0 based) of the first cell.
+ *
+ * @return 0-based row of the first cell.
+ */
+ public int getRow1();
+
+ /**
+ * Returns the row (0 based) of the first cell.
+ *
+ * @param row1 0-based row of the first cell.
+ */
+ public void setRow1(int row1);
+
+ /**
+ * Returns the row (0 based) of the second cell.
+ *
+ * @return 0-based row of the second cell.
+ */
+ public int getRow2();
+
+ /**
+ * Returns the row (0 based) of the first cell.
+ *
+ * @param row2 0-based row of the first cell.
+ */
+ public void setRow2(int row2);
+
+ /**
+ * Returns the x coordinate within the first cell
+ *
+ * @return the x coordinate within the first cell
+ */
+ public int getDx1();
+
+ /**
+ * Sets the x coordinate within the first cell
+ *
+ * @param dx1 the x coordinate within the first cell
+ */
+ public void setDx1(int dx1);
+
+ /**
+ * Returns the y coordinate within the first cell
+ *
+ * @return the y coordinate within the first cell
+ */
+ public int getDy1();
+
+ /**
+ * Sets the y coordinate within the first cell
+ *
+ * @param dy1 the y coordinate within the first cell
+ */
+ public void setDy1(int dy1);
+
+ /**
+ * Sets the y coordinate within the second cell
+ *
+ * @return the y coordinate within the second cell
+ */
+ public int getDy2();
+
+ /**
+ * Sets the y coordinate within the second cell
+ *
+ * @param dy2 the y coordinate within the second cell
+ */
+ public void setDy2(int dy2);
+
+ /**
+ * Returns the x coordinate within the second cell
+ *
+ * @return the x coordinate within the second cell
+ */
+ public int getDx2();
+
+ /**
+ * Sets the x coordinate within the second cell
+ *
+ * @param dx2 the x coordinate within the second cell
+ */
+ public void setDx2(int dx2);
+
+
+ /**
+ * Sets the anchor type
+ * <p>
+ * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+ * </p>
+ * @param anchorType the anchor type
+ * @see #MOVE_AND_RESIZE
+ * @see #MOVE_DONT_RESIZE
+ * @see #DONT_MOVE_AND_RESIZE
+ */
+ public void setAnchorType( int anchorType );
+
+ /**
+ * Gets the anchor type
+ * <p>
+ * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+ * </p>
+ * @return the anchor type
+ * @see #MOVE_AND_RESIZE
+ * @see #MOVE_DONT_RESIZE
+ * @see #DONT_MOVE_AND_RESIZE
+ */
+ public int getAnchorType();
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Comment.java b/src/java/org/apache/poi/ss/usermodel/Comment.java
new file mode 100644
index 0000000000..83a7834e4a
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Comment.java
@@ -0,0 +1,90 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface Comment {
+
+ /**
+ * Returns whether this comment is visible.
+ *
+ * @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise
+ */
+ void setVisible(boolean visible);
+
+ /**
+ * Sets whether this comment is visible.
+ *
+ * @return <code>true</code> if the comment is visible, <code>false</code> otherwise
+ */
+ boolean isVisible();
+
+ /**
+ * Return the row of the cell that contains the comment
+ *
+ * @return the 0-based row of the cell that contains the comment
+ */
+ int getRow();
+
+ /**
+ * Set the row of the cell that contains the comment
+ *
+ * @param row the 0-based row of the cell that contains the comment
+ */
+ void setRow(int row);
+
+ /**
+ * Return the column of the cell that contains the comment
+ *
+ * @return the 0-based column of the cell that contains the comment
+ */
+ int getColumn();
+
+ /**
+ * Set the column of the cell that contains the comment
+ *
+ * @param col the 0-based column of the cell that contains the comment
+ */
+ void setColumn(short col);
+
+ /**
+ * Name of the original comment author
+ *
+ * @return the name of the original author of the comment
+ */
+ String getAuthor();
+
+ /**
+ * Name of the original comment author
+ *
+ * @param author the name of the original author of the comment
+ */
+ void setAuthor(String author);
+
+ /**
+ * Fetches the rich text string of the comment
+ */
+ public RichTextString getString();
+
+ /**
+ * Sets the rich text string used by this comment.
+ *
+ * @param string Sets the rich text string used by this object.
+ */
+ void setString(RichTextString string);
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/CreationHelper.java b/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
new file mode 100644
index 0000000000..758990daf1
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/CreationHelper.java
@@ -0,0 +1,56 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * An object that handles instantiating concrete
+ * classes of the various instances one needs for
+ * HSSF and XSSF.
+ * Works around a major shortcoming in Java, where we
+ * can't have static methods on interfaces or abstract
+ * classes.
+ * This allows you to get the appropriate class for
+ * a given interface, without you having to worry
+ * about if you're dealing with HSSF or XSSF, despite
+ * Java being quite rubbish.
+ */
+public interface CreationHelper {
+ /**
+ * Creates a new RichTextString instance
+ * @param text The text to initialise the RichTextString with
+ */
+ RichTextString createRichTextString(String text);
+
+ /**
+ * Creates a new DataFormat instance
+ */
+ DataFormat createDataFormat();
+
+ /**
+ * Creates a new Hyperlink, of the given type
+ */
+ Hyperlink createHyperlink(int type);
+
+ /**
+ * Creates FormulaEvaluator - an object that evaluates formula cells.
+ *
+ * @return a FormulaEvaluator instance
+ */
+ FormulaEvaluator createFormulaEvaluator();
+
+ ClientAnchor createClientAnchor();
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormat.java b/src/java/org/apache/poi/ss/usermodel/DataFormat.java
new file mode 100644
index 0000000000..3728541ef6
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/DataFormat.java
@@ -0,0 +1,35 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface DataFormat {
+ /**
+ * get the format index that matches the given format string.
+ * Creates a new format if one is not found. Aliases text to the proper format.
+ * @param format string matching a built in format
+ * @return index of format.
+ */
+ short getFormat(String format);
+
+ /**
+ * get the format string that matches the given format index
+ * @param index of a format
+ * @return string represented at index of format or null if there is not a format at that index
+ */
+ String getFormat(short index);
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/Drawing.java b/src/java/org/apache/poi/ss/usermodel/Drawing.java
new file mode 100755
index 0000000000..c7b8dc0e84
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Drawing.java
@@ -0,0 +1,24 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * @author Yegor Kozlov
+ */
+public interface Drawing {
+ Picture createPicture(ClientAnchor anchor, int pictureIndex);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/FillPatternType.java b/src/java/org/apache/poi/ss/usermodel/FillPatternType.java
new file mode 100755
index 0000000000..25c8495b0e
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FillPatternType.java
@@ -0,0 +1,83 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * The enumeration value indicating the style of fill pattern being used for a cell format.
+ *
+ */
+public enum FillPatternType {
+
+ /** No background */
+ NO_FILL,
+
+ /** Solidly filled */
+ SOLID_FOREGROUND,
+
+ /** Small fine dots */
+ FINE_DOTS,
+
+ /** Wide dots */
+ ALT_BARS,
+
+ /** Sparse dots */
+ SPARSE_DOTS,
+
+ /** Thick horizontal bands */
+ THICK_HORZ_BANDS,
+
+ /** Thick vertical bands */
+ THICK_VERT_BANDS,
+
+ /** Thick backward facing diagonals */
+ THICK_BACKWARD_DIAG,
+
+ /** Thick forward facing diagonals */
+ THICK_FORWARD_DIAG,
+
+ /** Large spots */
+ BIG_SPOTS,
+
+ /** Brick-like layout */
+ BRICKS,
+
+ /** Thin horizontal bands */
+ THIN_HORZ_BANDS,
+
+ /** Thin vertical bands */
+ THIN_VERT_BANDS,
+
+ /** Thin backward diagonal */
+ THIN_BACKWARD_DIAG,
+
+ /** Thin forward diagonal */
+ THIN_FORWARD_DIAG,
+
+ /** Squares */
+ SQUARES,
+
+ /** Diamonds */
+ DIAMONDS,
+
+ /** Less Dots */
+ LESS_DOTS,
+
+ /** Least Dots */
+ LEAST_DOTS;
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Font.java b/src/java/org/apache/poi/ss/usermodel/Font.java
new file mode 100644
index 0000000000..b9c10a8b15
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Font.java
@@ -0,0 +1,277 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+
+public interface Font {
+ /**
+ * Normal boldness (not bold)
+ */
+
+ public final static short BOLDWEIGHT_NORMAL = 0x190;
+
+ /**
+ * Bold boldness (bold)
+ */
+
+ public final static short BOLDWEIGHT_BOLD = 0x2bc;
+
+ /**
+ * normal type of black color.
+ */
+
+ public final static short COLOR_NORMAL = 0x7fff;
+
+ /**
+ * Dark Red color
+ */
+
+ public final static short COLOR_RED = 0xa;
+
+ /**
+ * no type offsetting (not super or subscript)
+ */
+
+ public final static short SS_NONE = 0;
+
+ /**
+ * superscript
+ */
+
+ public final static short SS_SUPER = 1;
+
+ /**
+ * subscript
+ */
+
+ public final static short SS_SUB = 2;
+
+ /**
+ * not underlined
+ */
+
+ public final static byte U_NONE = 0;
+
+ /**
+ * single (normal) underline
+ */
+
+ public final static byte U_SINGLE = 1;
+
+ /**
+ * double underlined
+ */
+
+ public final static byte U_DOUBLE = 2;
+
+ /**
+ * accounting style single underline
+ */
+
+ public final static byte U_SINGLE_ACCOUNTING = 0x21;
+
+ /**
+ * accounting style double underline
+ */
+
+ public final static byte U_DOUBLE_ACCOUNTING = 0x22;
+
+ /**
+ * ANSI character set
+ */
+ public final static byte ANSI_CHARSET = 0;
+
+ /**
+ * Default character set.
+ */
+ public final static byte DEFAULT_CHARSET = 1;
+
+ /**
+ * Symbol character set
+ */
+ public final static byte SYMBOL_CHARSET = 2;
+
+ /**
+ * set the name for the font (i.e. Arial)
+ * @param name String representing the name of the font to use
+ */
+
+ void setFontName(String name);
+
+ /**
+ * get the name for the font (i.e. Arial)
+ * @return String representing the name of the font to use
+ */
+
+ String getFontName();
+
+ /**
+ * set the font height in unit's of 1/20th of a point. Maybe you might want to
+ * use the setFontHeightInPoints which matches to the familiar 10, 12, 14 etc..
+ * @param height height in 1/20ths of a point
+ * @see #setFontHeightInPoints(short)
+ */
+
+ void setFontHeight(short height);
+
+ /**
+ * set the font height
+ * @param height height in the familiar unit of measure - points
+ * @see #setFontHeight(short)
+ */
+
+ void setFontHeightInPoints(short height);
+
+ /**
+ * get the font height in unit's of 1/20th of a point. Maybe you might want to
+ * use the getFontHeightInPoints which matches to the familiar 10, 12, 14 etc..
+ * @return short - height in 1/20ths of a point
+ * @see #getFontHeightInPoints()
+ */
+
+ short getFontHeight();
+
+ /**
+ * get the font height
+ * @return short - height in the familiar unit of measure - points
+ * @see #getFontHeight()
+ */
+
+ short getFontHeightInPoints();
+
+ /**
+ * set whether to use italics or not
+ * @param italic italics or not
+ */
+
+ void setItalic(boolean italic);
+
+ /**
+ * get whether to use italics or not
+ * @return italics or not
+ */
+
+ boolean getItalic();
+
+ /**
+ * set whether to use a strikeout horizontal line through the text or not
+ * @param strikeout or not
+ */
+
+ void setStrikeout(boolean strikeout);
+
+ /**
+ * get whether to use a strikeout horizontal line through the text or not
+ * @return strikeout or not
+ */
+
+ boolean getStrikeout();
+
+ /**
+ * set the color for the font
+ * @param color to use
+ * @see #COLOR_NORMAL Note: Use this rather than HSSFColor.AUTOMATIC for default font color
+ * @see #COLOR_RED
+ */
+
+ void setColor(short color);
+
+ /**
+ * get the color for the font
+ * @return color to use
+ * @see #COLOR_NORMAL
+ * @see #COLOR_RED
+ * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
+ */
+ short getColor();
+
+ /**
+ * set normal,super or subscript.
+ * @param offset type to use (none,super,sub)
+ * @see #SS_NONE
+ * @see #SS_SUPER
+ * @see #SS_SUB
+ */
+
+ void setTypeOffset(short offset);
+
+ /**
+ * get normal,super or subscript.
+ * @return offset type to use (none,super,sub)
+ * @see #SS_NONE
+ * @see #SS_SUPER
+ * @see #SS_SUB
+ */
+
+ short getTypeOffset();
+
+ /**
+ * set type of text underlining to use
+ * @param underline type
+ * @see #U_NONE
+ * @see #U_SINGLE
+ * @see #U_DOUBLE
+ * @see #U_SINGLE_ACCOUNTING
+ * @see #U_DOUBLE_ACCOUNTING
+ */
+
+ void setUnderline(byte underline);
+
+ /**
+ * get type of text underlining to use
+ * @return underlining type
+ * @see #U_NONE
+ * @see #U_SINGLE
+ * @see #U_DOUBLE
+ * @see #U_SINGLE_ACCOUNTING
+ * @see #U_DOUBLE_ACCOUNTING
+ */
+
+ byte getUnderline();
+
+ /**
+ * get character-set to use.
+ * @return character-set
+ * @see #ANSI_CHARSET
+ * @see #DEFAULT_CHARSET
+ * @see #SYMBOL_CHARSET
+ */
+ byte getCharSet();
+
+ /**
+ * set character-set to use.
+ * @see #ANSI_CHARSET
+ * @see #DEFAULT_CHARSET
+ * @see #SYMBOL_CHARSET
+ */
+ void setCharSet(byte charset);
+
+ /**
+ * get the index within the XSSFWorkbook (sequence within the collection of Font objects)
+ *
+ * @return unique index number of the underlying record this Font represents (probably you don't care
+ * unless you're comparing which one is which)
+ */
+ public short getIndex();
+
+ public void setBoldweight(short boldweight);
+
+ public short getBoldweight();
+
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/FontCharset.java b/src/java/org/apache/poi/ss/usermodel/FontCharset.java
new file mode 100755
index 0000000000..ba06d8cc8f
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FontCharset.java
@@ -0,0 +1,75 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+
+/**
+ * Charset represents the basic set of characters associated with a font (that it can display), and
+ * corresponds to the ANSI codepage (8-bit or DBCS) of that character set used by a given language.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum FontCharset {
+
+ ANSI(0),
+ DEFAULT(1),
+ SYMBOL(2),
+ MAC(77),
+ SHIFTJIS(128),
+ HANGEUL(129),
+ JOHAB(130),
+ GB2312(134),
+ CHINESEBIG5(136),
+ GREEK(161),
+ TURKISH(162),
+ VIETNAMESE(163),
+ HEBREW(177),
+ ARABIC(178),
+ BALTIC(186),
+ RUSSIAN(204),
+ THAI(222),
+ EASTEUROPE(238),
+ OEM(255);
+
+
+ private int charset;
+
+ private FontCharset(int value){
+ charset = value;
+ }
+
+ /**
+ * Returns value of this charset
+ *
+ * @return value of this charset
+ */
+ public int getValue(){
+ return charset;
+ }
+
+ private static FontCharset[] _table = new FontCharset[256];
+ static {
+ for (FontCharset c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static FontCharset valueOf(int value){
+ return _table[value];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/FontFamily.java b/src/java/org/apache/poi/ss/usermodel/FontFamily.java
new file mode 100755
index 0000000000..829246678e
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FontFamily.java
@@ -0,0 +1,62 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+
+/**
+ * The font family this font belongs to. A font family is a set of fonts having common stroke width and serif
+ * characteristics. The font name overrides when there are conflicting values.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum FontFamily {
+
+ NOT_APPLICABLE(0),
+ ROMAN(1),
+ SWISS(2),
+ MODERN(3),
+ SCRIPT(4),
+ DECORATIVE(5);
+
+ private int family;
+
+ private FontFamily(int value) {
+ family = value;
+ }
+
+ /**
+ * Returns index of this font family
+ *
+ * @return index of this font family
+ */
+ public int getValue() {
+ return family;
+ }
+
+ private static FontFamily[] _table = new FontFamily[6];
+
+ static {
+ for (FontFamily c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static FontFamily valueOf(int family) {
+ return _table[family];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/FontScheme.java b/src/java/org/apache/poi/ss/usermodel/FontScheme.java
new file mode 100755
index 0000000000..e1b7712309
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FontScheme.java
@@ -0,0 +1,57 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+
+/**
+ * Defines the font scheme to which this font belongs.
+ * When a font definition is part of a theme definition, then the font is categorized as either a major or minor font scheme component.
+ * When a new theme is chosen, every font that is part of a theme definition is updated to use the new major or minor font definition for that
+ * theme.
+ * Usually major fonts are used for styles like headings, and minor fonts are used for body & paragraph text.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum FontScheme {
+
+
+ NONE(1),
+ MAJOR(2),
+ MINOR(3);
+
+ private int value;
+
+ private FontScheme(int val) {
+ value = val;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ private static FontScheme[] _table = new FontScheme[4];
+ static {
+ for (FontScheme c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static FontScheme valueOf(int value){
+ return _table[value];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/FontUnderline.java b/src/java/org/apache/poi/ss/usermodel/FontUnderline.java
new file mode 100755
index 0000000000..a78062b92b
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FontUnderline.java
@@ -0,0 +1,121 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * the different types of possible underline formatting
+ *
+ * @author Gisella Bronzetti
+ */
+public enum FontUnderline {
+
+ /**
+ * Single-line underlining under each character in the cell.
+ * The underline is drawn through the descenders of
+ * characters such as g and p..
+ */
+ SINGLE(1),
+
+ /**
+ * Double-line underlining under each character in the
+ * cell. underlines are drawn through the descenders of
+ * characters such as g and p.
+ */
+ DOUBLE(2),
+
+ /**
+ * Single-line accounting underlining under each
+ * character in the cell. The underline is drawn under the
+ * descenders of characters such as g and p.
+ */
+ SINGLE_ACCOUNTING(3),
+
+ /**
+ * Double-line accounting underlining under each
+ * character in the cell. The underlines are drawn under
+ * the descenders of characters such as g and p.
+ */
+ DOUBLE_ACCOUNTING(4),
+
+ /**
+ * No underline.
+ */
+ NONE(5);
+
+ private int value;
+
+
+ private FontUnderline(int val) {
+ value = val;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public byte getByteValue() {
+ switch (this) {
+ case DOUBLE:
+ return Font.U_DOUBLE;
+ case DOUBLE_ACCOUNTING:
+ return Font.U_DOUBLE_ACCOUNTING;
+ case SINGLE_ACCOUNTING:
+ return Font.U_SINGLE_ACCOUNTING;
+ case NONE:
+ return Font.U_NONE;
+ case SINGLE:
+ return Font.U_SINGLE;
+ default:
+ return Font.U_SINGLE;
+ }
+ }
+
+ private static FontUnderline[] _table = new FontUnderline[6];
+ static {
+ for (FontUnderline c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static FontUnderline valueOf(int value){
+ return _table[value];
+ }
+
+ public static FontUnderline valueOf(byte value){
+ FontUnderline val;
+ switch (value) {
+ case Font.U_DOUBLE:
+ val = FontUnderline.DOUBLE;
+ break;
+ case Font.U_DOUBLE_ACCOUNTING:
+ val = FontUnderline.DOUBLE_ACCOUNTING;
+ break;
+ case Font.U_SINGLE_ACCOUNTING:
+ val = FontUnderline.SINGLE_ACCOUNTING;
+ break;
+ case Font.U_SINGLE:
+ val = FontUnderline.SINGLE;
+ break;
+ default:
+ val = FontUnderline.NONE;
+ break;
+ }
+ return val;
+ }
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Footer.java b/src/java/org/apache/poi/ss/usermodel/Footer.java
new file mode 100644
index 0000000000..4a1bbfbb06
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Footer.java
@@ -0,0 +1,63 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Common definition of a HSSF or XSSF page footer.
+ * For a list of all the different fields that can be
+ * placed into a footer, such as page number,
+ * bold, underline etc, see
+ * {@link org.apache.poi.hssf.usermodel.HeaderFooter}.
+ */
+public interface Footer extends HeaderFooter {
+ /**
+ * Get the left side of the footer.
+ * @return The string representing the left side.
+ */
+ String getLeft();
+
+ /**
+ * Sets the left string.
+ * @param newLeft The string to set as the left side.
+ */
+ void setLeft(String newLeft);
+
+ /**
+ * Get the center of the footer.
+ * @return The string representing the center.
+ */
+ String getCenter();
+
+ /**
+ * Sets the center string.
+ * @param newCenter The string to set as the center.
+ */
+ void setCenter(String newCenter);
+
+ /**
+ * Get the right side of the footer.
+ * @return The string representing the right side.
+ */
+ String getRight();
+
+ /**
+ * Sets the right string.
+ * @param newRight The string to set as the right side.
+ */
+ void setRight(String newRight);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/FormulaError.java b/src/java/org/apache/poi/ss/usermodel/FormulaError.java
new file mode 100755
index 0000000000..4f631c6ee4
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/FormulaError.java
@@ -0,0 +1,140 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Enumerates error values in SpreadsheetML formula calculations.
+ *
+ * @author Yegor Kozlov
+ */
+public enum FormulaError {
+ /**
+ * Intended to indicate when two areas are required to intersect, but do not.
+ * <p>Example:
+ * In the case of SUM(B1 C1), the space between B1 and C1 is treated as the binary
+ * intersection operator, when a comma was intended. end example]
+ * </p>
+ */
+ NULL(0x00, "#NULL!"),
+
+ /**
+ * Intended to indicate when any number, including zero, is divided by zero.
+ * Note: However, any error code divided by zero results in that error code.
+ */
+ DIV0(0x07, "#DIV/0!"),
+
+ /**
+ * Intended to indicate when an incompatible type argument is passed to a function, or
+ * an incompatible type operand is used with an operator.
+ * <p>Example:
+ * In the case of a function argument, text was expected, but a number was provided
+ * </p>
+ */
+ VALUE(0x0F, "#VALUE!"),
+
+ /**
+ * Intended to indicate when a cell reference is invalid.
+ * <p>Example:
+ * If a formula contains a reference to a cell, and then the row or column containing that cell is deleted,
+ * a #REF! error results. If a worksheet does not support 20,001 columns,
+ * OFFSET(A1,0,20000) will result in a #REF! error.
+ * </p>
+ */
+ REF(0x1D, "#REF!"),
+
+ /**
+ * Intended to indicate when what looks like a name is used, but no such name has been defined.
+ * <p>Example:
+ * XYZ/3, where XYZ is not a defined name. Total is & A10,
+ * where neither Total nor is is a defined name. Presumably, "Total is " & A10
+ * was intended. SUM(A1C10), where the range A1:C10 was intended.
+ * </p>
+ */
+ NAME(0x1D, "#NAME?"),
+
+ /**
+ * Intended to indicate when an argument to a function has a compatible type, but has a
+ * value that is outside the domain over which that function is defined. (This is known as
+ * a domain error.)
+ * <p>Example:
+ * Certain calls to ASIN, ATANH, FACT, and SQRT might result in domain errors.
+ * </p>
+ * Intended to indicate that the result of a function cannot be represented in a value of
+ * the specified type, typically due to extreme magnitude. (This is known as a range
+ * error.)
+ * <p>Example: FACT(1000) might result in a range error. </p>
+ */
+ NUM(0x24, "#NUM!"),
+
+ /**
+ * Intended to indicate when a designated value is not available.
+ * <p>Example:
+ * Some functions, such as SUMX2MY2, perform a series of operations on corresponding
+ * elements in two arrays. If those arrays do not have the same number of elements, then
+ * for some elements in the longer array, there are no corresponding elements in the
+ * shorter one; that is, one or more values in the shorter array are not available.
+ * </p>
+ * This error value can be produced by calling the function NA
+ */
+ NA(0x2A, "#N/A");
+
+ private byte type;
+ private String repr;
+
+ private FormulaError(int type, String repr) {
+ this.type = (byte) type;
+ this.repr = repr;
+ }
+
+ /**
+ * @return numeric code of the error
+ */
+ public byte getCode() {
+ return type;
+ }
+
+ /**
+ * @return string representation of the error
+ */
+ public String getString() {
+ return repr;
+ }
+
+ private static Map<String, FormulaError> smap = new HashMap<String, FormulaError>();
+ private static Map<Byte, FormulaError> imap = new HashMap<Byte, FormulaError>();
+ static{
+ for (FormulaError error : values()) {
+ imap.put(error.getCode(), error);
+ smap.put(error.getString(), error);
+ }
+ }
+
+ public static FormulaError forInt(byte type){
+ FormulaError err = imap.get(type);
+ if(err == null) throw new IllegalArgumentException("Unknown error type: " + type);
+ return err;
+ }
+
+ public static FormulaError forString(String code){
+ FormulaError err = smap.get(code);
+ if(err == null) throw new IllegalArgumentException("Unknown error code: " + code);
+ return err;
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Header.java b/src/java/org/apache/poi/ss/usermodel/Header.java
new file mode 100644
index 0000000000..e06345c9f5
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Header.java
@@ -0,0 +1,69 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Common definition of a HSSF or XSSF page header.
+ * For a list of all the different fields that can be
+ * placed into a header, such as page number,
+ * bold, underline etc, see
+ * {@link org.apache.poi.hssf.usermodel.HeaderFooter}.
+ */
+public interface Header extends HeaderFooter {
+ /**
+ * Get the left side of the header.
+ *
+ * @return The string representing the left side.
+ */
+ String getLeft();
+
+ /**
+ * Sets the left string.
+ *
+ * @param newLeft The string to set as the left side.
+ */
+ void setLeft(String newLeft);
+
+ /**
+ * Get the center of the header.
+ *
+ * @return The string representing the center.
+ */
+ String getCenter();
+
+ /**
+ * Sets the center string.
+ *
+ * @param newCenter The string to set as the center.
+ */
+ void setCenter(String newCenter);
+
+ /**
+ * Get the right side of the header.
+ *
+ * @return The string representing the right side.
+ */
+ String getRight();
+
+ /**
+ * Sets the right string.
+ *
+ * @param newRight The string to set as the right side.
+ */
+ void setRight(String newRight);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/HorizontalAlignment.java b/src/java/org/apache/poi/ss/usermodel/HorizontalAlignment.java
new file mode 100755
index 0000000000..bcc05d8fbf
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/HorizontalAlignment.java
@@ -0,0 +1,95 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * The enumeration value indicating horizontal alignment of a cell,
+ * i.e., whether it is aligned general, left, right, horizontally centered, filled (replicated),
+ * justified, centered across multiple cells, or distributed.
+ */
+public enum HorizontalAlignment {
+ /**
+ * The horizontal alignment is general-aligned. Text data is left-aligned.
+ * Numbers, dates, and times are rightaligned. Boolean types are centered.
+ * Changing the alignment does not change the type of data.
+ */
+ GENERAL,
+
+ /**
+ * The horizontal alignment is left-aligned, even in Rightto-Left mode.
+ * Aligns contents at the left edge of the cell. If an indent amount is specified, the contents of
+ * the cell is indented from the left by the specified number of character spaces. The character spaces are
+ * based on the default font and font size for the workbook.
+ */
+ LEFT,
+
+ /**
+ * The horizontal alignment is centered, meaning the text is centered across the cell.
+ */
+ CENTER,
+
+ /**
+ * The horizontal alignment is right-aligned, meaning that cell contents are aligned at the right edge of the cell,
+ * even in Right-to-Left mode.
+ */
+ RIGHT,
+
+ /**
+ * Indicates that the value of the cell should be filled
+ * across the entire width of the cell. If blank cells to the right also have the fill alignment,
+ * they are also filled with the value, using a convention similar to centerContinuous.
+ * <p>
+ * Additional rules:
+ * <ol>
+ * <li>Only whole values can be appended, not partial values.</li>
+ * <li>The column will not be widened to 'best fit' the filled value</li>
+ * <li>If appending an additional occurrence of the value exceeds the boundary of the cell
+ * left/right edge, don't append the additional occurrence of the value.</li>
+ * <li>The display value of the cell is filled, not the underlying raw number.</li>
+ * </ol>
+ * </p>
+ */
+ FILL,
+
+ /**
+ * The horizontal alignment is justified (flush left and right).
+ * For each line of text, aligns each line of the wrapped text in a cell to the right and left
+ * (except the last line). If no single line of text wraps in the cell, then the text is not justified.
+ */
+ JUSTIFY,
+
+ /**
+ * The horizontal alignment is centered across multiple cells.
+ * The information about how many cells to span is expressed in the Sheet Part,
+ * in the row of the cell in question. For each cell that is spanned in the alignment,
+ * a cell element needs to be written out, with the same style Id which references the centerContinuous alignment.
+ */
+ CENTER_SELECTION,
+
+ /**
+ * Indicates that each 'word' in each line of text inside the cell is evenly distributed
+ * across the width of the cell, with flush right and left margins.
+ * <p>
+ * When there is also an indent value to apply, both the left and right side of the cell
+ * are padded by the indent value.
+ * </p>
+ * <p> A 'word' is a set of characters with no space character in them. </p>
+ * <p> Two lines inside a cell are separated by a carriage return. </p>
+ */
+ DISTRIBUTED
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Hyperlink.java b/src/java/org/apache/poi/ss/usermodel/Hyperlink.java
new file mode 100644
index 0000000000..c067cc002c
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Hyperlink.java
@@ -0,0 +1,78 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Represents an Excel hyperlink.
+ */
+public interface Hyperlink extends org.apache.poi.common.usermodel.Hyperlink {
+ /**
+ * Return the row of the first cell that contains the hyperlink
+ *
+ * @return the 0-based row of the cell that contains the hyperlink
+ */
+ public int getFirstRow();
+
+ /**
+ * Set the row of the first cell that contains the hyperlink
+ *
+ * @param row the 0-based row of the first cell that contains the hyperlink
+ */
+ public void setFirstRow(int row);
+
+ /**
+ * Return the row of the last cell that contains the hyperlink
+ *
+ * @return the 0-based row of the last cell that contains the hyperlink
+ */
+ public int getLastRow();
+
+ /**
+ * Set the row of the last cell that contains the hyperlink
+ *
+ * @param row the 0-based row of the last cell that contains the hyperlink
+ */
+ public void setLastRow(int row);
+
+ /**
+ * Return the column of the first cell that contains the hyperlink
+ *
+ * @return the 0-based column of the first cell that contains the hyperlink
+ */
+ public int getFirstColumn();
+
+ /**
+ * Set the column of the first cell that contains the hyperlink
+ *
+ * @param col the 0-based column of the first cell that contains the hyperlink
+ */
+ public void setFirstColumn(int col);
+
+ /**
+ * Return the column of the last cell that contains the hyperlink
+ *
+ * @return the 0-based column of the last cell that contains the hyperlink
+ */
+ public int getLastColumn();
+
+ /**
+ * Set the column of the last cell that contains the hyperlink
+ *
+ * @param col the 0-based column of the last cell that contains the hyperlink
+ */
+ public void setLastColumn(int col);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/IndexedColors.java b/src/java/org/apache/poi/ss/usermodel/IndexedColors.java
new file mode 100755
index 0000000000..07237471aa
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/IndexedColors.java
@@ -0,0 +1,97 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * A deprecated indexing scheme for colours that is still required for some records, and for backwards
+ * compatibility with OLE2 formats.
+ *
+ * <p>
+ * Each element corresponds to a color index (zero-based). When using the default indexed color palette,
+ * the values are not written out, but instead are implied. When the color palette has been modified from default,
+ * then the entire color palette is used.
+ * </p>
+ *
+ * @author Yegor Kozlov
+ */
+public enum IndexedColors {
+
+ BLACK(8),
+ WHITE(9),
+ RED(10),
+ BRIGHT_GREEN(11),
+ BLUE(12),
+ YELLOW(13),
+ PINK(14),
+ TURQUOISE(15),
+ DARK_RED(16),
+ GREEN(17),
+ DARK_BLUE(18),
+ DARK_YELLOW(19),
+ VIOLET(20),
+ TEAL(21),
+ GREY_25_PERCENT(22),
+ GREY_50_PERCENT(23),
+ CORNFLOWER_BLUE(24),
+ MAROON(25),
+ LEMON_CHIFFON(26),
+ ORCHID(28),
+ CORAL(29),
+ ROYAL_BLUE(30),
+ LIGHT_CORNFLOWER_BLUE(31),
+ SKY_BLUE(40),
+ LIGHT_TURQUOISE(41),
+ LIGHT_GREEN(42),
+ LIGHT_YELLOW(43),
+ PALE_BLUE(44),
+ ROSE(45),
+ LAVENDER(46),
+ TAN(47),
+ LIGHT_BLUE(48),
+ AQUA(49),
+ LIME(50),
+ GOLD(51),
+ LIGHT_ORANGE(52),
+ ORANGE(53),
+ BLUE_GREY(54),
+ GREY_40_PERCENT(55),
+ DARK_TEAL(56),
+ SEA_GREEN(57),
+ DARK_GREEN(58),
+ OLIVE_GREEN(59),
+ BROWN(60),
+ PLUM(61),
+ INDIGO(62),
+ GREY_80_PERCENT(63),
+ AUTOMATIC(64);
+
+ private int index;
+
+ IndexedColors(int idx){
+ index = idx;
+ }
+
+ /**
+ * Returns index of this color
+ *
+ * @return index of this color
+ */
+ public short getIndex(){
+ return (short)index;
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Name.java b/src/java/org/apache/poi/ss/usermodel/Name.java
new file mode 100644
index 0000000000..696eb3c1ac
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Name.java
@@ -0,0 +1,184 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Represents a defined name for a range of cells.
+ * <p>
+ * A name is a meaningful shorthand that makes it easier to understand the purpose of a
+ * cell reference, constant or a formula.
+ * </p>
+ * Examples:
+ * <pre><blockquote>
+ * Sheet sheet = workbook.createSheet("Loan Calculator");
+ * Name name;
+ *
+ * name = workbook.createName();
+ * name.setNameName("Interest_Rate");
+ * name.setRefersToFormula("'Loan Calculator'!$E$5");
+ *
+ * name = wb.createName();
+ * name.setNameName("Loan_Amount");
+ * name.setRefersToFormula("'Loan Calculator'!$E$4");
+ *
+ * name = wb.createName();
+ * name.setNameName("Number_of_Payments");
+ * name.setRefersToFormula("'Loan Calculator'!$E$10");
+ *
+ * name = wb.createName();
+ * name.setNameName("Monthly_Payment");
+ * name.setRefersToFormula("-PMT(Interest_Rate/12,Number_of_Payments,Loan_Amount)");
+ *
+ * name = wb.createName();
+ * name.setNameName("Values_Entered");
+ * name.setRefersToFormula("IF(Loan_Amount*Interest_Rate>0,1,0)");
+ *
+ * </blockquote></pre>
+ */
+public interface Name {
+
+ /**
+ * Get the sheets name which this named range is referenced to
+ *
+ * @return sheet name, which this named range refered to
+ */
+ String getSheetName();
+
+ /**
+ * Gets the name of the named range
+ *
+ * @return named range name
+ */
+ String getNameName();
+
+ /**
+ * Sets the name of the named range
+ *
+ * <p>The following is a list of syntax rules that you need to be aware of when you create and edit names.</p>
+ * <ul>
+ * <li><strong>Valid characters</strong>
+ * The first character of a name must be a letter, an underscore character (_), or a backslash (\).
+ * Remaining characters in the name can be letters, numbers, periods, and underscore characters.
+ * </li>
+ * <li><strong>Cell references disallowed</strong>
+ * Names cannot be the same as a cell reference, such as Z$100 or R1C1.</li>
+ * <li><strong>Spaces are not valid</strong>
+ * Spaces are not allowed as part of a name. Use the underscore character (_) and period (.) as word separators, such as, Sales_Tax or First.Quarter.
+ * </li>
+ * <li><strong>Name length</strong>
+ * A name can contain up to 255 characters.
+ * </li>
+ * <li><strong>Case sensitivity</strong>
+ * Names can contain uppercase and lowercase letters.
+ * </li>
+ * </ul>
+ * <p>
+ * A name must always be unique within its scope. POI prevents you from defining a name that is not unique
+ * within its scope. However you can use the same name in different scopes. Example:
+ * <pre><blockquote>
+ * //by default names are workbook-global
+ * Name name;
+ * name = workbook.createName();
+ * name.setNameName("sales_08");
+ *
+ * name = workbook.createName();
+ * name.setNameName("sales_08"); //will throw an exception: "The workbook already contains this name (case-insensitive)"
+ *
+ * //create sheet-level name
+ * name = workbook.createName();
+ * name.setSheetIndex(0); //the scope of the name is the first sheet
+ * name.setNameName("sales_08"); //ok
+ *
+ * name = workbook.createName();
+ * name.setSheetIndex(0);
+ * name.setNameName("sales_08"); //will throw an exception: "The sheet already contains this name (case-insensitive)"
+ *
+ * </blockquote></pre>
+ * </p>
+ * @param name named range name to set
+ * @throws IllegalArgumentException if the name is invalid or the already exists within its scope (case-insensitive)
+ */
+ void setNameName(String name);
+
+ /**
+ * Returns the formula that the name is defined to refer to.
+ *
+ * @return the reference for this name, <code>null</code> if it has not been set yet. Never empty string
+ * @see #setRefersToFormula(String)
+ */
+ String getRefersToFormula();
+
+ /**
+ * Sets the formula that the name is defined to refer to. The following are representative examples:
+ *
+ * <ul>
+ * <li><code>'My Sheet'!$A$3</code></li>
+ * <li><code>8.3</code></li>
+ * <li><code>HR!$A$1:$Z$345</code></li>
+ * <li><code>SUM(Sheet1!A1,Sheet2!B2)</li>
+ * <li><code>-PMT(Interest_Rate/12,Number_of_Payments,Loan_Amount)</li>
+ * </ul>
+ *
+ * @param formulaText the reference for this name
+ * @throws IllegalArgumentException if the specified formulaText is unparsable
+ */
+ void setRefersToFormula(String formulaText);
+
+ /**
+ * Checks if this name is a function name
+ *
+ * @return true if this name is a function name
+ */
+ boolean isFunctionName();
+
+ /**
+ * Checks if this name points to a cell that no longer exists
+ *
+ * @return <code>true</code> if the name refers to a deleted cell, <code>false</code> otherwise
+ */
+ boolean isDeleted();
+
+ /**
+ * Tell Excel that this name applies to the worksheet with the specified index instead of the entire workbook.
+ *
+ * @param sheetId the sheet index this name applies to, -1 unsets this property making the name workbook-global
+ * @throws IllegalArgumentException if the sheet index is invalid.
+ */
+ public void setSheetIndex(int sheetId);
+
+ /**
+ * Returns the sheet index this name applies to.
+ *
+ * @return the sheet index this name applies to, -1 if this name applies to the entire workbook
+ */
+ public int getSheetIndex();
+
+ /**
+ * Returns the comment the user provided when the name was created.
+ *
+ * @return the user comment for this named range
+ */
+ public String getComment();
+
+ /**
+ * Sets the comment the user provided when the name was created.
+ *
+ * @param comment the user comment for this named range
+ */
+ public void setComment(String comment);
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/PageOrder.java b/src/java/org/apache/poi/ss/usermodel/PageOrder.java
new file mode 100755
index 0000000000..341f2bf72a
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PageOrder.java
@@ -0,0 +1,59 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Specifies printed page order.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum PageOrder {
+
+ /**
+ * Order pages vertically first, then move horizontally.
+ */
+ DOWN_THEN_OVER(1),
+ /**
+ * Order pages horizontally first, then move vertically
+ */
+ OVER_THEN_DOWN(2);
+
+
+ private int order;
+
+
+ private PageOrder(int order) {
+ this.order = order;
+ }
+
+ public int getValue() {
+ return order;
+ }
+
+
+ private static PageOrder[] _table = new PageOrder[3];
+ static {
+ for (PageOrder c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static PageOrder valueOf(int value){
+ return _table[value];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/PaperSize.java b/src/java/org/apache/poi/ss/usermodel/PaperSize.java
new file mode 100755
index 0000000000..cebab20381
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PaperSize.java
@@ -0,0 +1,43 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * The enumeration value indicating the possible paper size for a sheet
+ *
+ * @author Daniele Montagni
+ */
+public enum PaperSize {
+ LETTER_PAPER,
+ LETTER_SMALL_PAPER,
+ TABLOID_PAPER,
+ LEDGER_PAPER,
+ LEGAL_PAPER,
+ STATEMENT_PAPER,
+ EXECUTIVE_PAPER,
+ A3_PAPER,
+ A4_PAPER,
+ A4_SMALL_PAPER,
+ A5_PAPER,
+ B4_PAPER,
+ B5_PAPER,
+ FOLIO_PAPER,
+ QUARTO_PAPER,
+ STANDARD_PAPER_10_14,
+ STANDARD_PAPER_11_17;
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Picture.java b/src/java/org/apache/poi/ss/usermodel/Picture.java
new file mode 100755
index 0000000000..dd6a8e7d31
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Picture.java
@@ -0,0 +1,42 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Repersents a picture in a SpreadsheetML document
+ *
+ * @author Yegor Kozlov
+ */
+public interface Picture {
+
+ /**
+ * Reset the image to the original size.
+ */
+ void resize();
+
+ /**
+ * Reset the image to the original size.
+ *
+ * @param scale the amount by which image dimensions are multiplied relative to the original size.
+ * <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
+ * <code>resize(2.0)</code> resizes to 200% of the original.
+ */
+ void resize(double scale);
+
+ ClientAnchor getPreferredSize();
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/PictureData.java b/src/java/org/apache/poi/ss/usermodel/PictureData.java
new file mode 100644
index 0000000000..a799de88eb
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PictureData.java
@@ -0,0 +1,36 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface PictureData {
+
+ /**
+ * Gets the picture data.
+ *
+ * @return the picture data.
+ */
+ byte[] getData();
+
+ /**
+ * Suggests a file extension for this image.
+ *
+ * @return the file extension.
+ */
+ String suggestFileExtension();
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/PrintCellComments.java b/src/java/org/apache/poi/ss/usermodel/PrintCellComments.java
new file mode 100755
index 0000000000..ecbea6dafe
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PrintCellComments.java
@@ -0,0 +1,61 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * These enumerations specify how cell comments shall be displayed for paper printing purposes.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum PrintCellComments {
+
+ /**
+ * Do not print cell comments.
+ */
+ NONE(1),
+ /**
+ * Print cell comments as displayed.
+ */
+ AS_DISPLAYED(2),
+ /**
+ * Print cell comments at end of document.
+ */
+ AT_END(3);
+
+
+ private int comments;
+
+ private PrintCellComments(int comments) {
+ this.comments = comments;
+ }
+
+ public int getValue() {
+ return comments;
+ }
+
+ private static PrintCellComments[] _table = new PrintCellComments[4];
+ static {
+ for (PrintCellComments c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static PrintCellComments valueOf(int value){
+ return _table[value];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/PrintOrientation.java b/src/java/org/apache/poi/ss/usermodel/PrintOrientation.java
new file mode 100755
index 0000000000..8d5716f31e
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PrintOrientation.java
@@ -0,0 +1,63 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * The enumeration value indicating the print orientation for a sheet.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum PrintOrientation {
+
+ /**
+ * orientation not specified
+ */
+ DEFAULT(1),
+ /**
+ * portrait orientation
+ */
+ PORTRAIT(2),
+ /**
+ * landscape orientations
+ */
+ LANDSCAPE(3);
+
+
+ private int orientation;
+
+ private PrintOrientation(int orientation) {
+ this.orientation = orientation;
+ }
+
+
+ public int getValue() {
+ return orientation;
+ }
+
+
+ private static PrintOrientation[] _table = new PrintOrientation[4];
+ static {
+ for (PrintOrientation c : values()) {
+ _table[c.getValue()] = c;
+ }
+ }
+
+ public static PrintOrientation valueOf(int value){
+ return _table[value];
+ }
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/PrintSetup.java b/src/java/org/apache/poi/ss/usermodel/PrintSetup.java
new file mode 100644
index 0000000000..0d8aa74bb7
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/PrintSetup.java
@@ -0,0 +1,256 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface PrintSetup {
+
+ public static final short LETTER_PAPERSIZE = 1;
+
+ public static final short LEGAL_PAPERSIZE = 5;
+
+ public static final short EXECUTIVE_PAPERSIZE = 7;
+
+ public static final short A4_PAPERSIZE = 9;
+
+ public static final short A5_PAPERSIZE = 11;
+
+ public static final short ENVELOPE_10_PAPERSIZE = 20;
+
+ public static final short ENVELOPE_DL_PAPERSIZE = 27;
+
+ public static final short ENVELOPE_CS_PAPERSIZE = 28;
+
+ public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
+
+ /**
+ * Set the paper size.
+ * @param size the paper size.
+ */
+ void setPaperSize(short size);
+
+ /**
+ * Set the scale.
+ * @param scale the scale to use
+ */
+ void setScale(short scale);
+
+ /**
+ * Set the page numbering start.
+ * @param start the page numbering start
+ */
+ void setPageStart(short start);
+
+ /**
+ * Set the number of pages wide to fit the sheet in
+ * @param width the number of pages
+ */
+ void setFitWidth(short width);
+
+ /**
+ * Set the number of pages high to fit the sheet in
+ * @param height the number of pages
+ */
+ void setFitHeight(short height);
+
+ /**
+ * Set whether to go left to right or top down in ordering
+ * @param ltor left to right
+ */
+ void setLeftToRight(boolean ltor);
+
+ /**
+ * Set whether to print in landscape
+ * @param ls landscape
+ */
+ void setLandscape(boolean ls);
+
+ /**
+ * Valid settings. I'm not for sure.
+ * @param valid Valid
+ */
+ void setValidSettings(boolean valid);
+
+ /**
+ * Set whether it is black and white
+ * @param mono Black and white
+ */
+ void setNoColor(boolean mono);
+
+ /**
+ * Set whether it is in draft mode
+ * @param d draft
+ */
+ void setDraft(boolean d);
+
+ /**
+ * Print the include notes
+ * @param printnotes print the notes
+ */
+ void setNotes(boolean printnotes);
+
+ /**
+ * Set no orientation. ?
+ * @param orientation Orientation.
+ */
+ void setNoOrientation(boolean orientation);
+
+ /**
+ * Set whether to use page start
+ * @param page Use page start
+ */
+ void setUsePage(boolean page);
+
+ /**
+ * Sets the horizontal resolution.
+ * @param resolution horizontal resolution
+ */
+ void setHResolution(short resolution);
+
+ /**
+ * Sets the vertical resolution.
+ * @param resolution vertical resolution
+ */
+ void setVResolution(short resolution);
+
+ /**
+ * Sets the header margin.
+ * @param headermargin header margin
+ */
+ void setHeaderMargin(double headermargin);
+
+ /**
+ * Sets the footer margin.
+ * @param footermargin footer margin
+ */
+ void setFooterMargin(double footermargin);
+
+ /**
+ * Sets the number of copies.
+ * @param copies number of copies
+ */
+ void setCopies(short copies);
+
+ /**
+ * Returns the paper size.
+ * @return paper size
+ */
+ short getPaperSize();
+
+ /**
+ * Returns the scale.
+ * @return scale
+ */
+ short getScale();
+
+ /**
+ * Returns the page start.
+ * @return page start
+ */
+ short getPageStart();
+
+ /**
+ * Returns the number of pages wide to fit sheet in.
+ * @return number of pages wide to fit sheet in
+ */
+ short getFitWidth();
+
+ /**
+ * Returns the number of pages high to fit the sheet in.
+ * @return number of pages high to fit the sheet in
+ */
+ short getFitHeight();
+
+ /**
+ * Returns the left to right print order.
+ * @return left to right print order
+ */
+ boolean getLeftToRight();
+
+ /**
+ * Returns the landscape mode.
+ * @return landscape mode
+ */
+ boolean getLandscape();
+
+ /**
+ * Returns the valid settings.
+ * @return valid settings
+ */
+ boolean getValidSettings();
+
+ /**
+ * Returns the black and white setting.
+ * @return black and white setting
+ */
+ boolean getNoColor();
+
+ /**
+ * Returns the draft mode.
+ * @return draft mode
+ */
+ boolean getDraft();
+
+ /**
+ * Returns the print notes.
+ * @return print notes
+ */
+ boolean getNotes();
+
+ /**
+ * Returns the no orientation.
+ * @return no orientation
+ */
+ boolean getNoOrientation();
+
+ /**
+ * Returns the use page numbers.
+ * @return use page numbers
+ */
+ boolean getUsePage();
+
+ /**
+ * Returns the horizontal resolution.
+ * @return horizontal resolution
+ */
+ short getHResolution();
+
+ /**
+ * Returns the vertical resolution.
+ * @return vertical resolution
+ */
+ short getVResolution();
+
+ /**
+ * Returns the header margin.
+ * @return header margin
+ */
+ double getHeaderMargin();
+
+ /**
+ * Returns the footer margin.
+ * @return footer margin
+ */
+ double getFooterMargin();
+
+ /**
+ * Returns the number of copies.
+ * @return number of copies
+ */
+ short getCopies();
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/RichTextString.java b/src/java/org/apache/poi/ss/usermodel/RichTextString.java
new file mode 100644
index 0000000000..551fede973
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/RichTextString.java
@@ -0,0 +1,88 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * Rich text unicode string. These strings can have fonts
+ * applied to arbitary parts of the string.
+ *
+ * @author Glen Stampoultzis (glens at apache.org)
+ * @author Jason Height (jheight at apache.org)
+ */
+public interface RichTextString {
+
+ /**
+ * Applies a font to the specified characters of a string.
+ *
+ * @param startIndex The start index to apply the font to (inclusive)
+ * @param endIndex The end index to apply the font to (exclusive)
+ * @param fontIndex The font to use.
+ */
+ void applyFont(int startIndex, int endIndex, short fontIndex);
+
+ /**
+ * Applies a font to the specified characters of a string.
+ *
+ * @param startIndex The start index to apply the font to (inclusive)
+ * @param endIndex The end index to apply to font to (exclusive)
+ * @param font The index of the font to use.
+ */
+ void applyFont(int startIndex, int endIndex, Font font);
+
+ /**
+ * Sets the font of the entire string.
+ * @param font The font to use.
+ */
+ void applyFont(Font font);
+
+ /**
+ * Removes any formatting that may have been applied to the string.
+ */
+ void clearFormatting();
+
+ /**
+ * Returns the plain string representation.
+ */
+ String getString();
+
+ /**
+ * @return the number of characters in the font.
+ */
+ int length();
+
+ /**
+ * @return The number of formatting runs used.
+ *
+ */
+ int numFormattingRuns();
+
+ /**
+ * The index within the string to which the specified formatting run applies.
+ * @param index the index of the formatting run
+ * @return the index within the string.
+ */
+ int getIndexOfFormattingRun(int index);
+
+ /**
+ * Applies the specified font to the entire string.
+ *
+ * @param fontIndex the font to apply.
+ */
+ void applyFont(short fontIndex);
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/Row.java b/src/java/org/apache/poi/ss/usermodel/Row.java
new file mode 100644
index 0000000000..a1db2fb367
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Row.java
@@ -0,0 +1,210 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+import java.lang.Iterable;
+import java.util.Iterator;
+
+/**
+ * High level representation of a row of a spreadsheet.
+ */
+public interface Row extends Iterable<Cell> {
+
+ /**
+ * Use this to create new cells within the row and return it.
+ * <p>
+ * The cell that is returned is a {@link Cell#CELL_TYPE_BLANK}. The type can be changed
+ * either through calling <code>setCellValue</code> or <code>setCellType</code>.
+ *
+ * @param column - the column number this cell represents
+ * @return Cell a high level representation of the created cell.
+ * @throws IllegalArgumentException if columnIndex < 0 or greater than the maximum number of supported columns
+ * (255 for *.xls, 1048576 for *.xlsx)
+ */
+ Cell createCell(int column);
+
+ /**
+ * Use this to create new cells within the row and return it.
+ * <p>
+ * The cell that is returned is a {@link Cell#CELL_TYPE_BLANK}. The type can be changed
+ * either through calling setCellValue or setCellType.
+ *
+ * @param column - the column number this cell represents
+ * @return Cell a high level representation of the created cell.
+ * @throws IllegalArgumentException if columnIndex < 0 or greate than a maximum number of supported columns
+ * (255 for *.xls, 1048576 for *.xlsx)
+ */
+ Cell createCell(int column, int type);
+
+ /**
+ * Remove the Cell from this row.
+ *
+ * @param cell the cell to remove
+ */
+ void removeCell(Cell cell);
+
+ /**
+ * Set the row number of this row.
+ *
+ * @param rowNum the row number (0-based)
+ * @throws IllegalArgumentException if rowNum < 0
+ */
+ void setRowNum(int rowNum);
+
+ /**
+ * Get row number this row represents
+ *
+ * @return the row number (0 based)
+ */
+ int getRowNum();
+
+ /**
+ * Get the cell representing a given column (logical cell) 0-based. If you
+ * ask for a cell that is not defined....you get a null.
+ *
+ * @param cellnum 0 based column number
+ * @return Cell representing that column or null if undefined.
+ * @see #getCell(int, org.apache.poi.ss.usermodel.Row.MissingCellPolicy)
+ */
+ Cell getCell(int cellnum);
+
+ /**
+ * 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
+ * @see Row#RETURN_NULL_AND_BLANK
+ * @see Row#RETURN_BLANK_AS_NULL
+ * @see Row#CREATE_NULL_AS_BLANK
+ */
+ Cell getCell(int cellnum, MissingCellPolicy policy);
+
+ /**
+ * Get the number of the first cell contained in this row.
+ *
+ * @return short representing the first logical cell in the row,
+ * or -1 if the row does not contain any cells.
+ */
+ short getFirstCellNum();
+
+ /**
+ * Gets the index of the last cell contained in this row <b>PLUS ONE</b>. The result also
+ * happens to be the 1-based column number of the last cell. This value can be used as a
+ * standard upper bound when iterating over cells:
+ * <pre>
+ * short minColIx = row.getFirstCellNum();
+ * short maxColIx = row.getLastCellNum();
+ * for(short colIx=minColIx; colIx&lt;maxColIx; colIx++) {
+ * Cell cell = row.getCell(colIx);
+ * if(cell == null) {
+ * continue;
+ * }
+ * //... do something with cell
+ * }
+ * </pre>
+ *
+ * @return short representing the last logical cell in the row <b>PLUS ONE</b>,
+ * or -1 if the row does not contain any cells.
+ */
+ short getLastCellNum();
+
+ /**
+ * Gets the number of defined cells (NOT number of cells in the actual row!).
+ * That is to say if only columns 0,4,5 have values then there would be 3.
+ *
+ * @return int representing the number of defined cells in the row.
+ */
+ int getPhysicalNumberOfCells();
+
+ /**
+ * Set the row's height or set to ff (-1) for undefined/default-height. Set the height in "twips" or
+ * 1/20th of a point.
+ *
+ * @param height rowheight or 0xff for undefined (use sheet default)
+ */
+ void setHeight(short height);
+
+ /**
+ * Set whether or not to display this row with 0 height
+ *
+ * @param zHeight height is zero or not.
+ */
+ void setZeroHeight(boolean zHeight);
+
+ /**
+ * Get whether or not to display this row with 0 height
+ *
+ * @return - zHeight height is zero or not.
+ */
+ boolean getZeroHeight();
+
+ /**
+ * Set the row's height in points.
+ *
+ * @param height the height in points. <code>-1</code> resets to the default height
+ */
+ void setHeightInPoints(float height);
+
+ /**
+ * Get the row's height measured in twips (1/20th of a point). If the height is not set, the default worksheet value is returned,
+ * See {@link Sheet#getDefaultRowHeightInPoints()}
+ *
+ * @return row height measured in twips (1/20th of a point)
+ */
+ short getHeight();
+
+ /**
+ * Returns row height measured in point size. If the height is not set, the default worksheet value is returned,
+ * See {@link Sheet#getDefaultRowHeightInPoints()}
+ *
+ * @return row height measured in point size
+ * @see Sheet#getDefaultRowHeightInPoints()
+ */
+ float getHeightInPoints();
+
+ /**
+ * @return Cell iterator of the physically defined cells. Note element 4 may
+ * actually be row cell depending on how many are defined!
+ */
+ Iterator<Cell> cellIterator();
+
+ /**
+ * Returns the Sheet this row belongs to
+ *
+ * @return the Sheet that owns this row
+ */
+ Sheet getSheet();
+
+ /**
+ * Used to specify the different possible policies
+ * if for the case of null and blank cells
+ */
+ public static final class MissingCellPolicy {
+ private static int NEXT_ID = 1;
+ public final int id;
+ private MissingCellPolicy() {
+ this.id = NEXT_ID++;
+ }
+ }
+ /** Missing cells are returned as null, Blank cells are returned as normal */
+ public static final MissingCellPolicy RETURN_NULL_AND_BLANK = new MissingCellPolicy();
+ /** Missing cells are returned as null, as are blank cells */
+ public static final MissingCellPolicy RETURN_BLANK_AS_NULL = new MissingCellPolicy();
+ /** A new, blank cell is created for missing cells. Blank cells are returned as normal */
+ public static final MissingCellPolicy CREATE_NULL_AS_BLANK = new MissingCellPolicy();
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/ShapeTypes.java b/src/java/org/apache/poi/ss/usermodel/ShapeTypes.java
new file mode 100755
index 0000000000..ef8409340c
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/ShapeTypes.java
@@ -0,0 +1,212 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * All known types of automatic shapes in DrawingML
+ *
+ * @author Yegor Kozlov
+ */
+public class ShapeTypes {
+ public static final int LINE = 1;
+ public static final int LINE_INV = 2;
+ public static final int TRIANGLE = 3;
+ public static final int RT_TRIANGLE = 4;
+ public static final int RECT = 5;
+ public static final int DIAMOND = 6;
+ public static final int PARALLELOGRAM = 7;
+ public static final int TRAPEZOID = 8;
+ public static final int NON_ISOSCELES_TRAPEZOID = 9;
+ public static final int PENTAGON = 10;
+ public static final int HEXAGON = 11;
+ public static final int HEPTAGON = 12;
+ public static final int OCTAGON = 13;
+ public static final int DECAGON = 14;
+ public static final int DODECAGON = 15;
+ public static final int STAR_4 = 16;
+ public static final int STAR_5 = 17;
+ public static final int STAR_6 = 18;
+ public static final int STAR_7 = 19;
+ public static final int STAR_8 = 20;
+ public static final int STAR_10 = 21;
+ public static final int STAR_12 = 22;
+ public static final int STAR_16 = 23;
+ public static final int STAR_24 = 24;
+ public static final int STAR_32 = 25;
+ public static final int ROUND_RECT = 26;
+ public static final int ROUND_1_RECT = 27;
+ public static final int ROUND_2_SAME_RECT = 28;
+ public static final int ROUND_2_DIAG_RECT = 29;
+ public static final int SNIP_ROUND_RECT = 30;
+ public static final int SNIP_1_RECT = 31;
+ public static final int SNIP_2_SAME_RECT = 32;
+ public static final int SNIP_2_DIAG_RECT = 33;
+ public static final int PLAQUE = 34;
+ public static final int ELLIPSE = 35;
+ public static final int TEARDROP = 36;
+ public static final int HOME_PLATE = 37;
+ public static final int CHEVRON = 38;
+ public static final int PIE_WEDGE = 39;
+ public static final int PIE = 40;
+ public static final int BLOCK_ARC = 41;
+ public static final int DONUT = 42;
+ public static final int NO_SMOKING = 43;
+ public static final int RIGHT_ARROW = 44;
+ public static final int LEFT_ARROW = 45;
+ public static final int UP_ARROW = 46;
+ public static final int DOWN_ARROW = 47;
+ public static final int STRIPED_RIGHT_ARROW = 48;
+ public static final int NOTCHED_RIGHT_ARROW = 49;
+ public static final int BENT_UP_ARROW = 50;
+ public static final int LEFT_RIGHT_ARROW = 51;
+ public static final int UP_DOWN_ARROW = 52;
+ public static final int LEFT_UP_ARROW = 53;
+ public static final int LEFT_RIGHT_UP_ARROW = 54;
+ public static final int QUAD_ARROW = 55;
+ public static final int LEFT_ARROW_CALLOUT = 56;
+ public static final int RIGHT_ARROW_CALLOUT = 57;
+ public static final int UP_ARROW_CALLOUT = 58;
+ public static final int DOWN_ARROW_CALLOUT = 59;
+ public static final int LEFT_RIGHT_ARROW_CALLOUT = 60;
+ public static final int UP_DOWN_ARROW_CALLOUT = 61;
+ public static final int QUAD_ARROW_CALLOUT = 62;
+ public static final int BENT_ARROW = 63;
+ public static final int UTURN_ARROW = 64;
+ public static final int CIRCULAR_ARROW = 65;
+ public static final int LEFT_CIRCULAR_ARROW = 66;
+ public static final int LEFT_RIGHT_CIRCULAR_ARROW = 67;
+ public static final int CURVED_RIGHT_ARROW = 68;
+ public static final int CURVED_LEFT_ARROW = 69;
+ public static final int CURVED_UP_ARROW = 70;
+ public static final int CURVED_DOWN_ARROW = 71;
+ public static final int SWOOSH_ARROW = 72;
+ public static final int CUBE = 73;
+ public static final int CAN = 74;
+ public static final int LIGHTNING_BOLT = 75;
+ public static final int HEART = 76;
+ public static final int SUN = 77;
+ public static final int MOON = 78;
+ public static final int SMILEY_FACE = 79;
+ public static final int IRREGULAR_SEAL_1 = 80;
+ public static final int IRREGULAR_SEAL_2 = 81;
+ public static final int FOLDED_CORNER = 82;
+ public static final int BEVEL = 83;
+ public static final int FRAME = 84;
+ public static final int HALF_FRAME = 85;
+ public static final int CORNER = 86;
+ public static final int DIAG_STRIPE = 87;
+ public static final int CHORD = 88;
+ public static final int ARC = 89;
+ public static final int LEFT_BRACKET = 90;
+ public static final int RIGHT_BRACKET = 91;
+ public static final int LEFT_BRACE = 92;
+ public static final int RIGHT_BRACE = 93;
+ public static final int BRACKET_PAIR = 94;
+ public static final int BRACE_PAIR = 95;
+ public static final int STRAIGHT_CONNECTOR_1 = 96;
+ public static final int BENT_CONNECTOR_2 = 97;
+ public static final int BENT_CONNECTOR_3 = 98;
+ public static final int BENT_CONNECTOR_4 = 99;
+ public static final int BENT_CONNECTOR_5 = 100;
+ public static final int CURVED_CONNECTOR_2 = 101;
+ public static final int CURVED_CONNECTOR_3 = 102;
+ public static final int CURVED_CONNECTOR_4 = 103;
+ public static final int CURVED_CONNECTOR_5 = 104;
+ public static final int CALLOUT_1 = 105;
+ public static final int CALLOUT_2 = 106;
+ public static final int CALLOUT_3 = 107;
+ public static final int ACCENT_CALLOUT_1 = 108;
+ public static final int ACCENT_CALLOUT_2 = 109;
+ public static final int ACCENT_CALLOUT_3 = 110;
+ public static final int BORDER_CALLOUT_1 = 111;
+ public static final int BORDER_CALLOUT_2 = 112;
+ public static final int BORDER_CALLOUT_3 = 113;
+ public static final int ACCENT_BORDER_CALLOUT_1 = 114;
+ public static final int ACCENT_BORDER_CALLOUT_2 = 115;
+ public static final int ACCENT_BORDER_CALLOUT_3 = 116;
+ public static final int WEDGE_RECT_CALLOUT = 117;
+ public static final int WEDGE_ROUND_RECT_CALLOUT = 118;
+ public static final int WEDGE_ELLIPSE_CALLOUT = 119;
+ public static final int CLOUD_CALLOUT = 120;
+ public static final int CLOUD = 121;
+ public static final int RIBBON = 122;
+ public static final int RIBBON_2 = 123;
+ public static final int ELLIPSE_RIBBON = 124;
+ public static final int ELLIPSE_RIBBON_2 = 125;
+ public static final int LEFT_RIGHT_RIBBON = 126;
+ public static final int VERTICAL_SCROLL = 127;
+ public static final int HORIZONTAL_SCROLL = 128;
+ public static final int WAVE = 129;
+ public static final int DOUBLE_WAVE = 130;
+ public static final int PLUS = 131;
+ public static final int FLOW_CHART_PROCESS = 132;
+ public static final int FLOW_CHART_DECISION = 133;
+ public static final int FLOW_CHART_INPUT_OUTPUT = 134;
+ public static final int FLOW_CHART_PREDEFINED_PROCESS = 135;
+ public static final int FLOW_CHART_INTERNAL_STORAGE = 136;
+ public static final int FLOW_CHART_DOCUMENT = 137;
+ public static final int FLOW_CHART_MULTIDOCUMENT = 138;
+ public static final int FLOW_CHART_TERMINATOR = 139;
+ public static final int FLOW_CHART_PREPARATION = 140;
+ public static final int FLOW_CHART_MANUAL_INPUT = 141;
+ public static final int FLOW_CHART_MANUAL_OPERATION = 142;
+ public static final int FLOW_CHART_CONNECTOR = 143;
+ public static final int FLOW_CHART_PUNCHED_CARD = 144;
+ public static final int FLOW_CHART_PUNCHED_TAPE = 145;
+ public static final int FLOW_CHART_SUMMING_JUNCTION = 146;
+ public static final int FLOW_CHART_OR = 147;
+ public static final int FLOW_CHART_COLLATE = 148;
+ public static final int FLOW_CHART_SORT = 149;
+ public static final int FLOW_CHART_EXTRACT = 150;
+ public static final int FLOW_CHART_MERGE = 151;
+ public static final int FLOW_CHART_OFFLINE_STORAGE = 152;
+ public static final int FLOW_CHART_ONLINE_STORAGE = 153;
+ public static final int FLOW_CHART_MAGNETIC_TAPE = 154;
+ public static final int FLOW_CHART_MAGNETIC_DISK = 155;
+ public static final int FLOW_CHART_MAGNETIC_DRUM = 156;
+ public static final int FLOW_CHART_DISPLAY = 157;
+ public static final int FLOW_CHART_DELAY = 158;
+ public static final int FLOW_CHART_ALTERNATE_PROCESS = 159;
+ public static final int FLOW_CHART_OFFPAGE_CONNECTOR = 160;
+ public static final int ACTION_BUTTON_BLANK = 161;
+ public static final int ACTION_BUTTON_HOME = 162;
+ public static final int ACTION_BUTTON_HELP = 163;
+ public static final int ACTION_BUTTON_INFORMATION = 164;
+ public static final int ACTION_BUTTON_FORWARD_NEXT = 165;
+ public static final int ACTION_BUTTON_BACK_PREVIOUS = 166;
+ public static final int ACTION_BUTTON_END = 167;
+ public static final int ACTION_BUTTON_BEGINNING = 168;
+ public static final int ACTION_BUTTON_RETURN = 169;
+ public static final int ACTION_BUTTON_DOCUMENT = 170;
+ public static final int ACTION_BUTTON_SOUND = 171;
+ public static final int ACTION_BUTTON_MOVIE = 172;
+ public static final int GEAR_6 = 173;
+ public static final int GEAR_9 = 174;
+ public static final int FUNNEL = 175;
+ public static final int MATH_PLUS = 176;
+ public static final int MATH_MINUS = 177;
+ public static final int MATH_MULTIPLY = 178;
+ public static final int MATH_DIVIDE = 179;
+ public static final int MATH_EQUAL = 180;
+ public static final int MATH_NOT_EQUAL = 181;
+ public static final int CORNER_TABS = 182;
+ public static final int SQUARE_TABS = 183;
+ public static final int PLAQUE_TABS = 184;
+ public static final int CHART_X = 185;
+ public static final int CHART_STAR = 186;
+ public static final int CHART_PLUS = 187;
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Sheet.java b/src/java/org/apache/poi/ss/usermodel/Sheet.java
new file mode 100644
index 0000000000..ffeb96abda
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Sheet.java
@@ -0,0 +1,783 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+import java.util.Iterator;
+
+import org.apache.poi.hssf.util.PaneInformation;
+import org.apache.poi.ss.util.CellRangeAddress;
+
+/**
+ * High level representation of a Excel worksheet.
+ *
+ * <p>
+ * Sheets are the central structures within a workbook, and are where a user does most of his spreadsheet work.
+ * The most common type of sheet is the worksheet, which is represented as a grid of cells. Worksheet cells can
+ * contain text, numbers, dates, and formulas. Cells can also be formatted.
+ * </p>
+ */
+public interface Sheet extends Iterable<Row> {
+
+ /* Constants for margins */
+ public static final short LeftMargin = 0;
+
+ public static final short RightMargin = 1;
+
+ public static final short TopMargin = 2;
+
+ public static final short BottomMargin = 3;
+
+ public static final short HeaderMargin = 4;
+
+ public static final short FooterMargin = 5;
+
+ public static final byte PANE_LOWER_RIGHT = (byte) 0;
+
+ public static final byte PANE_UPPER_RIGHT = (byte) 1;
+
+ public static final byte PANE_LOWER_LEFT = (byte) 2;
+
+ public static final byte PANE_UPPER_LEFT = (byte) 3;
+
+ /**
+ * Create a new row within the sheet and return the high level representation
+ *
+ * @param rownum row number
+ * @return high level Row object representing a row in the sheet
+ * @see #removeRow(Row)
+ */
+ Row createRow(int rownum);
+
+ /**
+ * Remove a row from this sheet. All cells contained in the row are removed as well
+ *
+ * @param row representing a row to remove.
+ */
+ void removeRow(Row row);
+
+ /**
+ * Returns the logical row (not physical) 0-based. If you ask for a row that is not
+ * defined you get a null. This is to say row 4 represents the fifth row on a sheet.
+ *
+ * @param rownum row to get (0-based)
+ * @return Row representing the rownumber or null if its not defined on the sheet
+ */
+ Row getRow(int rownum);
+
+ /**
+ * Returns the number of physically defined rows (NOT the number of rows in the sheet)
+ *
+ * @return the number of physically defined rows in this sheet
+ */
+ int getPhysicalNumberOfRows();
+
+ /**
+ * Gets the first row on the sheet
+ *
+ * @return the number of the first logical row on the sheet (0-based)
+ */
+ int getFirstRowNum();
+
+ /**
+ * Gets the last row on the sheet
+ *
+ * @return last row contained n this sheet (0-based)
+ */
+ int getLastRowNum();
+
+ /**
+ * Get the visibility state for a given column
+ *
+ * @param columnIndex - the column to get (0-based)
+ * @param hidden - the visiblity state of the column
+ */
+ void setColumnHidden(int columnIndex, boolean hidden);
+
+ /**
+ * Get the hidden state for a given column
+ *
+ * @param columnIndex - the column to set (0-based)
+ * @return hidden - <code>false</code> if the column is visible
+ */
+ boolean isColumnHidden(int columnIndex);
+
+ /**
+ * Set the width (in units of 1/256th of a character width)
+ * <p>
+ * The maximum column width for an individual cell is 255 characters.
+ * This value represents the number of characters that can be displayed
+ * in a cell that is formatted with the standard font.
+ * </p>
+ *
+ * @param columnIndex - the column to set (0-based)
+ * @param width - the width in units of 1/256th of a character width
+ */
+ void setColumnWidth(int columnIndex, int width);
+
+ /**
+ * get the width (in units of 1/256th of a character width )
+ * @param columnIndex - the column to set (0-based)
+ * @return width - the width in units of 1/256th of a character width
+ */
+ int getColumnWidth(int columnIndex);
+
+ /**
+ * Set the default column width for the sheet (if the columns do not define their own width)
+ * in characters
+ *
+ * @param width default column width measured in characters
+ */
+ void setDefaultColumnWidth(int width);
+
+ /**
+ * Get the default column width for the sheet (if the columns do not define their own width)
+ * in characters
+ *
+ * @return default column width measured in characters
+ */
+ int getDefaultColumnWidth();
+
+ /**
+ * Get the default row height for the sheet (if the rows do not define their own height) in
+ * twips (1/20 of a point)
+ *
+ * @return default row height measured in twips (1/20 of a point)
+ */
+ short getDefaultRowHeight();
+
+ /**
+ * Get the default row height for the sheet (if the rows do not define their own height) in
+ * points.
+ *
+ * @return default row height in points
+ */
+ float getDefaultRowHeightInPoints();
+
+ /**
+ * Set the default row height for the sheet (if the rows do not define their own height) in
+ * twips (1/20 of a point)
+ *
+ * @param height default row height measured in twips (1/20 of a point)
+ */
+ void setDefaultRowHeight(short height);
+
+ /**
+ * Set the default row height for the sheet (if the rows do not define their own height) in
+ * points
+ * @param height default row height
+ */
+ void setDefaultRowHeightInPoints(float height);
+
+ /**
+ * Returns the CellStyle that applies to the given
+ * (0 based) column, or null if no style has been
+ * set for that column
+ */
+ public CellStyle getColumnStyle(int column);
+
+ /**
+ * Sets the CellStyle that applies to the given
+ * (0 based) column.
+ */
+// public CellStyle setColumnStyle(int column, CellStyle style);
+
+ /**
+ * Adds a merged region of cells (hence those cells form one)
+ *
+ * @param region (rowfrom/colfrom-rowto/colto) to merge
+ * @return index of this region
+ */
+ int addMergedRegion(CellRangeAddress region);
+
+ /**
+ * Determines whether the output is vertically centered on the page.
+ *
+ * @param value true to vertically center, false otherwise.
+ */
+ void setVerticallyCenter(boolean value);
+
+ /**
+ * Determines whether the output is horizontally centered on the page.
+ *
+ * @param value true to horizontally center, false otherwise.
+ */
+ void setHorizontallyCenter(boolean value);
+
+ /**
+ * Determine whether printed output for this sheet will be horizontally centered.
+ */
+
+ boolean getHorizontallyCenter();
+
+ /**
+ * Determine whether printed output for this sheet will be vertically centered.
+ */
+ boolean getVerticallyCenter();
+
+ /**
+ * Removes a merged region of cells (hence letting them free)
+ *
+ * @param index of the region to unmerge
+ */
+ void removeMergedRegion(int index);
+
+ /**
+ * Returns the number of merged regions
+ *
+ * @return number of merged regions
+ */
+ int getNumMergedRegions();
+
+ /**
+ * Returns the merged region at the specified index
+ *
+ * @return the merged region at the specified index
+ */
+ public CellRangeAddress getMergedRegion(int index);
+
+ /**
+ * Returns an iterator of the physical rows
+ *
+ * @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not
+ * be the third row if say for instance the second row is undefined.
+ */
+ Iterator<Row> rowIterator();
+
+ /**
+ * Flag indicating whether the sheet displays Automatic Page Breaks.
+ *
+ * @param value <code>true</code> if the sheet displays Automatic Page Breaks.
+ */
+ void setAutobreaks(boolean value);
+
+ /**
+ * Set whether to display the guts or not
+ *
+ * @param value - guts or no guts
+ */
+ void setDisplayGuts(boolean value);
+
+ /**
+ * Set whether the window should show 0 (zero) in cells containing zero value.
+ * When false, cells with zero value appear blank instead of showing the number zero.
+ *
+ * @param value whether to display or hide all zero values on the worksheet
+ */
+ void setDisplayZeros(boolean value);
+
+
+ /**
+ * Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.
+ * When false, cells with zero value appear blank instead of showing the number zero.
+ *
+ * @return whether all zero values on the worksheet are displayed
+ */
+ boolean isDisplayZeros();
+
+ /**
+ * Flag indicating whether the Fit to Page print option is enabled.
+ *
+ * @param value <code>true</code> if the Fit to Page print option is enabled.
+ */
+ void setFitToPage(boolean value);
+
+ /**
+ * Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
+ *
+ * <p>
+ * When true a summary row is inserted below the detailed data being summarized and a
+ * new outline level is established on that row.
+ * </p>
+ * <p>
+ * When false a summary row is inserted above the detailed data being summarized and a new outline level
+ * is established on that row.
+ * </p>
+ * @param value <code>true</code> if row summaries appear below detail in the outline
+ */
+ void setRowSumsBelow(boolean value);
+
+ /**
+ * Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
+ *
+ * <p>
+ * When true a summary column is inserted to the right of the detailed data being summarized
+ * and a new outline level is established on that column.
+ * </p>
+ * <p>
+ * When false a summary column is inserted to the left of the detailed data being
+ * summarized and a new outline level is established on that column.
+ * </p>
+ * @param value <code>true</code> if col summaries appear right of the detail in the outline
+ */
+ void setRowSumsRight(boolean value);
+
+ /**
+ * Flag indicating whether the sheet displays Automatic Page Breaks.
+ *
+ * @return <code>true</code> if the sheet displays Automatic Page Breaks.
+ */
+ boolean getAutobreaks();
+
+ /**
+ * Get whether to display the guts or not,
+ * default value is true
+ *
+ * @return boolean - guts or no guts
+ */
+ boolean getDisplayGuts();
+
+ /**
+ * Flag indicating whether the Fit to Page print option is enabled.
+ *
+ * @return <code>true</code> if the Fit to Page print option is enabled.
+ */
+ boolean getFitToPage();
+
+ /**
+ * Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
+ *
+ * <p>
+ * When true a summary row is inserted below the detailed data being summarized and a
+ * new outline level is established on that row.
+ * </p>
+ * <p>
+ * When false a summary row is inserted above the detailed data being summarized and a new outline level
+ * is established on that row.
+ * </p>
+ * @return <code>true</code> if row summaries appear below detail in the outline
+ */
+ boolean getRowSumsBelow();
+
+ /**
+ * Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
+ *
+ * <p>
+ * When true a summary column is inserted to the right of the detailed data being summarized
+ * and a new outline level is established on that column.
+ * </p>
+ * <p>
+ * When false a summary column is inserted to the left of the detailed data being
+ * summarized and a new outline level is established on that column.
+ * </p>
+ * @return <code>true</code> if col summaries appear right of the detail in the outline
+ */
+ boolean getRowSumsRight();
+
+ /**
+ * Gets the flag indicating whether this sheet displays the lines
+ * between rows and columns to make editing and reading easier.
+ *
+ * @return <code>true</code> if this sheet displays gridlines.
+ * @see #isPrintGridlines() to check if printing of gridlines is turned on or off
+ */
+ boolean isPrintGridlines();
+
+ /**
+ * Sets the flag indicating whether this sheet should display the lines
+ * between rows and columns to make editing and reading easier.
+ * To turn printing of gridlines use {@link #setPrintGridlines(boolean)}
+ *
+ *
+ * @param show <code>true</code> if this sheet should display gridlines.
+ * @see #setPrintGridlines(boolean)
+ */
+ void setPrintGridlines(boolean show);
+
+ /**
+ * Gets the print setup object.
+ *
+ * @return The user model for the print setup object.
+ */
+ PrintSetup getPrintSetup();
+
+ /**
+ * Gets the user model for the default document header.
+ * <p>
+ * Note that XSSF offers more kinds of document headers than HSSF does
+ * </p>
+ * @return the document header.
+ */
+ Header getHeader();
+
+ /**
+ * Gets the user model for the default document footer.
+ * Note that XSSF offers more kinds of document footers than HSSF does.
+ *
+ * @return the document footer.
+ */
+ Footer getFooter();
+
+ /**
+ * Sets a flag indicating whether this sheet is selected.
+ *<p>
+ * Note: multiple sheets can be selected, but only one sheet can be active at one time.
+ *</p>
+ * @param value <code>true</code> if this sheet is selected
+ * @see Workbook#setActiveSheet(int)
+ */
+ void setSelected(boolean value);
+
+ /**
+ * Gets the size of the margin in inches.
+ *
+ * @param margin which margin to get
+ * @return the size of the margin
+ */
+ double getMargin(short margin);
+
+ /**
+ * Sets the size of the margin in inches.
+ *
+ * @param margin which margin to get
+ * @param size the size of the margin
+ */
+ void setMargin(short margin, double size);
+
+ /**
+ * Answer whether protection is enabled or disabled
+ *
+ * @return true => protection enabled; false => protection disabled
+ */
+ boolean getProtect();
+
+ /**
+ * Answer whether scenario protection is enabled or disabled
+ *
+ * @return true => protection enabled; false => protection disabled
+ */
+ boolean getScenarioProtect();
+
+ /**
+ * Sets the zoom magnication for the sheet. The zoom is expressed as a
+ * fraction. For example to express a zoom of 75% use 3 for the numerator
+ * and 4 for the denominator.
+ *
+ * @param numerator The numerator for the zoom magnification.
+ * @param denominator The denominator for the zoom magnification.
+ */
+ void setZoom(int numerator, int denominator);
+
+ /**
+ * The top row in the visible view when the sheet is
+ * first viewed after opening it in a viewer
+ *
+ * @return short indicating the rownum (0 based) of the top row
+ */
+ short getTopRow();
+
+ /**
+ * The left col in the visible view when the sheet is
+ * first viewed after opening it in a viewer
+ *
+ * @return short indicating the rownum (0 based) of the top row
+ */
+ short getLeftCol();
+
+ /**
+ * Sets desktop window pane display area, when the
+ * file is first opened in a viewer.
+ *
+ * @param toprow the top row to show in desktop window pane
+ * @param leftcol the left column to show in desktop window pane
+ */
+ void showInPane(short toprow, short leftcol);
+
+ /**
+ * Shifts rows between startRow and endRow n number of rows.
+ * If you use a negative number, it will shift rows up.
+ * Code ensures that rows don't wrap around.
+ *
+ * Calls shiftRows(startRow, endRow, n, false, false);
+ *
+ * <p>
+ * Additionally shifts merged regions that are completely defined in these
+ * rows (ie. merged 2 cells on a row to be shifted).
+ * @param startRow the row to start shifting
+ * @param endRow the row to end shifting
+ * @param n the number of rows to shift
+ */
+ void shiftRows(int startRow, int endRow, int n);
+
+ /**
+ * Shifts rows between startRow and endRow n number of rows.
+ * If you use a negative number, it will shift rows up.
+ * Code ensures that rows don't wrap around
+ *
+ * <p>
+ * Additionally shifts merged regions that are completely defined in these
+ * rows (ie. merged 2 cells on a row to be shifted).
+ * <p>
+ * @param startRow the row to start shifting
+ * @param endRow the row to end shifting
+ * @param n the number of rows to shift
+ * @param copyRowHeight whether to copy the row height during the shift
+ * @param resetOriginalRowHeight whether to set the original row's height to the default
+ */
+ void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight);
+
+ /**
+ * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
+ * @param colSplit Horizonatal position of split.
+ * @param rowSplit Vertical position of split.
+ * @param topRow Top row visible in bottom pane
+ * @param leftmostColumn Left column visible in right pane.
+ */
+ void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow);
+
+ /**
+ * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
+ * @param colSplit Horizonatal position of split.
+ * @param rowSplit Vertical position of split.
+ */
+ void createFreezePane(int colSplit, int rowSplit);
+
+ /**
+ * Creates a split pane. Any existing freezepane or split pane is overwritten.
+ * @param xSplitPos Horizonatal position of split (in 1/20th of a point).
+ * @param ySplitPos Vertical position of split (in 1/20th of a point).
+ * @param topRow Top row visible in bottom pane
+ * @param leftmostColumn Left column visible in right pane.
+ * @param activePane Active pane. One of: PANE_LOWER_RIGHT,
+ * PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
+ * @see #PANE_LOWER_LEFT
+ * @see #PANE_LOWER_RIGHT
+ * @see #PANE_UPPER_LEFT
+ * @see #PANE_UPPER_RIGHT
+ */
+ void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane);
+
+ /**
+ * Returns the information regarding the currently configured pane (split or freeze)
+ *
+ * @return null if no pane configured, or the pane information.
+ */
+ PaneInformation getPaneInformation();
+
+ /**
+ * Sets whether the gridlines are shown in a viewer
+ *
+ * @param show whether to show gridlines or not
+ */
+ void setDisplayGridlines(boolean show);
+
+ /**
+ * Returns if gridlines are displayed
+ *
+ * @return whether gridlines are displayed
+ */
+ boolean isDisplayGridlines();
+
+ /**
+ * Sets whether the formulas are shown in a viewer
+ *
+ * @param show whether to show formulas or not
+ */
+ void setDisplayFormulas(boolean show);
+
+ /**
+ * Returns if formulas are displayed
+ *
+ * @return whether formulas are displayed
+ */
+ boolean isDisplayFormulas();
+
+ /**
+ * Sets whether the RowColHeadings are shown in a viewer
+ *
+ * @param show whether to show RowColHeadings or not
+ */
+ void setDisplayRowColHeadings(boolean show);
+
+ /**
+ * Returns if RowColHeadings are displayed.
+ * @return whether RowColHeadings are displayed
+ */
+ boolean isDisplayRowColHeadings();
+
+ /**
+ * Sets a page break at the indicated row
+ * @param row FIXME: Document this!
+ */
+ void setRowBreak(int row);
+
+ /**
+ * Determines if there is a page break at the indicated row
+ * @param row FIXME: Document this!
+ * @return FIXME: Document this!
+ */
+ boolean isRowBroken(int row);
+
+ /**
+ * Removes the page break at the indicated row
+ * @param row
+ */
+ void removeRowBreak(int row);
+
+ /**
+ * Retrieves all the horizontal page breaks
+ * @return all the horizontal page breaks, or null if there are no row page breaks
+ */
+ int[] getRowBreaks();
+
+ /**
+ * Retrieves all the vertical page breaks
+ * @return all the vertical page breaks, or null if there are no column page breaks
+ */
+ int[] getColumnBreaks();
+
+ /**
+ * Sets a page break at the indicated column
+ * @param column
+ */
+ void setColumnBreak(int column);
+
+ /**
+ * Determines if there is a page break at the indicated column
+ * @param column FIXME: Document this!
+ * @return FIXME: Document this!
+ */
+ boolean isColumnBroken(int column);
+
+ /**
+ * Removes a page break at the indicated column
+ * @param column
+ */
+ void removeColumnBreak(int column);
+
+ /**
+ * Expands or collapses a column group.
+ *
+ * @param columnNumber One of the columns in the group.
+ * @param collapsed true = collapse group, false = expand group.
+ */
+ void setColumnGroupCollapsed(int columnNumber, boolean collapsed);
+
+ /**
+ * Create an outline for the provided column range.
+ *
+ * @param fromColumn beginning of the column range.
+ * @param toColumn end of the column range.
+ */
+ void groupColumn(int fromColumn, int toColumn);
+
+ /**
+ * Ungroup a range of columns that were previously groupped
+ *
+ * @param fromColumn start column (0-based)
+ * @param toColumn end column (0-based)
+ */
+ void ungroupColumn(int fromColumn, int toColumn);
+
+ /**
+ * Tie a range of rows together so that they can be collapsed or expanded
+ *
+ * @param fromRow start row (0-based)
+ * @param toRow end row (0-based)
+ */
+ void groupRow(int fromRow, int toRow);
+
+ /**
+ * Ungroup a range of rows that were previously groupped
+ *
+ * @param fromRow start row (0-based)
+ * @param toRow end row (0-based)
+ */
+ void ungroupRow(int fromRow, int toRow);
+
+ /**
+ * Set view state of a groupped range of rows
+ *
+ * @param row start row of a groupped range of rows (0-based)
+ * @param collapse whether to expand/collapse the detail rows
+ */
+ void setRowGroupCollapsed(int row, boolean collapse);
+
+ /**
+ * Sets the default column style for a given column. POI will only apply this style to new cells added to the sheet.
+ *
+ * @param column the column index
+ * @param style the style to set
+ */
+ void setDefaultColumnStyle(int column, CellStyle style);
+
+ /**
+ * Adjusts the column width to fit the contents.
+ *
+ * <p>
+ * This process can be relatively slow on large sheets, so this should
+ * normally only be called once per column, at the end of your
+ * processing.
+ * </p>
+ * You can specify whether the content of merged cells should be considered or ignored.
+ * Default is to ignore merged cells.
+ *
+ * @param column the column index
+ */
+ void autoSizeColumn(int column);
+
+ /**
+ * Adjusts the column width to fit the contents.
+ * <p>
+ * This process can be relatively slow on large sheets, so this should
+ * normally only be called once per column, at the end of your
+ * processing.
+ * </p>
+ * You can specify whether the content of merged cells should be considered or ignored.
+ * Default is to ignore merged cells.
+ *
+ * @param column the column index
+ * @param useMergedCells whether to use the contents of merged cells when calculating the width of the column
+ */
+ void autoSizeColumn(int column, boolean useMergedCells);
+
+ /**
+ * Returns cell comment for the specified row and column
+ *
+ * @return cell comment or <code>null</code> if not found
+ */
+ Comment getCellComment(int row, int column);
+
+ /**
+ * Creates the top-level drawing patriarch.
+ *
+ * @return The new drawing patriarch.
+ */
+ Drawing createDrawingPatriarch();
+
+
+ /**
+ * Return the parent workbook
+ *
+ * @return the parent workbook
+ */
+ Workbook getWorkbook();
+
+ /**
+ * Returns the name of this sheet
+ *
+ * @return the name of this sheet
+ */
+ String getSheetName();
+
+ /**
+ * Note - this is not the same as whether the sheet is focused (isActive)
+ * @return <code>true</code> if this sheet is currently selected
+ */
+ boolean isSelected();
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Textbox.java b/src/java/org/apache/poi/ss/usermodel/Textbox.java
new file mode 100644
index 0000000000..21b7c7c5f3
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Textbox.java
@@ -0,0 +1,74 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+public interface Textbox {
+
+ public final static short OBJECT_TYPE_TEXT = 6;
+
+ /**
+ * @return the rich text string for this textbox.
+ */
+ RichTextString getString();
+
+ /**
+ * @param string Sets the rich text string used by this object.
+ */
+ void setString(RichTextString string);
+
+ /**
+ * @return Returns the left margin within the textbox.
+ */
+ int getMarginLeft();
+
+ /**
+ * Sets the left margin within the textbox.
+ */
+ void setMarginLeft(int marginLeft);
+
+ /**
+ * @return returns the right margin within the textbox.
+ */
+ int getMarginRight();
+
+ /**
+ * Sets the right margin within the textbox.
+ */
+ void setMarginRight(int marginRight);
+
+ /**
+ * @return returns the top margin within the textbox.
+ */
+ int getMarginTop();
+
+ /**
+ * Sets the top margin within the textbox.
+ */
+ void setMarginTop(int marginTop);
+
+ /**
+ * Gets the bottom margin within the textbox.
+ */
+ int getMarginBottom();
+
+ /**
+ * Sets the bottom margin within the textbox.
+ */
+ void setMarginBottom(int marginBottom);
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/VerticalAlignment.java b/src/java/org/apache/poi/ss/usermodel/VerticalAlignment.java
new file mode 100755
index 0000000000..2f93273287
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/VerticalAlignment.java
@@ -0,0 +1,69 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+/**
+ * This enumeration value indicates the type of vertical alignment for a cell, i.e.,
+ * whether it is aligned top, bottom, vertically centered, justified or distributed.
+ */
+public enum VerticalAlignment {
+ /**
+ * The vertical alignment is aligned-to-top.
+ */
+ TOP,
+
+ /**
+ * The vertical alignment is centered across the height of the cell.
+ */
+ CENTER,
+
+ /**
+ * The vertical alignment is aligned-to-bottom.
+ */
+ BOTTOM,
+
+ /**
+ * <p>
+ * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,
+ * where each line of text inside the cell is evenly distributed across the height of the cell,
+ * with flush top and bottom margins.
+ * </p>
+ * <p>
+ * When text direction is vertical: similar behavior as horizontal justification.
+ * The alignment is justified (flush top and bottom in this case). For each line of text, each
+ * line of the wrapped text in a cell is aligned to the top and bottom (except the last line).
+ * If no single line of text wraps in the cell, then the text is not justified.
+ * </p>
+ */
+ JUSTIFY,
+
+ /**
+ * <p>
+ * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,
+ * where each line of text inside the cell is evenly distributed across the height of the cell,
+ * with flush top
+ * </p>
+ * <p>
+ * When text direction is vertical: behaves exactly as distributed horizontal alignment.
+ * The first words in a line of text (appearing at the top of the cell) are flush
+ * with the top edge of the cell, and the last words of a line of text are flush with the bottom edge of the cell,
+ * and the line of text is distributed evenly from top to bottom.
+ * </p>
+ */
+ DISTRIBUTED
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java
new file mode 100644
index 0000000000..051a48f67e
--- /dev/null
+++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java
@@ -0,0 +1,465 @@
+/* ====================================================================
+ 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.ss.usermodel;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
+
+/**
+ * High level representation of a Excel workbook. This is the first object most users
+ * will construct whether they are reading or writing a workbook. It is also the
+ * top level object for creating new sheets/etc.
+ */
+public interface Workbook {
+
+ /** Extended windows meta file */
+ public static final int PICTURE_TYPE_EMF = 2;
+
+ /** Windows Meta File */
+ public static final int PICTURE_TYPE_WMF = 3;
+
+ /** Mac PICT format */
+ public static final int PICTURE_TYPE_PICT = 4;
+
+ /** JPEG format */
+ public static final int PICTURE_TYPE_JPEG = 5;
+
+ /** PNG format */
+ public static final int PICTURE_TYPE_PNG = 6;
+
+ /** Device independent bitmap */
+ public static final int PICTURE_TYPE_DIB = 7;
+
+ /**
+ * Convenience method to get the active sheet. The active sheet is is the sheet
+ * which is currently displayed when the workbook is viewed in Excel.
+ * 'Selected' sheet(s) is a distinct concept.
+ *
+ * @return the index of the active sheet (0-based)
+ */
+ int getActiveSheetIndex();
+
+ /**
+ * Convenience method to set the active sheet. The active sheet is is the sheet
+ * which is currently displayed when the workbook is viewed in Excel.
+ * 'Selected' sheet(s) is a distinct concept.
+ *
+ * @param sheetIndex index of the active sheet (0-based)
+ */
+ void setActiveSheet(int sheetIndex);
+
+ /**
+ * Gets the first tab that is displayed in the list of tabs in excel.
+ *
+ * @return the first tab that to display in the list of tabs (0-based).
+ */
+ int getFirstVisibleTab();
+
+ /**
+ * Sets the first tab that is displayed in the list of tabs in excel.
+ *
+ * @param sheetIndex the first tab that to display in the list of tabs (0-based)
+ */
+ void setFirstVisibleTab(int sheetIndex);
+
+ /**
+ * Sets the order of appearance for a given sheet.
+ *
+ * @param sheetname the name of the sheet to reorder
+ * @param pos the position that we want to insert the sheet into (0 based)
+ */
+ void setSheetOrder(String sheetname, int pos);
+
+ /**
+ * Sets the tab whose data is actually seen when the sheet is opened.
+ * This may be different from the "selected sheet" since excel seems to
+ * allow you to show the data of one sheet when another is seen "selected"
+ * in the tabs (at the bottom).
+ *
+ * @see Sheet#setSelected(boolean)
+ * @param index the index of the sheet to select (0 based)
+ */
+ void setSelectedTab(int index);
+
+ /**
+ * Set the sheet name.
+ *
+ * @param sheet number (0 based)
+ * @throws IllegalArgumentException if the name is greater than 31 chars or contains <code>/\?*[]</code>
+ */
+ void setSheetName(int sheet, String name);
+
+ /**
+ * Set the sheet name
+ *
+ * @param sheet sheet number (0 based)
+ * @return Sheet name
+ */
+ String getSheetName(int sheet);
+
+ /**
+ * Returns the index of the sheet by his name
+ *
+ * @param name the sheet name
+ * @return index of the sheet (0 based)
+ */
+ int getSheetIndex(String name);
+
+ /**
+ * Returns the index of the given sheet
+ *
+ * @param sheet the sheet to look up
+ * @return index of the sheet (0 based)
+ */
+ int getSheetIndex(Sheet sheet);
+
+ /**
+ * Sreate an Sheet for this Workbook, adds it to the sheets and returns
+ * the high level representation. Use this to create new sheets.
+ *
+ * @return Sheet representing the new sheet.
+ */
+ Sheet createSheet();
+
+ /**
+ * Create an Sheet for this Workbook, adds it to the sheets and returns
+ * the high level representation. Use this to create new sheets.
+ *
+ * @param sheetname sheetname to set for the sheet.
+ * @return Sheet representing the new sheet.
+ * @throws IllegalArgumentException if the name is greater than 31 chars or contains <code>/\?*[]</code>
+ */
+ Sheet createSheet(String sheetname);
+
+ /**
+ * Create an Sheet from an existing sheet in the Workbook.
+ *
+ * @return Sheet representing the cloned sheet.
+ */
+ Sheet cloneSheet(int sheetNum);
+
+
+ /**
+ * Get the number of spreadsheets in the workbook
+ *
+ * @return the number of sheets
+ */
+ int getNumberOfSheets();
+
+ /**
+ * Get the Sheet object at the given index.
+ *
+ * @param index of the sheet number (0-based physical & logical)
+ * @return Sheet at the provided index
+ */
+ Sheet getSheetAt(int index);
+
+ /**
+ * Get sheet with the given name
+ *
+ * @param name of the sheet
+ * @return Sheet with the name provided or <code>null</code> if it does not exist
+ */
+ Sheet getSheet(String name);
+
+ /**
+ * Removes sheet at the given index
+ *
+ * @param index of the sheet to remove (0-based)
+ */
+ void removeSheetAt(int index);
+
+ /**
+ * Sets the repeating rows and columns for a sheet (as found in
+ * File->PageSetup->Sheet). This is function is included in the workbook
+ * because it creates/modifies name records which are stored at the
+ * workbook level.
+ * <p>
+ * To set just repeating columns:
+ * <pre>
+ * workbook.setRepeatingRowsAndColumns(0,0,1,-1-1);
+ * </pre>
+ * To set just repeating rows:
+ * <pre>
+ * workbook.setRepeatingRowsAndColumns(0,-1,-1,0,4);
+ * </pre>
+ * To remove all repeating rows and columns for a sheet.
+ * <pre>
+ * workbook.setRepeatingRowsAndColumns(0,-1,-1,-1,-1);
+ * </pre>
+ *
+ * @param sheetIndex 0 based index to sheet.
+ * @param startColumn 0 based start of repeating columns.
+ * @param endColumn 0 based end of repeating columns.
+ * @param startRow 0 based start of repeating rows.
+ * @param endRow 0 based end of repeating rows.
+ */
+ void setRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow);
+
+ /**
+ * Create a new Font and add it to the workbook's font table
+ *
+ * @return new font object
+ */
+ Font createFont();
+
+ /**
+ * Finds a font that matches the one with the supplied attributes
+ *
+ * @return the font with the matched attributes or <code>null</code>
+ */
+ Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline);
+
+ /**
+ * Get the number of fonts in the font table
+ *
+ * @return number of fonts
+ */
+ short getNumberOfFonts();
+
+ /**
+ * Get the font at the given index number
+ *
+ * @param idx index number (0-based)
+ * @return font at the index
+ */
+ Font getFontAt(short idx);
+
+ /**
+ * Create a new Cell style and add it to the workbook's style table
+ *
+ * @return the new Cell Style object
+ */
+ CellStyle createCellStyle();
+
+ /**
+ * Get the number of styles the workbook contains
+ *
+ * @return count of cell styles
+ */
+ short getNumCellStyles();
+
+ /**
+ * Get the cell style object at the given index
+ *
+ * @param idx index within the set of styles (0-based)
+ * @return CellStyle object at the index
+ */
+ CellStyle getCellStyleAt(short idx);
+
+ /**
+ * Write out this workbook to an Outputstream.
+ *
+ * @param stream - the java OutputStream you wish to write to
+ * @exception IOException if anything can't be written.
+ */
+ void write(OutputStream stream) throws IOException;
+
+ /**
+ * Gets the total number of named ranges in the workbook
+ *
+ * @return number of named ranges
+ */
+ int getNumberOfNames();
+
+ /**
+ * Gets the Named range
+ *
+ * @param index position of the named range (0-based)
+ * @return named range high level
+ */
+ Name getNameAt(int index);
+
+ /**
+ * Creates a new named range in this workbook
+ *
+ * @return new named range object
+ */
+ Name createName();
+
+ /**
+ * Gets the named range index by his name
+ * <i>Note:</i>Excel named ranges are case-insensitive and
+ * this method performs a case-insensitive search.
+ *
+ * @param name named range name
+ * @return named range index
+ */
+ int getNameIndex(String name);
+
+ /**
+ * Remove the named range by his index
+ *
+ * @param index named range index (0 based)
+ */
+ void removeName(int index);
+
+ /**
+ * Remove the named range by his name
+ *
+ * @param name named range name
+ */
+ void removeName(String name);
+
+ /**
+ * Sets the printarea for the sheet provided
+ * <p>
+ * i.e. Reference = $A$1:$B$2
+ * @param sheetIndex Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
+ * @param reference Valid name Reference for the Print Area
+ */
+ void setPrintArea(int sheetIndex, String reference);
+
+ /**
+ * For the Convenience of Java Programmers maintaining pointers.
+ * @see #setPrintArea(int, String)
+ * @param sheetIndex Zero-based sheet index (0 = First Sheet)
+ * @param startColumn Column to begin printarea
+ * @param endColumn Column to end the printarea
+ * @param startRow Row to begin the printarea
+ * @param endRow Row to end the printarea
+ */
+ void setPrintArea(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow);
+
+ /**
+ * Retrieves the reference for the printarea of the specified sheet,
+ * the sheet name is appended to the reference even if it was not specified.
+ *
+ * @param sheetIndex Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
+ * @return String Null if no print area has been defined
+ */
+ String getPrintArea(int sheetIndex);
+
+ /**
+ * Delete the printarea for the sheet specified
+ *
+ * @param sheetIndex Zero-based sheet index (0 = First Sheet)
+ */
+ void removePrintArea(int sheetIndex);
+
+ /**
+ * Retrieves the current policy on what to do when
+ * getting missing or blank cells from a row.
+ * <p>
+ * The default is to return blank and null cells.
+ * {@link MissingCellPolicy}
+ * </p>
+ */
+ MissingCellPolicy getMissingCellPolicy();
+
+ /**
+ * 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 Row#getCell(int)} }. See
+ * {@link MissingCellPolicy}
+ */
+ void setMissingCellPolicy(MissingCellPolicy missingCellPolicy);
+
+ /**
+ * Returns the instance of DataFormat for this workbook.
+ *
+ * @return the DataFormat object
+ */
+ DataFormat createDataFormat();
+
+ /**
+ * Adds a picture to the workbook.
+ *
+ * @param pictureData The bytes of the picture
+ * @param format The format of the picture.
+ *
+ * @return the index to this picture (1 based).
+ * @see #PICTURE_TYPE_EMF
+ * @see #PICTURE_TYPE_WMF
+ * @see #PICTURE_TYPE_PICT
+ * @see #PICTURE_TYPE_JPEG
+ * @see #PICTURE_TYPE_PNG
+ * @see #PICTURE_TYPE_DIB
+ */
+ int addPicture(byte[] pictureData, int format);
+
+ /**
+ * Gets all pictures from the Workbook.
+ *
+ * @return the list of pictures (a list of {@link PictureData} objects.)
+ */
+ List getAllPictures();
+
+ /**
+ * Returns an object that handles instantiating concrete
+ * classes of the various instances one needs for HSSF and XSSF.
+ */
+ CreationHelper getCreationHelper();
+
+ /**
+ * @return <code>false</code> if this workbook is not visible in the GUI
+ */
+ boolean isHidden();
+
+ /**
+ * @param hiddenFlag pass <code>false</code> to make the workbook visible in the GUI
+ */
+ void setHidden(boolean hiddenFlag);
+
+ /**
+ * Check whether a sheet is hidden.
+ * <p>
+ * Note that a sheet could instead be set to be very hidden, which is different
+ * ({@link #isSheetVeryHidden(int)})
+ * </p>
+ * @param sheetIx Number
+ * @return <code>true</code> if sheet is hidden
+ */
+ boolean isSheetHidden(int sheetIx);
+
+ /**
+ * Check whether a sheet is very hidden.
+ * <p>
+ * This is different from the normal hidden status
+ * ({@link #isSheetHidden(int)})
+ * </p>
+ * @param sheetIx sheet index to check
+ * @return <code>true</code> if sheet is very hidden
+ */
+ boolean isSheetVeryHidden(int sheetIx);
+
+ /**
+ * Hide or unhide a sheet
+ *
+ * @param sheetIx the sheet index (0-based)
+ * @param hidden True to mark the sheet as hidden, false otherwise
+ */
+ void setSheetHidden(int sheetIx, boolean hidden);
+
+ /**
+ * Hide or unhide a sheet.
+ * <pre>
+ * 0 = not hidden
+ * 1 = hidden
+ * 2 = very hidden.
+ * </pre>
+ * @param sheetIx The sheet number
+ * @param hidden 0 for not hidden, 1 for hidden, 2 for very hidden
+ */
+ void setSheetHidden(int sheetIx, int hidden);
+}