</javac>
</target>
- <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
+ <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main, compile-scratchpad">
<!-- openxml4j requires java 1.5, so so must we, for now -->
<javac target="1.5" source="1.5"
destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
import java.io.FileOutputStream;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.xssf.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileOutputStream;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.CreationHelper;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.Hyperlink;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.apache.poi.xssf.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.IndexedColors;
/**
* Demonstrates how to create hyperlinks.
package org.apache.poi.xssf.usermodel.examples;\r
\r
import org.apache.poi.xssf.usermodel.XSSFWorkbook;\r
-import org.apache.poi.xssf.usermodel.IndexedColors;\r
+import org.apache.poi.ss.usermodel.IndexedColors;\r
import org.apache.poi.ss.usermodel.*;\r
\r
import java.io.FileOutputStream;\r
==================================================================== */\r
package org.apache.poi.xssf.usermodel.examples;\r
\r
-import org.apache.poi.hssf.usermodel.HSSFFont;\r
-import org.apache.poi.hssf.util.HSSFColor;\r
import org.apache.poi.ss.usermodel.*;\r
import org.apache.poi.xssf.usermodel.XSSFWorkbook;\r
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;\r
-import org.apache.poi.xssf.usermodel.IndexedColors;\r
-import org.apache.poi.xssf.usermodel.extensions.XSSFColor;\r
+import org.apache.poi.ss.usermodel.IndexedColors;\r
\r
import java.io.FileOutputStream;\r
\r
\r
import org.apache.poi.xssf.usermodel.*;\r
import org.apache.poi.ss.usermodel.*;\r
-import org.apache.poi.hssf.util.HSSFColor;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;\r
\r
import java.io.FileOutputStream;\r
-import java.io.Writer;\r
-import java.io.StringWriter;\r
\r
/**\r
* Demonstrates how to work with rich text\r
import org.apache.poi.hssf.record.PaletteRecord;
import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.ss.usermodel.Palette;
/**
* Represents a workbook color palette.
*
* @author Brian Sanders (bsanders at risklabs dot com)
*/
-public class HSSFPalette implements Palette
+public class HSSFPalette
{
private PaletteRecord palette;
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperty;
import org.apache.poi.hssf.record.EscherAggregate;
-import org.apache.poi.ss.usermodel.Patriarch;
import org.apache.poi.util.StringUtil;
/**
* @author Glen Stampoultzis (glens at apache.org)
*/
public class HSSFPatriarch
- implements HSSFShapeContainer, Patriarch
+ implements HSSFShapeContainer
{
List shapes = new ArrayList();
HSSFSheet sheet;
--- /dev/null
+/* ====================================================================
+ 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;
+
+}
public final static short LEAST_DOTS = 18;
/**
- * get the index within the HSSFWorkbook (sequence within the collection of ExtnededFormat objects)
+ * 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)
*/
/**
* set the data format (must be a valid format)
- * @see org.apache.poi.hssf.usermodel.HSSFDataFormat
+ * @see DataFormat
*/
void setDataFormat(short fmt);
/**
* get the index of the format
- * @see org.apache.poi.hssf.usermodel.HSSFDataFormat
+ * @see DataFormat
*/
short getDataFormat();
*/
public String getDataFormatString();
- /**
- * Get the contents of the format string, by looking up
- * the DataFormat against the supplied workbook
- * @see org.apache.poi.hssf.usermodel.HSSFDataFormat
- * XXX Commented out because it uses internal implementation Workbook class.
- *
- String getDataFormatString(Workbook workbook);
- */
-
/**
* set the font for this style
- * @param font a font object created or retreived from the HSSFWorkbook object
- * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createFont()
- * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
+ * @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 org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
+ * @see Workbook#getFontAt(short)
*/
short getFontIndex();
/**
* get the color to use for the left border
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
*/
short getLeftBorderColor();
/**
* get the color to use for the left border
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return the index of the color definition
*/
short getRightBorderColor();
/**
* get the color to use for the top border
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return hhe index of the color definition
*/
short getTopBorderColor();
/**
* get the color to use for the left border
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
- * @param color The index of the color definition
+ * @return the index of the color definition
*/
short getBottomBorderColor();
/**
* set the background fill color.
- * <p>
- * For example:
- * <pre>
- * cs.setFillPattern(HSSFCellStyle.FINE_DOTS );
- * cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());
- * </pre>
- * optionally a Foreground and background fill can be applied:
- * <i>Note: Ensure Foreground color is set prior to background</i>
- * <pre>
- * cs.setFillPattern(HSSFCellStyle.FINE_DOTS );
- * cs.setFillForegroundColor(new HSSFColor.BLUE().getIndex());
- * cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());
- * </pre>
- * or, for the special case of SOLID_FILL:
- * <pre>
- * cs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
- * cs.setFillForegroundColor(new HSSFColor.RED().getIndex());
- * </pre>
- * It is necessary to set the fill style in order
- * for the color to be shown in the cell.
*
* @param bg color
*/
/**
* get the background fill color
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
* @return fill color
*/
short getFillBackgroundColor();
/**
* get the foreground fill color
- * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
* @return fill color
*/
short getFillForegroundColor();
+++ /dev/null
-/* ====================================================================
- 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;
-
-/**
- * Allows the getting and saving of cell comments,
- * associated with a given sheet.
- */
-public interface CommentsSource {
- public String getAuthor(long authorId);
-
- public int getNumberOfComments();
-
- public int findAuthor(String author);
-
- public Comment findCellComment(int row, int column);
-
- public Comment findCellComment(String cellRef);
-
- public Comment addComment();
-}
--- /dev/null
+/* ====================================================================
+ 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;
+
+}
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
--- /dev/null
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.xssf.usermodel;
+
+import org.apache.poi.ss.usermodel.Font;
+
+/**
+ * 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;
+ }
+
+}
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.ss.usermodel;\r
+\r
+/**\r
+ * The enumeration value indicating horizontal alignment of a cell,\r
+ * i.e., whether it is aligned general, left, right, horizontally centered, filled (replicated),\r
+ * justified, centered across multiple cells, or distributed.\r
+ */\r
+public enum HorizontalAlignment {\r
+ /**\r
+ * The horizontal alignment is general-aligned. Text data is left-aligned.\r
+ * Numbers, dates, and times are rightaligned. Boolean types are centered.\r
+ * Changing the alignment does not change the type of data.\r
+ */\r
+ GENERAL,\r
+\r
+ /**\r
+ * The horizontal alignment is left-aligned, even in Rightto-Left mode.\r
+ * Aligns contents at the left edge of the cell. If an indent amount is specified, the contents of\r
+ * the cell is indented from the left by the specified number of character spaces. The character spaces are\r
+ * based on the default font and font size for the workbook.\r
+ */\r
+ LEFT,\r
+\r
+ /**\r
+ * The horizontal alignment is centered, meaning the text is centered across the cell.\r
+ */\r
+ CENTER,\r
+\r
+ /**\r
+ * The horizontal alignment is right-aligned, meaning that cell contents are aligned at the right edge of the cell,\r
+ * even in Right-to-Left mode.\r
+ */\r
+ RIGHT,\r
+\r
+ /**\r
+ * Indicates that the value of the cell should be filled\r
+ * across the entire width of the cell. If blank cells to the right also have the fill alignment,\r
+ * they are also filled with the value, using a convention similar to centerContinuous.\r
+ * <p>\r
+ * Additional rules:\r
+ * <ol>\r
+ * <li>Only whole values can be appended, not partial values.</li>\r
+ * <li>The column will not be widened to 'best fit' the filled value</li>\r
+ * <li>If appending an additional occurrence of the value exceeds the boundary of the cell\r
+ * left/right edge, don't append the additional occurrence of the value.</li>\r
+ * <li>The display value of the cell is filled, not the underlying raw number.</li>\r
+ * </ol>\r
+ * </p>\r
+ */\r
+ FILL,\r
+\r
+ /**\r
+ * The horizontal alignment is justified (flush left and right).\r
+ * For each line of text, aligns each line of the wrapped text in a cell to the right and left\r
+ * (except the last line). If no single line of text wraps in the cell, then the text is not justified.\r
+ */\r
+ JUSTIFY,\r
+\r
+ /**\r
+ * The horizontal alignment is centered across multiple cells.\r
+ * The information about how many cells to span is expressed in the Sheet Part,\r
+ * in the row of the cell in question. For each cell that is spanned in the alignment,\r
+ * a cell element needs to be written out, with the same style Id which references the centerContinuous alignment.\r
+ */\r
+ CENTER_SELECTION,\r
+\r
+ /**\r
+ * Indicates that each 'word' in each line of text inside the cell is evenly distributed\r
+ * across the width of the cell, with flush right and left margins.\r
+ * <p>\r
+ * When there is also an indent value to apply, both the left and right side of the cell\r
+ * are padded by the indent value.\r
+ * </p>\r
+ * <p> A 'word' is a set of characters with no space character in them. </p>\r
+ * <p> Two lines inside a cell are separated by a carriage return. </p>\r
+ */\r
+ DISTRIBUTED\r
+}\r
--- /dev/null
+/* ====================================================================
+ 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;
+ }
+}
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
+++ /dev/null
-/* ====================================================================
- 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 Palette {
-
- /**
- * Retrieves the color at a given index
- *
- * @param index the palette index, between 0x8 to 0x40 inclusive
- * @return the color, or null if the index is not populated
- */
- Color getColor(short index);
-
- /**
- * Finds the first occurance of a given color
- *
- * @param red the RGB red component, between 0 and 255 inclusive
- * @param green the RGB green component, between 0 and 255 inclusive
- * @param blue the RGB blue component, between 0 and 255 inclusive
- * @return the color, or null if the color does not exist in this palette
- */
- Color findColor(byte red, byte green, byte blue);
-
- /**
- * Finds the closest matching color in the custom palette. The
- * method for finding the distance between the colors is fairly
- * primative.
- *
- * @param red The red component of the color to match.
- * @param green The green component of the color to match.
- * @param blue The blue component of the color to match.
- * @return The closest color or null if there are no custom
- * colors currently defined.
- */
- Color findSimilarColor(byte red, byte green, byte blue);
-
- /**
- * Sets the color at the given offset
- *
- * @param index the palette index, between 0x8 to 0x40 inclusive
- * @param red the RGB red component, between 0 and 255 inclusive
- * @param green the RGB green component, between 0 and 255 inclusive
- * @param blue the RGB blue component, between 0 and 255 inclusive
- */
- void setColorAtIndex(short index, byte red, byte green, byte blue);
-
- /**
- * Adds a new color into an empty color slot.
- * @param red The red component
- * @param green The green component
- * @param blue The blue component
- *
- * @return The new custom color.
- *
- * @throws RuntimeException if there are more more free color indexes.
- */
- Color addColor(byte red, byte green, byte blue);
-
-}
\ No newline at end of file
--- /dev/null
+/* ====================================================================
+ 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;
+}
+++ /dev/null
-/* ====================================================================
- 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.List;
-
-import org.apache.poi.hssf.usermodel.HSSFAnchor;
-import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
-import org.apache.poi.hssf.usermodel.HSSFComment;
-import org.apache.poi.hssf.usermodel.HSSFPicture;
-import org.apache.poi.hssf.usermodel.HSSFPolygon;
-import org.apache.poi.hssf.usermodel.HSSFShapeGroup;
-import org.apache.poi.hssf.usermodel.HSSFSimpleShape;
-import org.apache.poi.hssf.usermodel.HSSFTextbox;
-
-public interface Patriarch {
-
- /**
- * Creates a new group record stored under this patriarch.
- *
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created group.
- */
- HSSFShapeGroup createGroup(HSSFClientAnchor anchor);
-
- /**
- * Creates a simple shape. This includes such shapes as lines, rectangles,
- * and ovals.
- *
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
- */
- HSSFSimpleShape createSimpleShape(HSSFClientAnchor anchor);
-
- /**
- * Creates a picture.
- *
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
- */
- HSSFPicture createPicture(HSSFClientAnchor anchor, int pictureIndex);
-
- /**
- * Creates a polygon
- *
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
- */
- HSSFPolygon createPolygon(HSSFClientAnchor anchor);
-
- /**
- * Constructs a textbox under the patriarch.
- *
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created textbox.
- */
- HSSFTextbox createTextbox(HSSFClientAnchor anchor);
-
- /**
- * Constructs a cell comment.
- *
- * @param anchor the client anchor describes how this comment is attached
- * to the sheet.
- * @return the newly created comment.
- */
- HSSFComment createComment(HSSFAnchor anchor);
-
- /**
- * Returns a list of all shapes contained by the patriarch.
- */
- List getChildren();
-
- /**
- * Total count of all children and their children's children.
- */
- int countOfAllChildren();
-
- /**
- * Sets the coordinate space of this group. All children are contrained
- * to these coordinates.
- */
- void setCoordinates(int x1, int y1, int x2, int y2);
-
- /**
- * The top left x coordinate of this group.
- */
- int getX1();
-
- /**
- * The top left y coordinate of this group.
- */
- int getY1();
-
- /**
- * The bottom right x coordinate of this group.
- */
- int getX2();
-
- /**
- * The bottom right y coordinate of this group.
- */
- int getY2();
-
-}
\ No newline at end of file
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
--- /dev/null
+/* ====================================================================
+ 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];
+ }
+}
import java.util.Iterator;
public interface Row extends Iterable<Cell> {
-
- // used for collections
- public final static int INITIAL_CAPACITY = 5;
-
/**
* Use this to create new cells within the row and return it.
* <p>
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.ss.usermodel;\r
+\r
+/**\r
+ * All known types of automatic shapes in DrawingML\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class ShapeTypes {\r
+ public static final int LINE = 1;\r
+ public static final int LINE_INV = 2;\r
+ public static final int TRIANGLE = 3;\r
+ public static final int RT_TRIANGLE = 4;\r
+ public static final int RECT = 5;\r
+ public static final int DIAMOND = 6;\r
+ public static final int PARALLELOGRAM = 7;\r
+ public static final int TRAPEZOID = 8;\r
+ public static final int NON_ISOSCELES_TRAPEZOID = 9;\r
+ public static final int PENTAGON = 10;\r
+ public static final int HEXAGON = 11;\r
+ public static final int HEPTAGON = 12;\r
+ public static final int OCTAGON = 13;\r
+ public static final int DECAGON = 14;\r
+ public static final int DODECAGON = 15;\r
+ public static final int STAR_4 = 16;\r
+ public static final int STAR_5 = 17;\r
+ public static final int STAR_6 = 18;\r
+ public static final int STAR_7 = 19;\r
+ public static final int STAR_8 = 20;\r
+ public static final int STAR_10 = 21;\r
+ public static final int STAR_12 = 22;\r
+ public static final int STAR_16 = 23;\r
+ public static final int STAR_24 = 24;\r
+ public static final int STAR_32 = 25;\r
+ public static final int ROUND_RECT = 26;\r
+ public static final int ROUND_1_RECT = 27;\r
+ public static final int ROUND_2_SAME_RECT = 28;\r
+ public static final int ROUND_2_DIAG_RECT = 29;\r
+ public static final int SNIP_ROUND_RECT = 30;\r
+ public static final int SNIP_1_RECT = 31;\r
+ public static final int SNIP_2_SAME_RECT = 32;\r
+ public static final int SNIP_2_DIAG_RECT = 33;\r
+ public static final int PLAQUE = 34;\r
+ public static final int ELLIPSE = 35;\r
+ public static final int TEARDROP = 36;\r
+ public static final int HOME_PLATE = 37;\r
+ public static final int CHEVRON = 38;\r
+ public static final int PIE_WEDGE = 39;\r
+ public static final int PIE = 40;\r
+ public static final int BLOCK_ARC = 41;\r
+ public static final int DONUT = 42;\r
+ public static final int NO_SMOKING = 43;\r
+ public static final int RIGHT_ARROW = 44;\r
+ public static final int LEFT_ARROW = 45;\r
+ public static final int UP_ARROW = 46;\r
+ public static final int DOWN_ARROW = 47;\r
+ public static final int STRIPED_RIGHT_ARROW = 48;\r
+ public static final int NOTCHED_RIGHT_ARROW = 49;\r
+ public static final int BENT_UP_ARROW = 50;\r
+ public static final int LEFT_RIGHT_ARROW = 51;\r
+ public static final int UP_DOWN_ARROW = 52;\r
+ public static final int LEFT_UP_ARROW = 53;\r
+ public static final int LEFT_RIGHT_UP_ARROW = 54;\r
+ public static final int QUAD_ARROW = 55;\r
+ public static final int LEFT_ARROW_CALLOUT = 56;\r
+ public static final int RIGHT_ARROW_CALLOUT = 57;\r
+ public static final int UP_ARROW_CALLOUT = 58;\r
+ public static final int DOWN_ARROW_CALLOUT = 59;\r
+ public static final int LEFT_RIGHT_ARROW_CALLOUT = 60;\r
+ public static final int UP_DOWN_ARROW_CALLOUT = 61;\r
+ public static final int QUAD_ARROW_CALLOUT = 62;\r
+ public static final int BENT_ARROW = 63;\r
+ public static final int UTURN_ARROW = 64;\r
+ public static final int CIRCULAR_ARROW = 65;\r
+ public static final int LEFT_CIRCULAR_ARROW = 66;\r
+ public static final int LEFT_RIGHT_CIRCULAR_ARROW = 67;\r
+ public static final int CURVED_RIGHT_ARROW = 68;\r
+ public static final int CURVED_LEFT_ARROW = 69;\r
+ public static final int CURVED_UP_ARROW = 70;\r
+ public static final int CURVED_DOWN_ARROW = 71;\r
+ public static final int SWOOSH_ARROW = 72;\r
+ public static final int CUBE = 73;\r
+ public static final int CAN = 74;\r
+ public static final int LIGHTNING_BOLT = 75;\r
+ public static final int HEART = 76;\r
+ public static final int SUN = 77;\r
+ public static final int MOON = 78;\r
+ public static final int SMILEY_FACE = 79;\r
+ public static final int IRREGULAR_SEAL_1 = 80;\r
+ public static final int IRREGULAR_SEAL_2 = 81;\r
+ public static final int FOLDED_CORNER = 82;\r
+ public static final int BEVEL = 83;\r
+ public static final int FRAME = 84;\r
+ public static final int HALF_FRAME = 85;\r
+ public static final int CORNER = 86;\r
+ public static final int DIAG_STRIPE = 87;\r
+ public static final int CHORD = 88;\r
+ public static final int ARC = 89;\r
+ public static final int LEFT_BRACKET = 90;\r
+ public static final int RIGHT_BRACKET = 91;\r
+ public static final int LEFT_BRACE = 92;\r
+ public static final int RIGHT_BRACE = 93;\r
+ public static final int BRACKET_PAIR = 94;\r
+ public static final int BRACE_PAIR = 95;\r
+ public static final int STRAIGHT_CONNECTOR_1 = 96;\r
+ public static final int BENT_CONNECTOR_2 = 97;\r
+ public static final int BENT_CONNECTOR_3 = 98;\r
+ public static final int BENT_CONNECTOR_4 = 99;\r
+ public static final int BENT_CONNECTOR_5 = 100;\r
+ public static final int CURVED_CONNECTOR_2 = 101;\r
+ public static final int CURVED_CONNECTOR_3 = 102;\r
+ public static final int CURVED_CONNECTOR_4 = 103;\r
+ public static final int CURVED_CONNECTOR_5 = 104;\r
+ public static final int CALLOUT_1 = 105;\r
+ public static final int CALLOUT_2 = 106;\r
+ public static final int CALLOUT_3 = 107;\r
+ public static final int ACCENT_CALLOUT_1 = 108;\r
+ public static final int ACCENT_CALLOUT_2 = 109;\r
+ public static final int ACCENT_CALLOUT_3 = 110;\r
+ public static final int BORDER_CALLOUT_1 = 111;\r
+ public static final int BORDER_CALLOUT_2 = 112;\r
+ public static final int BORDER_CALLOUT_3 = 113;\r
+ public static final int ACCENT_BORDER_CALLOUT_1 = 114;\r
+ public static final int ACCENT_BORDER_CALLOUT_2 = 115;\r
+ public static final int ACCENT_BORDER_CALLOUT_3 = 116;\r
+ public static final int WEDGE_RECT_CALLOUT = 117;\r
+ public static final int WEDGE_ROUND_RECT_CALLOUT = 118;\r
+ public static final int WEDGE_ELLIPSE_CALLOUT = 119;\r
+ public static final int CLOUD_CALLOUT = 120;\r
+ public static final int CLOUD = 121;\r
+ public static final int RIBBON = 122;\r
+ public static final int RIBBON_2 = 123;\r
+ public static final int ELLIPSE_RIBBON = 124;\r
+ public static final int ELLIPSE_RIBBON_2 = 125;\r
+ public static final int LEFT_RIGHT_RIBBON = 126;\r
+ public static final int VERTICAL_SCROLL = 127;\r
+ public static final int HORIZONTAL_SCROLL = 128;\r
+ public static final int WAVE = 129;\r
+ public static final int DOUBLE_WAVE = 130;\r
+ public static final int PLUS = 131;\r
+ public static final int FLOW_CHART_PROCESS = 132;\r
+ public static final int FLOW_CHART_DECISION = 133;\r
+ public static final int FLOW_CHART_INPUT_OUTPUT = 134;\r
+ public static final int FLOW_CHART_PREDEFINED_PROCESS = 135;\r
+ public static final int FLOW_CHART_INTERNAL_STORAGE = 136;\r
+ public static final int FLOW_CHART_DOCUMENT = 137;\r
+ public static final int FLOW_CHART_MULTIDOCUMENT = 138;\r
+ public static final int FLOW_CHART_TERMINATOR = 139;\r
+ public static final int FLOW_CHART_PREPARATION = 140;\r
+ public static final int FLOW_CHART_MANUAL_INPUT = 141;\r
+ public static final int FLOW_CHART_MANUAL_OPERATION = 142;\r
+ public static final int FLOW_CHART_CONNECTOR = 143;\r
+ public static final int FLOW_CHART_PUNCHED_CARD = 144;\r
+ public static final int FLOW_CHART_PUNCHED_TAPE = 145;\r
+ public static final int FLOW_CHART_SUMMING_JUNCTION = 146;\r
+ public static final int FLOW_CHART_OR = 147;\r
+ public static final int FLOW_CHART_COLLATE = 148;\r
+ public static final int FLOW_CHART_SORT = 149;\r
+ public static final int FLOW_CHART_EXTRACT = 150;\r
+ public static final int FLOW_CHART_MERGE = 151;\r
+ public static final int FLOW_CHART_OFFLINE_STORAGE = 152;\r
+ public static final int FLOW_CHART_ONLINE_STORAGE = 153;\r
+ public static final int FLOW_CHART_MAGNETIC_TAPE = 154;\r
+ public static final int FLOW_CHART_MAGNETIC_DISK = 155;\r
+ public static final int FLOW_CHART_MAGNETIC_DRUM = 156;\r
+ public static final int FLOW_CHART_DISPLAY = 157;\r
+ public static final int FLOW_CHART_DELAY = 158;\r
+ public static final int FLOW_CHART_ALTERNATE_PROCESS = 159;\r
+ public static final int FLOW_CHART_OFFPAGE_CONNECTOR = 160;\r
+ public static final int ACTION_BUTTON_BLANK = 161;\r
+ public static final int ACTION_BUTTON_HOME = 162;\r
+ public static final int ACTION_BUTTON_HELP = 163;\r
+ public static final int ACTION_BUTTON_INFORMATION = 164;\r
+ public static final int ACTION_BUTTON_FORWARD_NEXT = 165;\r
+ public static final int ACTION_BUTTON_BACK_PREVIOUS = 166;\r
+ public static final int ACTION_BUTTON_END = 167;\r
+ public static final int ACTION_BUTTON_BEGINNING = 168;\r
+ public static final int ACTION_BUTTON_RETURN = 169;\r
+ public static final int ACTION_BUTTON_DOCUMENT = 170;\r
+ public static final int ACTION_BUTTON_SOUND = 171;\r
+ public static final int ACTION_BUTTON_MOVIE = 172;\r
+ public static final int GEAR_6 = 173;\r
+ public static final int GEAR_9 = 174;\r
+ public static final int FUNNEL = 175;\r
+ public static final int MATH_PLUS = 176;\r
+ public static final int MATH_MINUS = 177;\r
+ public static final int MATH_MULTIPLY = 178;\r
+ public static final int MATH_DIVIDE = 179;\r
+ public static final int MATH_EQUAL = 180;\r
+ public static final int MATH_NOT_EQUAL = 181;\r
+ public static final int CORNER_TABS = 182;\r
+ public static final int SQUARE_TABS = 183;\r
+ public static final int PLAQUE_TABS = 184;\r
+ public static final int CHART_X = 185;\r
+ public static final int CHART_STAR = 186;\r
+ public static final int CHART_PLUS = 187;\r
+}\r
public static final byte PANE_UPPER_LEFT = (byte) 3;
- /**
- * Used for compile-time optimization. This is the initial size for the collection of
- * rows. It is currently set to 20. If you generate larger sheets you may benefit
- * by setting this to a higher number and recompiling a custom edition of HSSFSheet.
- */
-
- public final static int INITIAL_CAPACITY = 20;
-
/**
* Create a new row within the sheet and return the high level representation
*
* @param rownum row number
- * @return High level HSSFRow object representing a row in the sheet
- * @see org.apache.poi.hssf.usermodel.HSSFRow
+ * @return High level Row object representing a row in the sheet
+ * @see Row
* @see #removeRow(Row)
*/
Row createRow(int rownum);
* 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
- * @return HSSFRow representing the rownumber or null if its not defined on the sheet
+ * @return Row representing the rownumber or null if its not defined on the sheet
*/
Row getRow(int rownum);
+++ /dev/null
-/* ====================================================================
- 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 StylesSource {
- public String getNumberFormatAt(long idx);
- public long putNumberFormat(String fmt);
-
- public Font getFontAt(long idx);
- public long putFont(Font font);
-
- public CellStyle getStyleAt(long idx);
- public long putStyle(CellStyle style);
-}
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.ss.usermodel;\r
+\r
+/**\r
+ * This enumeration value indicates the type of vertical alignment for a cell, i.e.,\r
+ * whether it is aligned top, bottom, vertically centered, justified or distributed.\r
+ */\r
+public enum VerticalAlignment {\r
+ /**\r
+ * The vertical alignment is aligned-to-top.\r
+ */\r
+ TOP,\r
+\r
+ /**\r
+ * The vertical alignment is centered across the height of the cell.\r
+ */\r
+ CENTER,\r
+\r
+ /**\r
+ * The vertical alignment is aligned-to-bottom.\r
+ */\r
+ BOTTOM,\r
+\r
+ /**\r
+ * <p>\r
+ * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,\r
+ * where each line of text inside the cell is evenly distributed across the height of the cell,\r
+ * with flush top and bottom margins.\r
+ * </p>\r
+ * <p>\r
+ * When text direction is vertical: similar behavior as horizontal justification.\r
+ * The alignment is justified (flush top and bottom in this case). For each line of text, each\r
+ * line of the wrapped text in a cell is aligned to the top and bottom (except the last line).\r
+ * If no single line of text wraps in the cell, then the text is not justified.\r
+ * </p>\r
+ */\r
+ JUSTIFY,\r
+\r
+ /**\r
+ * <p>\r
+ * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,\r
+ * where each line of text inside the cell is evenly distributed across the height of the cell,\r
+ * with flush top\r
+ * </p>\r
+ * <p>\r
+ * When text direction is vertical: behaves exactly as distributed horizontal alignment.\r
+ * The first words in a line of text (appearing at the top of the cell) are flush\r
+ * 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,\r
+ * and the line of text is distributed evenly from top to bottom.\r
+ * </p>\r
+ */\r
+ DISTRIBUTED\r
+}\r
public interface Workbook {
- /**
- * used for compile-time performance/memory optimization. This determines the
- * initial capacity for the sheet collection. Its currently set to 3.
- * Changing it in this release will decrease performance
- * since you're never allowed to have more or less than three sheets!
- */
-
- public final static int INITIAL_CAPACITY = 3;
-
/** Extended windows meta file */
public static final int PICTURE_TYPE_EMF = 2;
* 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 org.apache.poi.hssf.usermodel.HSSFSheet#setSelected(boolean)
+ * @see Sheet#setSelected(boolean)
* @param index
*/
void setSelectedTab(short index);
- /**
- * gets 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 org.apache.poi.hssf.usermodel.HSSFSheet#setSelected(boolean)
- */
- short getSelectedTab();
-
/**
* set the sheet name.
* Will throw IllegalArgumentException if the name is greater than 31 chars
int getSheetIndex(Sheet sheet);
/**
- * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
+ * create an Sheet for this Workbook, adds it to the sheets and returns
* the high level representation. Use this to create new sheets.
*
- * @return HSSFSheet representing the new sheet.
+ * @return Sheet representing the new sheet.
*/
Sheet createSheet();
/**
- * create an HSSFSheet from an existing sheet in the HSSFWorkbook.
+ * create an Sheet from an existing sheet in the Workbook.
*
- * @return HSSFSheet representing the cloned sheet.
+ * @return Sheet representing the cloned sheet.
*/
Sheet cloneSheet(int sheetNum);
/**
- * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
+ * 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 HSSFSheet representing the new sheet.
+ * @return Sheet representing the new sheet.
*/
Sheet createSheet(String sheetname);
int getNumberOfSheets();
/**
- * Get the HSSFSheet object at the given index.
+ * Get the Sheet object at the given index.
* @param index of the sheet number (0-based physical & logical)
- * @return HSSFSheet at the provided index
+ * @return Sheet at the provided index
*/
Sheet getSheetAt(int index);
/**
* Get sheet with the given name
* @param name of the sheet
- * @return HSSFSheet with the name provided or null if it does not exist
+ * @return Sheet with the name provided or null if it does not exist
*/
Sheet getSheet(String name);
/**
* get the font at the given index number
* @param idx index number
- * @return HSSFFont at the index
+ * @return XSSFFont at the index
*/
Font getFontAt(short idx);
/**
* get the cell style object at the given index
* @param idx index within the set of styles
- * @return HSSFCellStyle object at the index
+ * @return CellStyle object at the index
*/
CellStyle getCellStyleAt(short idx);
*/
Name getNameAt(int index);
- /** gets the named range name
- * @param index the named range index (0 based)
- * @return named range name
- */
- String getNameName(int index);
-
/**
* Sets the printarea for the sheet provided
* <p>
void removeName(int index);
/**
- * Returns the instance of HSSFDataFormat for this workbook.
- * @return the HSSFDataFormat object
- * @see org.apache.poi.hssf.record.FormatRecord
- * @see org.apache.poi.hssf.record.Record
+ * Returns the instance of DataFormat for this workbook.
+ * @return the DataFormat object
*/
DataFormat createDataFormat();
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.xssf.model;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * An implementation of XSSFModel for binary parts of
- * the file, eg images or vba macros
- */
-public class BinaryPart implements XSSFModel {
- private byte[] data;
-
- public BinaryPart(InputStream in) throws IOException {
- readFrom(in);
- }
-
- /**
- * Fetch the contents of the binary part
- */
- public byte[] getContents() {
- return data;
- }
- /**
- * Changes the contents of the binary part
- */
- public void setContents(byte[] data) {
- this.data = data;
- }
-
- /**
- * Reads the contents of the binary part in.
- */
- public void readFrom(InputStream is) throws IOException {
- int read = 0;
- byte[] buffer = new byte[4096];
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- while( (read = is.read(buffer)) != -1 ) {
- if(read > 0) {
- baos.write(buffer, 0, read);
- }
- }
- data = baos.toByteArray();
- }
-
- public void writeTo(OutputStream out) throws IOException {
- out.write(data);
- }
-}
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.poi.ss.usermodel.CommentsSource;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFComment;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAuthors;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList;
+++ /dev/null
-package org.apache.poi.xssf.model;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-import org.apache.poi.xssf.usermodel.XSSFActiveXData;
-import org.apache.poi.xssf.usermodel.XSSFRelation;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlOptions;
-import org.openxml4j.opc.PackagePart;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTControl;
-
-/**
- * A control object in XSSF, which will typically
- * have active x data associated with it.
- */
-public class Control implements XSSFChildContainingModel {
- private CTControl control;
- private String originalId;
- private ArrayList<XSSFActiveXData> activexBins;
-
- public Control(InputStream is, String originalId) throws IOException {
- readFrom(is);
- this.originalId = originalId;
- this.activexBins = new ArrayList<XSSFActiveXData>();
- }
-
- public String getOriginalId() {
- return this.originalId;
- }
-
- public Control() {
- this.control = CTControl.Factory.newInstance();
- }
- /**
- * For unit testing only!
- */
- protected Control(CTControl control) {
- this.control = control;
- }
-
- public void readFrom(InputStream is) throws IOException {
- try {
- CTControl doc = CTControl.Factory.parse(is);
- control = doc;
- } catch (XmlException e) {
- throw new IOException(e.getLocalizedMessage());
- }
- }
- public void writeTo(OutputStream out) throws IOException {
- XmlOptions options = new XmlOptions();
- options.setSaveOuter();
- options.setUseDefaultNamespace();
- // Requests use of whitespace for easier reading
- options.setSavePrettyPrint();
- control.save(out, options);
- }
-
- /**
- * We expect active x binary parts
- */
- public String[] getChildrenRelationshipTypes() {
- return new String[] {
- XSSFRelation.ACTIVEX_BINS.getRelation()
- };
- }
-
- public int getNumberOfChildren() {
- return activexBins.size();
- }
-
- /**
- * Generates and adds XSSFActiveXData children
- */
- public void generateChild(PackagePart childPart, String childRelId) {
- XSSFActiveXData actX = new XSSFActiveXData(childPart, childRelId);
- activexBins.add(actX);
- }
-
- public WritableChild getChildForWriting(int index) {
- if(index >= activexBins.size()) {
- throw new IllegalArgumentException("Can't get child at " + index + " when size is " + getNumberOfChildren());
- }
- return new WritableChild(
- activexBins.get(index),
- XSSFRelation.ACTIVEX_BINS
- );
- }
-
- public ArrayList<XSSFActiveXData> getData() {
- return this.activexBins;
- }
-
- public void addData(XSSFActiveXData activeX) {
- this.activexBins.add(activeX);
- }
-}
\ No newline at end of file
+++ /dev/null
-package org.apache.poi.xssf.model;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-import org.apache.poi.xssf.usermodel.XSSFPictureData;
-import org.apache.poi.xssf.usermodel.XSSFRelation;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlOptions;
-import org.openxml4j.opc.PackagePart;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDrawing;
-
-/**
- * A drawing object in XSSF. May well have raw pictures
- * attached to it as children.
- */
-public class Drawing implements XSSFModel {
- private CTDrawing drawing;
- private String originalId;
-
- /** Raw pictures attached to the drawing */
- private ArrayList<XSSFPictureData> pictures;
-
- public Drawing(InputStream is, String originalId) throws IOException {
- readFrom(is);
- this.originalId = originalId;
- this.pictures = new ArrayList<XSSFPictureData>();
- }
-
- public String getOriginalId() {
- return this.originalId;
- }
-
- public Drawing() {
- this.drawing = CTDrawing.Factory.newInstance();
- }
- /**
- * For unit testing only!
- */
- protected Drawing(CTDrawing drawing) {
- this.drawing = drawing;
- }
-
- public void readFrom(InputStream is) throws IOException {
- try {
- CTDrawing doc = CTDrawing.Factory.parse(is);
- drawing = doc;
- } catch (XmlException e) {
- throw new IOException(e.getLocalizedMessage());
- }
- }
- public void writeTo(OutputStream out) throws IOException {
- XmlOptions options = new XmlOptions();
- options.setSaveOuter();
- options.setUseDefaultNamespace();
- // Requests use of whitespace for easier reading
- //options.setSavePrettyPrint();
- drawing.save(out, options);
- }
-
- /**
- * We expect image parts
- */
- public String[] getChildrenRelationshipTypes() {
- return new String[] {
- XSSFRelation.IMAGES.getRelation()
- };
- }
-
- public int getNumberOfChildren() {
- return pictures.size();
- }
-
- /**
- * Generates and adds XSSFActiveXData children
- */
- public void generateChild(PackagePart childPart, String childRelId) {
- //XSSFPictureData pd = new XSSFPictureData(childPart, childRelId);
- //pictures.add(pd);
- throw new RuntimeException("deprecated");
- }
-
- public ArrayList<XSSFPictureData> getPictures()
- {
- return this.pictures;
- }
-
- public void addPictures(XSSFPictureData picture)
- {
- this.pictures.add(picture);
- }
-}
\ No newline at end of file
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.model;
-
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
-
-/**
- * Allows the getting and saving of shared strings
- */
-public interface SharedStringSource {
- CTRst getEntryAt(int ref);
- int addEntry(CTRst rst);
-}
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.StylesSource;
-import org.apache.poi.xssf.usermodel.FontFamily;
-import org.apache.poi.xssf.usermodel.FontScheme;
+import org.apache.poi.ss.usermodel.FontFamily;
+import org.apache.poi.ss.usermodel.FontScheme;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
+++ /dev/null
-package org.apache.poi.xssf.model;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-/* ====================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-==================================================================== */\r
-import org.apache.xmlbeans.XmlException;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.*;\r
-\r
-/**\r
- * An instance of this part type contains information about a document's theme, which is a combination of color\r
- * scheme, font scheme, and format scheme (the latter also being referred to as effects).\r
- * For a SpreadsheetML document, the choice of theme affects the color and style of cell contents and charts,\r
- * among other things.\r
- *\r
- * @author Yegor Kozlov\r
- */\r
-public class ThemeTable implements XSSFModel {\r
- private ThemeDocument doc;\r
- private String originalId;\r
-\r
- public ThemeTable(InputStream is, String originalId) throws IOException {\r
- readFrom(is);\r
- this.originalId = originalId;\r
- }\r
- \r
- public String getOriginalId() {\r
- return this.originalId;\r
- }\r
-\r
- public ThemeTable() {\r
- this.doc = ThemeDocument.Factory.newInstance();\r
- }\r
-\r
- public void readFrom(InputStream is) throws IOException {\r
- try {\r
- doc = ThemeDocument.Factory.parse(is);\r
- } catch (XmlException e) {\r
- throw new IOException(e.getLocalizedMessage());\r
- }\r
- }\r
-\r
- public void writeTo(OutputStream out) throws IOException {\r
- XmlOptions options = new XmlOptions();\r
- options.setSaveOuter();\r
- options.setUseDefaultNamespace(); \r
-\r
- doc.save(out, options);\r
- }\r
-\r
-}
\ No newline at end of file
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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;
-
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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;
-
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-import org.apache.poi.ss.usermodel.Font;
-
-/**
- * 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;
- }
-
-}
+++ /dev/null
-/* ====================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-==================================================================== */\r
-\r
-package org.apache.poi.xssf.usermodel;\r
-\r
-/**\r
- * The enumeration value indicating horizontal alignment of a cell,\r
- * i.e., whether it is aligned general, left, right, horizontally centered, filled (replicated),\r
- * justified, centered across multiple cells, or distributed.\r
- */\r
-public enum HorizontalAlignment {\r
- /**\r
- * The horizontal alignment is general-aligned. Text data is left-aligned.\r
- * Numbers, dates, and times are rightaligned. Boolean types are centered.\r
- * Changing the alignment does not change the type of data.\r
- */\r
- GENERAL,\r
-\r
- /**\r
- * The horizontal alignment is left-aligned, even in Rightto-Left mode.\r
- * Aligns contents at the left edge of the cell. If an indent amount is specified, the contents of\r
- * the cell is indented from the left by the specified number of character spaces. The character spaces are\r
- * based on the default font and font size for the workbook.\r
- */\r
- LEFT,\r
-\r
- /**\r
- * The horizontal alignment is centered, meaning the text is centered across the cell.\r
- */\r
- CENTER,\r
-\r
- /**\r
- * The horizontal alignment is right-aligned, meaning that cell contents are aligned at the right edge of the cell,\r
- * even in Right-to-Left mode.\r
- */\r
- RIGHT,\r
-\r
- /**\r
- * Indicates that the value of the cell should be filled\r
- * across the entire width of the cell. If blank cells to the right also have the fill alignment,\r
- * they are also filled with the value, using a convention similar to centerContinuous.\r
- * <p>\r
- * Additional rules:\r
- * <ol>\r
- * <li>Only whole values can be appended, not partial values.</li>\r
- * <li>The column will not be widened to 'best fit' the filled value</li>\r
- * <li>If appending an additional occurrence of the value exceeds the boundary of the cell\r
- * left/right edge, don't append the additional occurrence of the value.</li>\r
- * <li>The display value of the cell is filled, not the underlying raw number.</li>\r
- * </ol>\r
- * </p>\r
- */\r
- FILL,\r
-\r
- /**\r
- * The horizontal alignment is justified (flush left and right).\r
- * For each line of text, aligns each line of the wrapped text in a cell to the right and left\r
- * (except the last line). If no single line of text wraps in the cell, then the text is not justified.\r
- */\r
- JUSTIFY,\r
-\r
- /**\r
- * The horizontal alignment is centered across multiple cells.\r
- * The information about how many cells to span is expressed in the Sheet Part,\r
- * in the row of the cell in question. For each cell that is spanned in the alignment,\r
- * a cell element needs to be written out, with the same style Id which references the centerContinuous alignment.\r
- */\r
- CENTER_SELECTION,\r
-\r
- /**\r
- * Indicates that each 'word' in each line of text inside the cell is evenly distributed\r
- * across the width of the cell, with flush right and left margins.\r
- * <p>\r
- * When there is also an indent value to apply, both the left and right side of the cell\r
- * are padded by the indent value.\r
- * </p>\r
- * <p> A 'word' is a set of characters with no space character in them. </p>\r
- * <p> Two lines inside a cell are separated by a carriage return. </p>\r
- */\r
- DISTRIBUTED\r
-}\r
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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;
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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;
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.xssf.usermodel;
-
-/**
- * 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];
- }
-}
+++ /dev/null
-/* ====================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-==================================================================== */\r
-package org.apache.poi.xssf.usermodel;\r
-\r
-/**\r
- * All known types of automatic shapes in DrawingML\r
- *\r
- * @author Yegor Kozlov\r
- */\r
-public class ShapeTypes {\r
- public static final int LINE = 1;\r
- public static final int LINE_INV = 2;\r
- public static final int TRIANGLE = 3;\r
- public static final int RT_TRIANGLE = 4;\r
- public static final int RECT = 5;\r
- public static final int DIAMOND = 6;\r
- public static final int PARALLELOGRAM = 7;\r
- public static final int TRAPEZOID = 8;\r
- public static final int NON_ISOSCELES_TRAPEZOID = 9;\r
- public static final int PENTAGON = 10;\r
- public static final int HEXAGON = 11;\r
- public static final int HEPTAGON = 12;\r
- public static final int OCTAGON = 13;\r
- public static final int DECAGON = 14;\r
- public static final int DODECAGON = 15;\r
- public static final int STAR_4 = 16;\r
- public static final int STAR_5 = 17;\r
- public static final int STAR_6 = 18;\r
- public static final int STAR_7 = 19;\r
- public static final int STAR_8 = 20;\r
- public static final int STAR_10 = 21;\r
- public static final int STAR_12 = 22;\r
- public static final int STAR_16 = 23;\r
- public static final int STAR_24 = 24;\r
- public static final int STAR_32 = 25;\r
- public static final int ROUND_RECT = 26;\r
- public static final int ROUND_1_RECT = 27;\r
- public static final int ROUND_2_SAME_RECT = 28;\r
- public static final int ROUND_2_DIAG_RECT = 29;\r
- public static final int SNIP_ROUND_RECT = 30;\r
- public static final int SNIP_1_RECT = 31;\r
- public static final int SNIP_2_SAME_RECT = 32;\r
- public static final int SNIP_2_DIAG_RECT = 33;\r
- public static final int PLAQUE = 34;\r
- public static final int ELLIPSE = 35;\r
- public static final int TEARDROP = 36;\r
- public static final int HOME_PLATE = 37;\r
- public static final int CHEVRON = 38;\r
- public static final int PIE_WEDGE = 39;\r
- public static final int PIE = 40;\r
- public static final int BLOCK_ARC = 41;\r
- public static final int DONUT = 42;\r
- public static final int NO_SMOKING = 43;\r
- public static final int RIGHT_ARROW = 44;\r
- public static final int LEFT_ARROW = 45;\r
- public static final int UP_ARROW = 46;\r
- public static final int DOWN_ARROW = 47;\r
- public static final int STRIPED_RIGHT_ARROW = 48;\r
- public static final int NOTCHED_RIGHT_ARROW = 49;\r
- public static final int BENT_UP_ARROW = 50;\r
- public static final int LEFT_RIGHT_ARROW = 51;\r
- public static final int UP_DOWN_ARROW = 52;\r
- public static final int LEFT_UP_ARROW = 53;\r
- public static final int LEFT_RIGHT_UP_ARROW = 54;\r
- public static final int QUAD_ARROW = 55;\r
- public static final int LEFT_ARROW_CALLOUT = 56;\r
- public static final int RIGHT_ARROW_CALLOUT = 57;\r
- public static final int UP_ARROW_CALLOUT = 58;\r
- public static final int DOWN_ARROW_CALLOUT = 59;\r
- public static final int LEFT_RIGHT_ARROW_CALLOUT = 60;\r
- public static final int UP_DOWN_ARROW_CALLOUT = 61;\r
- public static final int QUAD_ARROW_CALLOUT = 62;\r
- public static final int BENT_ARROW = 63;\r
- public static final int UTURN_ARROW = 64;\r
- public static final int CIRCULAR_ARROW = 65;\r
- public static final int LEFT_CIRCULAR_ARROW = 66;\r
- public static final int LEFT_RIGHT_CIRCULAR_ARROW = 67;\r
- public static final int CURVED_RIGHT_ARROW = 68;\r
- public static final int CURVED_LEFT_ARROW = 69;\r
- public static final int CURVED_UP_ARROW = 70;\r
- public static final int CURVED_DOWN_ARROW = 71;\r
- public static final int SWOOSH_ARROW = 72;\r
- public static final int CUBE = 73;\r
- public static final int CAN = 74;\r
- public static final int LIGHTNING_BOLT = 75;\r
- public static final int HEART = 76;\r
- public static final int SUN = 77;\r
- public static final int MOON = 78;\r
- public static final int SMILEY_FACE = 79;\r
- public static final int IRREGULAR_SEAL_1 = 80;\r
- public static final int IRREGULAR_SEAL_2 = 81;\r
- public static final int FOLDED_CORNER = 82;\r
- public static final int BEVEL = 83;\r
- public static final int FRAME = 84;\r
- public static final int HALF_FRAME = 85;\r
- public static final int CORNER = 86;\r
- public static final int DIAG_STRIPE = 87;\r
- public static final int CHORD = 88;\r
- public static final int ARC = 89;\r
- public static final int LEFT_BRACKET = 90;\r
- public static final int RIGHT_BRACKET = 91;\r
- public static final int LEFT_BRACE = 92;\r
- public static final int RIGHT_BRACE = 93;\r
- public static final int BRACKET_PAIR = 94;\r
- public static final int BRACE_PAIR = 95;\r
- public static final int STRAIGHT_CONNECTOR_1 = 96;\r
- public static final int BENT_CONNECTOR_2 = 97;\r
- public static final int BENT_CONNECTOR_3 = 98;\r
- public static final int BENT_CONNECTOR_4 = 99;\r
- public static final int BENT_CONNECTOR_5 = 100;\r
- public static final int CURVED_CONNECTOR_2 = 101;\r
- public static final int CURVED_CONNECTOR_3 = 102;\r
- public static final int CURVED_CONNECTOR_4 = 103;\r
- public static final int CURVED_CONNECTOR_5 = 104;\r
- public static final int CALLOUT_1 = 105;\r
- public static final int CALLOUT_2 = 106;\r
- public static final int CALLOUT_3 = 107;\r
- public static final int ACCENT_CALLOUT_1 = 108;\r
- public static final int ACCENT_CALLOUT_2 = 109;\r
- public static final int ACCENT_CALLOUT_3 = 110;\r
- public static final int BORDER_CALLOUT_1 = 111;\r
- public static final int BORDER_CALLOUT_2 = 112;\r
- public static final int BORDER_CALLOUT_3 = 113;\r
- public static final int ACCENT_BORDER_CALLOUT_1 = 114;\r
- public static final int ACCENT_BORDER_CALLOUT_2 = 115;\r
- public static final int ACCENT_BORDER_CALLOUT_3 = 116;\r
- public static final int WEDGE_RECT_CALLOUT = 117;\r
- public static final int WEDGE_ROUND_RECT_CALLOUT = 118;\r
- public static final int WEDGE_ELLIPSE_CALLOUT = 119;\r
- public static final int CLOUD_CALLOUT = 120;\r
- public static final int CLOUD = 121;\r
- public static final int RIBBON = 122;\r
- public static final int RIBBON_2 = 123;\r
- public static final int ELLIPSE_RIBBON = 124;\r
- public static final int ELLIPSE_RIBBON_2 = 125;\r
- public static final int LEFT_RIGHT_RIBBON = 126;\r
- public static final int VERTICAL_SCROLL = 127;\r
- public static final int HORIZONTAL_SCROLL = 128;\r
- public static final int WAVE = 129;\r
- public static final int DOUBLE_WAVE = 130;\r
- public static final int PLUS = 131;\r
- public static final int FLOW_CHART_PROCESS = 132;\r
- public static final int FLOW_CHART_DECISION = 133;\r
- public static final int FLOW_CHART_INPUT_OUTPUT = 134;\r
- public static final int FLOW_CHART_PREDEFINED_PROCESS = 135;\r
- public static final int FLOW_CHART_INTERNAL_STORAGE = 136;\r
- public static final int FLOW_CHART_DOCUMENT = 137;\r
- public static final int FLOW_CHART_MULTIDOCUMENT = 138;\r
- public static final int FLOW_CHART_TERMINATOR = 139;\r
- public static final int FLOW_CHART_PREPARATION = 140;\r
- public static final int FLOW_CHART_MANUAL_INPUT = 141;\r
- public static final int FLOW_CHART_MANUAL_OPERATION = 142;\r
- public static final int FLOW_CHART_CONNECTOR = 143;\r
- public static final int FLOW_CHART_PUNCHED_CARD = 144;\r
- public static final int FLOW_CHART_PUNCHED_TAPE = 145;\r
- public static final int FLOW_CHART_SUMMING_JUNCTION = 146;\r
- public static final int FLOW_CHART_OR = 147;\r
- public static final int FLOW_CHART_COLLATE = 148;\r
- public static final int FLOW_CHART_SORT = 149;\r
- public static final int FLOW_CHART_EXTRACT = 150;\r
- public static final int FLOW_CHART_MERGE = 151;\r
- public static final int FLOW_CHART_OFFLINE_STORAGE = 152;\r
- public static final int FLOW_CHART_ONLINE_STORAGE = 153;\r
- public static final int FLOW_CHART_MAGNETIC_TAPE = 154;\r
- public static final int FLOW_CHART_MAGNETIC_DISK = 155;\r
- public static final int FLOW_CHART_MAGNETIC_DRUM = 156;\r
- public static final int FLOW_CHART_DISPLAY = 157;\r
- public static final int FLOW_CHART_DELAY = 158;\r
- public static final int FLOW_CHART_ALTERNATE_PROCESS = 159;\r
- public static final int FLOW_CHART_OFFPAGE_CONNECTOR = 160;\r
- public static final int ACTION_BUTTON_BLANK = 161;\r
- public static final int ACTION_BUTTON_HOME = 162;\r
- public static final int ACTION_BUTTON_HELP = 163;\r
- public static final int ACTION_BUTTON_INFORMATION = 164;\r
- public static final int ACTION_BUTTON_FORWARD_NEXT = 165;\r
- public static final int ACTION_BUTTON_BACK_PREVIOUS = 166;\r
- public static final int ACTION_BUTTON_END = 167;\r
- public static final int ACTION_BUTTON_BEGINNING = 168;\r
- public static final int ACTION_BUTTON_RETURN = 169;\r
- public static final int ACTION_BUTTON_DOCUMENT = 170;\r
- public static final int ACTION_BUTTON_SOUND = 171;\r
- public static final int ACTION_BUTTON_MOVIE = 172;\r
- public static final int GEAR_6 = 173;\r
- public static final int GEAR_9 = 174;\r
- public static final int FUNNEL = 175;\r
- public static final int MATH_PLUS = 176;\r
- public static final int MATH_MINUS = 177;\r
- public static final int MATH_MULTIPLY = 178;\r
- public static final int MATH_DIVIDE = 179;\r
- public static final int MATH_EQUAL = 180;\r
- public static final int MATH_NOT_EQUAL = 181;\r
- public static final int CORNER_TABS = 182;\r
- public static final int SQUARE_TABS = 183;\r
- public static final int PLAQUE_TABS = 184;\r
- public static final int CHART_X = 185;\r
- public static final int CHART_STAR = 186;\r
- public static final int CHART_PLUS = 187;\r
-}\r
+++ /dev/null
-/* ====================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-==================================================================== */\r
-\r
-package org.apache.poi.xssf.usermodel;\r
-\r
-/**\r
- * This enumeration value indicates the type of vertical alignment for a cell, i.e.,\r
- * whether it is aligned top, bottom, vertically centered, justified or distributed.\r
- */\r
-public enum VerticalAlignment {\r
- /**\r
- * The vertical alignment is aligned-to-top.\r
- */\r
- TOP,\r
-\r
- /**\r
- * The vertical alignment is centered across the height of the cell.\r
- */\r
- CENTER,\r
-\r
- /**\r
- * The vertical alignment is aligned-to-bottom.\r
- */\r
- BOTTOM,\r
-\r
- /**\r
- * <p>\r
- * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,\r
- * where each line of text inside the cell is evenly distributed across the height of the cell,\r
- * with flush top and bottom margins.\r
- * </p>\r
- * <p>\r
- * When text direction is vertical: similar behavior as horizontal justification.\r
- * The alignment is justified (flush top and bottom in this case). For each line of text, each\r
- * line of the wrapped text in a cell is aligned to the top and bottom (except the last line).\r
- * If no single line of text wraps in the cell, then the text is not justified.\r
- * </p>\r
- */\r
- JUSTIFY,\r
-\r
- /**\r
- * <p>\r
- * When text direction is horizontal: the vertical alignment of lines of text is distributed vertically,\r
- * where each line of text inside the cell is evenly distributed across the height of the cell,\r
- * with flush top\r
- * </p>\r
- * <p>\r
- * When text direction is vertical: behaves exactly as distributed horizontal alignment.\r
- * The first words in a line of text (appearing at the top of the cell) are flush\r
- * 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,\r
- * and the line of text is distributed evenly from top to bottom.\r
- * </p>\r
- */\r
- DISTRIBUTED\r
-}\r
package org.apache.poi.xssf.usermodel;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.StylesSource;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellAlignment;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
* Get the color to use for the bottom border
* <br/>
* Color is optional. When missing, IndexedColors.AUTOMATIC is implied.
- * @return the index of the color definition, default value is {@link IndexedColors.AUTOMATIC}
+ * @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors.AUTOMATIC}
* @see IndexedColors
*/
public short getBottomBorderColor() {
* Set the type of horizontal alignment for the cell
*
* @param align - the type of alignment
- * @see HorizontalAlignment
+ * @see org.apache.poi.ss.usermodel.HorizontalAlignment
*/
public void setAlignment(HorizontalAlignment align) {
setAlignment((short)align.ordinal());
* Set the color to use for the top border
*
* @param color the index of the color definition
- * @see IndexedColors
+ * @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setTopBorderColor(short color) {
XSSFColor clr = new XSSFColor();
package org.apache.poi.xssf.usermodel;
import org.apache.poi.ss.usermodel.Comment;
-import org.apache.poi.ss.usermodel.CommentsSource;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.xssf.usermodel.helpers.RichTextStringHelper;
import org.apache.poi.xssf.model.CommentsTable;
}\r
\r
/**\r
- * Gets the shape type, one of the constants defined in {@link org.apache.poi.xssf.usermodel.ShapeTypes}.\r
+ * Gets the shape type, one of the constants defined in {@link org.apache.poi.ss.usermodel.ShapeTypes}.\r
*\r
* @return the shape type\r
- * @see org.apache.poi.xssf.usermodel.ShapeTypes\r
+ * @see org.apache.poi.ss.usermodel.ShapeTypes\r
*/\r
public int getShapeType() {\r
return ctShape.getSpPr().getPrstGeom().getPrst().intValue();\r
/**\r
* Sets the shape types.\r
*\r
- * @param type the shape type, one of the constants defined in {@link org.apache.poi.xssf.usermodel.ShapeTypes}.\r
- * @see org.apache.poi.xssf.usermodel.ShapeTypes\r
+ * @param type the shape type, one of the constants defined in {@link org.apache.poi.ss.usermodel.ShapeTypes}.\r
+ * @see org.apache.poi.ss.usermodel.ShapeTypes\r
*/\r
public void setShapeType(int type) {\r
ctShape.getSpPr().getPrstGeom().setPrst(STShapeType.Enum.forInt(type));\r
package org.apache.poi.xssf.usermodel;
import org.apache.poi.ss.usermodel.DataFormat;
-import org.apache.poi.ss.usermodel.StylesSource;
import org.apache.poi.xssf.model.StylesTable;
/**
* Root element of the SpreadsheetML Drawing part\r
*/\r
private CTDrawing drawing;\r
+ private boolean isNew;\r
\r
/**\r
* Create a new SpreadsheetML drawing\r
protected XSSFDrawing() {\r
super();\r
drawing = newDrawing();\r
+ isNew = true;\r
}\r
\r
/**\r
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\r
xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">\r
*/\r
- xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr"));\r
+ if(isNew) xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr"));\r
Map map = new HashMap();\r
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");\r
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");\r
public XSSFEvaluationCell(XSSFCell cell) {
_cell = cell;
- _evalSheet = new XSSFEvaluationSheet((XSSFSheet)cell.getSheet());
+ _evalSheet = new XSSFEvaluationSheet(cell.getSheet());
}
public XSSFEvaluationCell(XSSFCell cell, XSSFEvaluationSheet evaluationSheet) {
\r
public EvaluationName getName(String name) {\r
for(int i=0; i < _uBook.getNumberOfNames(); i++) {\r
- String nameText = _uBook.getNameName(i);\r
+ String nameText = _uBook.getNameAt(i).getNameName();\r
if (name.equalsIgnoreCase(nameText)) {\r
return new Name(_uBook.getNameAt(i), i, this);\r
}\r
==================================================================== */
package org.apache.poi.xssf.usermodel;
-import java.util.ArrayList;
-
-import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.extensions.XSSFColor;
import org.apache.poi.xssf.model.StylesTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
* get character-set to use.
*
* @return byte - character-set
- * @see FontCharset
+ * @see org.apache.poi.ss.usermodel.FontCharset
*/
public byte getCharSet() {
CTIntProperty charset = ctFont.sizeOfCharsetArray() == 0 ? null : ctFont.getCharsetArray(0);
* get type of text underlining to use
*
* @return byte - underlining type
- * @see FontUnderline
+ * @see org.apache.poi.ss.usermodel.FontUnderline
*/
public byte getUnderline() {
CTUnderlineProperty underline = ctFont.sizeOfUArray() == 0 ? null : ctFont.getUArray(0);
* get the font family to use.
*
* @return the font family to use
- * @see FontFamily
+ * @see org.apache.poi.ss.usermodel.FontFamily
*/
public int getFamily() {
CTIntProperty family = ctFont.sizeOfFamilyArray() == 0 ? ctFont.addNewFamily() : ctFont.getFamilyArray(0);
package org.apache.poi.xssf.usermodel;
-import org.apache.poi.ss.usermodel.PrintSetup;
+import org.apache.poi.ss.usermodel.*;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.InputStream;
import java.util.*;
import javax.xml.namespace.QName;
@Override
protected void onDocumentRead() {
try {
- worksheet = WorksheetDocument.Factory.parse(getPackagePart().getInputStream()).getWorksheet();
- } catch (XmlException e){
- throw new POIXMLException(e);
+ read(getPackagePart().getInputStream());
} catch (IOException e){
throw new POIXMLException(e);
}
+ }
+
+ protected void read(InputStream is) throws IOException {
+ try {
+ worksheet = WorksheetDocument.Factory.parse(is).getWorksheet();
+ } catch (XmlException e){
+ throw new POIXMLException(e);
+ }
initRows(worksheet);
columnHelper = new ColumnHelper(worksheet);
@Override
protected void commit() throws IOException {
+ PackagePart part = getPackagePart();
+ OutputStream out = part.getOutputStream();
+ write(out);
+ out.close();
+ }
+
+ protected void write(OutputStream out) throws IOException {
if(worksheet.getColsArray().length == 1) {
CTCols col = worksheet.getColsArray(0);
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTWorksheet.type.getName().getNamespaceURI(), "worksheet"));
-
Map map = new HashMap();
map.put(STRelationshipId.type.getName().getNamespaceURI(), "r");
xmlOptions.setSaveSuggestedPrefixes(map);
- PackagePart part = getPackagePart();
- OutputStream out = part.getOutputStream();
worksheet.save(out, xmlOptions);
- out.close();
}
-
}
\r
/**\r
* Represents a shape with a predefined geometry in a SpreadsheetML drawing.\r
- * Possible shape types are defined in {@link ShapeTypes}\r
+ * Possible shape types are defined in {@link org.apache.poi.ss.usermodel.ShapeTypes}\r
*\r
* @author Yegor Kozlov\r
*/\r
}\r
\r
/**\r
- * Gets the shape type, one of the constants defined in {@link ShapeTypes}.\r
+ * Gets the shape type, one of the constants defined in {@link org.apache.poi.ss.usermodel.ShapeTypes}.\r
*\r
* @return the shape type\r
- * @see ShapeTypes\r
+ * @see org.apache.poi.ss.usermodel.ShapeTypes\r
*/\r
public int getShapeType() {\r
return ctShape.getSpPr().getPrstGeom().getPrst().intValue();\r
/**\r
* Sets the shape types.\r
*\r
- * @param type the shape type, one of the constants defined in {@link ShapeTypes}.\r
- * @see ShapeTypes\r
+ * @param type the shape type, one of the constants defined in {@link org.apache.poi.ss.usermodel.ShapeTypes}.\r
+ * @see org.apache.poi.ss.usermodel.ShapeTypes\r
*/\r
public void setShapeType(int type) {\r
ctShape.getSpPr().getPrstGeom().setPrst(STShapeType.Enum.forInt(type));\r
package org.apache.poi.xssf.usermodel;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.InputStream;
+import java.io.*;
import java.util.*;
import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocument;
*/
private List<XSSFPictureData> pictures;
- private static POILogger log = POILogFactory.getLogger(XSSFWorkbook.class);
+ private static POILogger logger = POILogFactory.getLogger(XSSFWorkbook.class);
/**
* Create a new SpreadsheetML workbook.
for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) {
XSSFSheet sh = shIdMap.get(ctSheet.getId());
if(sh == null) {
- log.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping");
+ logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping");
continue;
}
sh.sheet = ctSheet;
return imageNumber - 1;
}
+ /**
+ * Create an XSSFSheet from an existing sheet in the XSSFWorkbook.
+ * The cloned sheet is a deep copy of the original.
+ *
+ * @return XSSFSheet representing the cloned sheet.
+ * @throws IllegalArgumentException if the sheet index in invalid
+ * @throws POIXMLException if there were errors when cloning
+ */
public XSSFSheet cloneSheet(int sheetNum) {
+ validateSheetIndex(sheetNum);
+
XSSFSheet srcSheet = sheets.get(sheetNum);
- String srcName = getSheetName(sheetNum);
- int i = 1;
- String name = srcName;
+ String srcName = srcSheet.getSheetName();
+ String clonedName = getUniqueSheetName(srcName);
+
+ XSSFSheet clonedSheet = createSheet(clonedName);
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ srcSheet.write(out);
+ clonedSheet.read(new ByteArrayInputStream(out.toByteArray()));
+ } catch (IOException e){
+ throw new POIXMLException("Failed to clone sheet", e);
+ }
+ CTWorksheet ct = clonedSheet.getCTWorksheet();
+ if(ct.isSetDrawing()) {
+ logger.log(POILogger.WARN, "Cloning sheets with drawings is not yet supported.");
+ ct.unsetDrawing();
+ }
+ if(ct.isSetLegacyDrawing()) {
+ logger.log(POILogger.WARN, "Cloning sheets with comments is not yet supported.");
+ ct.unsetLegacyDrawing();
+ }
+
+ clonedSheet.setSelected(false);
+ return clonedSheet;
+ }
+
+ /**
+ * Generate a valid sheet name based on the existing one. Used when cloning sheets.
+ *
+ * @param srcName the original sheet name to
+ * @return clone sheet name
+ */
+ private String getUniqueSheetName(String srcName) {
+ int uniqueIndex = 2;
+ String baseName = srcName;
+ int bracketPos = srcName.lastIndexOf('(');
+ if (bracketPos > 0 && srcName.endsWith(")")) {
+ String suffix = srcName.substring(bracketPos + 1, srcName.length() - ")".length());
+ try {
+ uniqueIndex = Integer.parseInt(suffix.trim());
+ uniqueIndex++;
+ baseName = srcName.substring(0, bracketPos).trim();
+ } catch (NumberFormatException e) {
+ // contents of brackets not numeric
+ }
+ }
while (true) {
- //Try and find the next sheet name that is unique
- String index = Integer.toString(i++);
- if (name.length() + index.length() + 2 < 31) {
- name = name + "("+index+")";
+ // Try and find the next sheet name that is unique
+ String index = Integer.toString(uniqueIndex++);
+ String name;
+ if (baseName.length() + index.length() + 2 < 31) {
+ name = baseName + " (" + index + ")";
} else {
- name = name.substring(0, 31 - index.length() - 2) + "(" +index + ")";
+ name = baseName.substring(0, 31 - index.length() - 2) + "(" + index + ")";
}
//If the sheet name is unique, then set it otherwise move on to the next number.
if (getSheetIndex(name) == -1) {
- break;
+ return name;
}
}
-
- XSSFSheet clonedSheet = createSheet(name);
- clonedSheet.getCTWorksheet().set(srcSheet.getCTWorksheet());
- return clonedSheet;
}
/**
return namedRanges.get(index);
}
- /**
- * Gets the Named range name at the given index number,
- * this method is equivalent to <code>getNameAt(index).getName()</code>
- *
- * @param index the named range index (0 based)
- * @return named range name
- * @see #getNameAt(int)
- */
- public String getNameName(int index) {
- return getNameAt(index).getNameName();
- }
-
/**
* Gets the named range index by his name
* <i>Note:</i>Excel named ranges are case-insensitive and
}
- /**
- * deprecated May 2008
- * @deprecated - Misleading name - use getActiveSheetIndex()
- */
- public short getSelectedTab() {
- short i = 0;
- for (XSSFSheet sheet : this.sheets) {
- if (sheet.isSelected()) {
- return i;
- }
- ++i;
- }
- return -1;
- }
-
/**
* Get sheet with the given name (case insensitive match)
*
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellAlignment;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STHorizontalAlignment;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STVerticalAlignment;
-import org.apache.poi.xssf.usermodel.HorizontalAlignment;
-import org.apache.poi.xssf.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
/**
package org.apache.poi.xssf.usermodel.extensions;
-import org.apache.poi.xssf.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.BorderStyle;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle;
package org.apache.poi.xssf.usermodel;
-import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellFill;
import org.apache.poi.xssf.usermodel.extensions.XSSFColor;
-import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
import junit.framework.TestCase;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.usermodel.extensions.XSSFColor;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty;
import junit.framework.TestCase;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
+import org.apache.poi.ss.usermodel.PaperSize;
+import org.apache.poi.ss.usermodel.PageOrder;
+import org.apache.poi.ss.usermodel.PrintOrientation;
+import org.apache.poi.ss.usermodel.PrintCellComments;
/**
* Tests for {@link XSSFPrintSetup}
import java.io.File;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.OutputStream;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.Name;
-import org.apache.poi.ss.usermodel.RichTextString;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.StylesSource;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.StylesTable;
import org.openxml4j.opc.ContentTypes;
assertSame(sheet1, workbook.getSheetAt(0));
}
- public void testSetSelectedTab() {
- XSSFWorkbook workbook = new XSSFWorkbook();
- workbook.createSheet("sheet1");
- workbook.createSheet("sheet2");
- assertEquals(0, workbook.getSelectedTab());
- workbook.setSelectedTab((short) 0);
- assertEquals(0, workbook.getSelectedTab());
- workbook.setSelectedTab((short) 1);
- assertEquals(1, workbook.getSelectedTab());
- }
-
public void testSetSheetName() {
XSSFWorkbook workbook = new XSSFWorkbook();
workbook.createSheet("sheet1");
}
public void testCloneSheet() {
- XSSFWorkbook workbook = new XSSFWorkbook();
- workbook.createSheet("sheet");
- workbook.cloneSheet(0);
- assertEquals(2, workbook.getNumberOfSheets());
- assertEquals("sheet(1)", workbook.getSheetName(1));
- workbook.setSheetName(1, "clonedsheet");
- workbook.cloneSheet(1);
- assertEquals(3, workbook.getNumberOfSheets());
- assertEquals("clonedsheet(1)", workbook.getSheetName(2));
- }
+ XSSFWorkbook book = new XSSFWorkbook();
+ XSSFSheet sheet = book.createSheet("TEST");
+ sheet.createRow(0).createCell(0).setCellValue("Test");
+ sheet.createRow(1).createCell(0).setCellValue(36.6);
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 2));
+ sheet.addMergedRegion(new CellRangeAddress(1, 2, 0, 2));
+ assertTrue(sheet.isSelected());
+
+ XSSFSheet clonedSheet = book.cloneSheet(0);
+ assertEquals("TEST (2)", clonedSheet.getSheetName());
+ assertEquals(2, clonedSheet.getPhysicalNumberOfRows());
+ assertEquals(2, clonedSheet.getNumMergedRegions());
+ assertFalse(clonedSheet.isSelected());
+
+ //cloned sheet is a deep copy, adding rows in the original does not affect the clone
+ sheet.createRow(2).createCell(0).setCellValue(1);
+ sheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 2));
+ assertEquals(2, clonedSheet.getPhysicalNumberOfRows());
+ assertEquals(2, clonedSheet.getPhysicalNumberOfRows());
+
+ clonedSheet.createRow(2).createCell(0).setCellValue(1);
+ clonedSheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 2));
+ assertEquals(3, clonedSheet.getPhysicalNumberOfRows());
+ assertEquals(3, clonedSheet.getPhysicalNumberOfRows());
+
+ }
public void testGetSheetByName() {
XSSFWorkbook workbook = new XSSFWorkbook();
nwb.setRepeatingRowsAndColumns(1, -1, -1, -1, -1);
-
- if (false) {
- // In case you fancy checking in excel, to ensure it
- // won't complain about the file now
- try {
- File tempFile = File.createTempFile("POI-45126-", ".xlsx");
- FileOutputStream fout = new FileOutputStream(tempFile);
- nwb.write(fout);
- fout.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
}
Font font=workbook.createFont();
((XSSFFont)font).setBold(true);
font.setUnderline(Font.U_DOUBLE);
- StylesTable styleSource=new StylesTable();
fontFind=workbook.findFont(Font.BOLDWEIGHT_BOLD, IndexedColors.BLACK.getIndex(), (short)15, "Calibri", false, false, Font.SS_NONE, Font.U_DOUBLE);
assertNull(fontFind);
}
StylesTable ss = workbook.getStylesSource();
assertNotNull(ss);
- assertTrue(ss instanceof StylesTable);
- StylesTable st = (StylesTable)ss;
+ StylesTable st = ss;
// Has 8 number formats
assertEquals(8, st._getNumberFormatSize());
ss = workbook.getStylesSource();
assertNotNull(ss);
- assertTrue(ss instanceof StylesTable);
- st = (StylesTable)ss;
-
+
assertEquals(10, st._getNumberFormatSize());
assertEquals(2, st._getFontsSize());
assertEquals(2, st._getFillsSize());
assertEquals("ForB3", workbook.getNameAt(1).getNameName());
assertEquals("B3 Comment", workbook.getNameAt(1).getComment());
- assertEquals("ForA2", workbook.getNameName(0));
+ assertEquals("ForA2", workbook.getNameAt(0).getNameName());
assertEquals(1, workbook.getNameIndex("ForB3"));
assertEquals(-1, workbook.getNameIndex("ForB3!!"));
import junit.framework.TestCase;
-import org.apache.poi.xssf.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr;
package org.apache.poi.xssf.usermodel.extensions;
-import org.apache.poi.xssf.usermodel.FillPatternType;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFill;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPatternFill;