123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- /* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ==================================================================== */
-
- package org.apache.poi.ss.usermodel;
-
- public interface CellStyle {
-
- /**
- * general (normal) horizontal alignment
- */
-
- short ALIGN_GENERAL = 0x0;
-
- /**
- * left-justified horizontal alignment
- */
-
- short ALIGN_LEFT = 0x1;
-
- /**
- * center horizontal alignment
- */
-
- short ALIGN_CENTER = 0x2;
-
- /**
- * right-justified horizontal alignment
- */
-
- short ALIGN_RIGHT = 0x3;
-
- /**
- * fill? horizontal alignment
- */
-
- short ALIGN_FILL = 0x4;
-
- /**
- * justified horizontal alignment
- */
-
- short ALIGN_JUSTIFY = 0x5;
-
- /**
- * center-selection? horizontal alignment
- */
-
- short ALIGN_CENTER_SELECTION = 0x6;
-
- /**
- * top-aligned vertical alignment
- */
-
- short VERTICAL_TOP = 0x0;
-
- /**
- * center-aligned vertical alignment
- */
-
- short VERTICAL_CENTER = 0x1;
-
- /**
- * bottom-aligned vertical alignment
- */
-
- short VERTICAL_BOTTOM = 0x2;
-
- /**
- * vertically justified vertical alignment
- */
-
- short VERTICAL_JUSTIFY = 0x3;
-
- /**
- * No border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_NONE = 0x0;
-
- /**
- * Thin border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_THIN = 0x1;
-
- /**
- * Medium border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_MEDIUM = 0x2;
-
- /**
- * dash border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_DASHED = 0x3;
-
- /**
- * dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_DOTTED = 0x4;
-
- /**
- * Thick border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_THICK = 0x5;
-
- /**
- * double-line border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_DOUBLE = 0x6;
-
- /**
- * hair-line border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_HAIR = 0x7;
-
- /**
- * Medium dashed border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_MEDIUM_DASHED = 0x8;
-
- /**
- * dash-dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_DASH_DOT = 0x9;
-
- /**
- * medium dash-dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_MEDIUM_DASH_DOT = 0xA;
-
- /**
- * dash-dot-dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_DASH_DOT_DOT = 0xB;
-
- /**
- * medium dash-dot-dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_MEDIUM_DASH_DOT_DOT = 0xC;
-
- /**
- * slanted dash-dot border
- * @deprecated Use {@link BorderStyle}
- */
-
- short BORDER_SLANTED_DASH_DOT = 0xD;
-
- /** No background */
- short NO_FILL = 0;
-
- /** Solidly filled */
- short SOLID_FOREGROUND = 1;
-
- /** Small fine dots */
- short FINE_DOTS = 2;
-
- /** Wide dots */
- short ALT_BARS = 3;
-
- /** Sparse dots */
- short SPARSE_DOTS = 4;
-
- /** Thick horizontal bands */
- short THICK_HORZ_BANDS = 5;
-
- /** Thick vertical bands */
- short THICK_VERT_BANDS = 6;
-
- /** Thick backward facing diagonals */
- short THICK_BACKWARD_DIAG = 7;
-
- /** Thick forward facing diagonals */
- short THICK_FORWARD_DIAG = 8;
-
- /** Large spots */
- short BIG_SPOTS = 9;
-
- /** Brick-like layout */
- short BRICKS = 10;
-
- /** Thin horizontal bands */
- short THIN_HORZ_BANDS = 11;
-
- /** Thin vertical bands */
- short THIN_VERT_BANDS = 12;
-
- /** Thin backward diagonal */
- short THIN_BACKWARD_DIAG = 13;
-
- /** Thin forward diagonal */
- short THIN_FORWARD_DIAG = 14;
-
- /** Squares */
- short SQUARES = 15;
-
- /** Diamonds */
- short DIAMONDS = 16;
-
- /** Less Dots */
- short LESS_DOTS = 17;
-
- /** Least Dots */
- short LEAST_DOTS = 18;
-
- /**
- * get the index within the Workbook (sequence within the collection of ExtnededFormat objects)
- * @return unique index number of the underlying record this style represents (probably you don't care
- * unless you're comparing which one is which)
- */
-
- short getIndex();
-
- /**
- * set the data format (must be a valid format)
- * @see DataFormat
- */
-
- void setDataFormat(short fmt);
-
- /**
- * get the index of the format
- * @see DataFormat
- */
- short getDataFormat();
-
- /**
- * Get the format string
- */
- public String getDataFormatString();
-
- /**
- * set the font for this style
- * @param font a font object created or retrieved from the Workbook object
- * @see Workbook#createFont()
- * @see Workbook#getFontAt(short)
- */
-
- void setFont(Font font);
-
- /**
- * gets the index of the font for this style
- * @see Workbook#getFontAt(short)
- */
- short getFontIndex();
-
- /**
- * set the cell's using this style to be hidden
- * @param hidden - whether the cell using this style should be hidden
- */
-
- void setHidden(boolean hidden);
-
- /**
- * get whether the cell's using this style are to be hidden
- * @return hidden - whether the cell using this style should be hidden
- */
-
- boolean getHidden();
-
- /**
- * set the cell's using this style to be locked
- * @param locked - whether the cell using this style should be locked
- */
-
- void setLocked(boolean locked);
-
- /**
- * get whether the cell's using this style are to be locked
- * @return hidden - whether the cell using this style should be locked
- */
-
- boolean getLocked();
-
- /**
- * set the type of horizontal alignment for the cell
- * @param align - the type of alignment
- * @see #ALIGN_GENERAL
- * @see #ALIGN_LEFT
- * @see #ALIGN_CENTER
- * @see #ALIGN_RIGHT
- * @see #ALIGN_FILL
- * @see #ALIGN_JUSTIFY
- * @see #ALIGN_CENTER_SELECTION
- */
-
- void setAlignment(short align);
-
- /**
- * get the type of horizontal alignment for the cell
- * @return align - the type of alignment
- * @see #ALIGN_GENERAL
- * @see #ALIGN_LEFT
- * @see #ALIGN_CENTER
- * @see #ALIGN_RIGHT
- * @see #ALIGN_FILL
- * @see #ALIGN_JUSTIFY
- * @see #ALIGN_CENTER_SELECTION
- */
-
- short getAlignment();
-
- /**
- * Set whether the text should be wrapped.
- * Setting this flag to <code>true</code> make all content visible
- * whithin a cell by displaying it on multiple lines
- *
- * @param wrapped wrap text or not
- */
-
- void setWrapText(boolean wrapped);
-
- /**
- * get whether the text should be wrapped
- * @return wrap text or not
- */
-
- boolean getWrapText();
-
- /**
- * set the type of vertical alignment for the cell
- * @param align the type of alignment
- * @see #VERTICAL_TOP
- * @see #VERTICAL_CENTER
- * @see #VERTICAL_BOTTOM
- * @see #VERTICAL_JUSTIFY
- */
-
- void setVerticalAlignment(short align);
-
- /**
- * get the type of vertical alignment for the cell
- * @return align the type of alignment
- * @see #VERTICAL_TOP
- * @see #VERTICAL_CENTER
- * @see #VERTICAL_BOTTOM
- * @see #VERTICAL_JUSTIFY
- */
-
- short getVerticalAlignment();
-
- /**
- * set the degree of rotation for the text in the cell.
- *
- * Note: HSSF uses values from -90 to 90 degrees, whereas XSSF
- * uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges
- * accordingly, however the corresponding getter is returning values in the range mandated by the current type
- * of Excel file-format that this CellStyle is applied to.
- *
- * @param rotation degrees (see note above)
- */
- void setRotation(short rotation);
-
- /**
- * get the degree of rotation for the text in the cell.
- *
- * Note: HSSF uses values from -90 to 90 degrees, whereas XSSF
- * uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges
- * value-range as used by the type of Excel file-format that this CellStyle is applied to.
- *
- * @return rotation degrees (see note above)
- */
- short getRotation();
-
- /**
- * set the number of spaces to indent the text in the cell
- * @param indent - number of spaces
- */
-
- void setIndention(short indent);
-
- /**
- * get the number of spaces to indent the text in the cell
- * @return indent - number of spaces
- */
-
- short getIndention();
-
- /**
- * set the type of border to use for the left border of the cell
- * @param border type
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
- * @deprecated 3.15 beta 1
- */
- void setBorderLeft(short border);
-
- /**
- * set the type of border to use for the left border of the cell
- * @param border type
- */
- void setBorderLeft(BorderStyle border);
-
- /**
- * get the type of border to use for the left border of the cell
- * @return border type
- */
- BorderStyle getBorderLeft();
-
- /**
- * set the type of border to use for the right border of the cell
- * @param border type
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
- * @deprecated 3.15 beta 1
- */
- void setBorderRight(short border);
-
- /**
- * set the type of border to use for the right border of the cell
- * @param border type
- */
- void setBorderRight(BorderStyle border);
-
- /**
- * get the type of border to use for the right border of the cell
- * @return border type
- */
- BorderStyle getBorderRight();
-
- /**
- * set the type of border to use for the top border of the cell
- * @param border type
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
- * @deprecated 3.15 beta 1
- */
- void setBorderTop(short border);
-
- /**
- * set the type of border to use for the top border of the cell
- * @param border type
- */
- void setBorderTop(BorderStyle border);
-
- /**
- * get the type of border to use for the top border of the cell
- * @return border type
- */
- BorderStyle getBorderTop();
-
- /**
- * set the type of border to use for the bottom border of the cell
- * @param border type
- * @see #BORDER_NONE
- * @see #BORDER_THIN
- * @see #BORDER_MEDIUM
- * @see #BORDER_DASHED
- * @see #BORDER_DOTTED
- * @see #BORDER_THICK
- * @see #BORDER_DOUBLE
- * @see #BORDER_HAIR
- * @see #BORDER_MEDIUM_DASHED
- * @see #BORDER_DASH_DOT
- * @see #BORDER_MEDIUM_DASH_DOT
- * @see #BORDER_DASH_DOT_DOT
- * @see #BORDER_MEDIUM_DASH_DOT_DOT
- * @see #BORDER_SLANTED_DASH_DOT
- * @deprecated 3.15 beta 1
- */
- void setBorderBottom(short border);
-
- /**
- * set the type of border to use for the bottom border of the cell
- * @param border type
- */
- void setBorderBottom(BorderStyle border);
-
- /**
- * get the type of border to use for the bottom border of the cell
- * @return border type
- */
- BorderStyle getBorderBottom();
-
- /**
- * set the color to use for the left border
- * @param color The index of the color definition
- */
- void setLeftBorderColor(short color);
-
- /**
- * get the color to use for the left border
- */
- short getLeftBorderColor();
-
- /**
- * set the color to use for the right border
- * @param color The index of the color definition
- */
- void setRightBorderColor(short color);
-
- /**
- * get the color to use for the left border
- * @return the index of the color definition
- */
- short getRightBorderColor();
-
- /**
- * set the color to use for the top border
- * @param color The index of the color definition
- */
- void setTopBorderColor(short color);
-
- /**
- * get the color to use for the top border
- * @return hhe index of the color definition
- */
- short getTopBorderColor();
-
- /**
- * set the color to use for the bottom border
- * @param color The index of the color definition
- */
- void setBottomBorderColor(short color);
-
- /**
- * get the color to use for the left border
- * @return the index of the color definition
- */
- short getBottomBorderColor();
-
- /**
- * setting to one fills the cell with the foreground color... No idea about
- * other values
- *
- * @see #NO_FILL
- * @see #SOLID_FOREGROUND
- * @see #FINE_DOTS
- * @see #ALT_BARS
- * @see #SPARSE_DOTS
- * @see #THICK_HORZ_BANDS
- * @see #THICK_VERT_BANDS
- * @see #THICK_BACKWARD_DIAG
- * @see #THICK_FORWARD_DIAG
- * @see #BIG_SPOTS
- * @see #BRICKS
- * @see #THIN_HORZ_BANDS
- * @see #THIN_VERT_BANDS
- * @see #THIN_BACKWARD_DIAG
- * @see #THIN_FORWARD_DIAG
- * @see #SQUARES
- * @see #DIAMONDS
- *
- * @param fp fill pattern (set to 1 to fill w/foreground color)
- */
- void setFillPattern(short fp);
-
- /**
- * get the fill pattern (??) - set to 1 to fill with foreground color
- * @return fill pattern
- */
-
- short getFillPattern();
-
- /**
- * set the background fill color.
- *
- * @param bg color
- */
-
- void setFillBackgroundColor(short bg);
-
- /**
- * get the background fill color, if the fill
- * is defined with an indexed color.
- * @return fill color index, or 0 if not indexed (XSSF only)
- */
- short getFillBackgroundColor();
-
- /**
- * Gets the color object representing the current
- * background fill, resolving indexes using
- * the supplied workbook.
- * This will work for both indexed and rgb
- * defined colors.
- */
- Color getFillBackgroundColorColor();
-
- /**
- * set the foreground fill color
- * <i>Note: Ensure Foreground color is set prior to background color.</i>
- * @param bg color
- */
- void setFillForegroundColor(short bg);
-
- /**
- * get the foreground fill color, if the fill
- * is defined with an indexed color.
- * @return fill color, or 0 if not indexed (XSSF only)
- */
- short getFillForegroundColor();
-
- /**
- * Gets the color object representing the current
- * foreground fill, resolving indexes using
- * the supplied workbook.
- * This will work for both indexed and rgb
- * defined colors.
- */
- Color getFillForegroundColorColor();
-
- /**
- * Clones all the style information from another
- * CellStyle, onto this one. This
- * CellStyle will then have all the same
- * properties as the source, but the two may
- * be edited independently.
- * Any stylings on this CellStyle will be lost!
- *
- * The source CellStyle could be from another
- * Workbook if you like. This allows you to
- * copy styles from one Workbook to another.
- *
- * However, both of the CellStyles will need
- * to be of the same type (HSSFCellStyle or
- * XSSFCellStyle)
- */
- public void cloneStyleFrom(CellStyle source);
-
- /**
- * Controls if the Cell should be auto-sized
- * to shrink to fit if the text is too long
- */
- public void setShrinkToFit(boolean shrinkToFit);
-
- /**
- * Should the Cell be auto-sized by Excel to shrink
- * it to fit if this text is too long?
- */
- public boolean getShrinkToFit();
- }
|