Remove more deprecated code (especially from Spreadsheet Cell classes)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1800375 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-06-30 11:48:23 +00:00
parent e552b04d9c
commit ee70c9a8fb
21 changed files with 234 additions and 1413 deletions

View File

@ -12,8 +12,11 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
@ -23,6 +26,7 @@ org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@ -46,12 +50,25 @@ org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
@ -111,6 +128,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
@ -124,8 +142,10 @@ org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
@ -135,6 +155,8 @@ org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
@ -193,6 +215,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -387,11 +410,24 @@ org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View File

@ -49,7 +49,7 @@ import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
* but it could be any other string.</p>
*
* <p>The value of a tree node is a {@link DocumentDescriptor}. Unlike
* a {@link org.apache.poi.poifs.filesystem.POIFSDocument} which may be as heavy
* a {@link org.apache.poi.poifs.filesystem.OPOIFSDocument} which may be as heavy
* as many megabytes, an instance of {@link DocumentDescriptor} is a
* light-weight object and contains only some meta-information about a
* document.</p>

View File

@ -22,38 +22,6 @@ import org.apache.poi.util.Removal;
* Represents a hyperlink.
*/
public interface Hyperlink {
/**
* Link to an existing file or web page
*
* @deprecated POI 3.15 beta 3. Use {@link HyperlinkType#URL} instead.
*/
@Removal(version="3.17")
public static final int LINK_URL = 1; // HyperlinkType.URL.getCode()
/**
* Link to a place in this document
*
* @deprecated POI 3.15 beta 3. Use {@link HyperlinkType#DOCUMENT} instead.
*/
@Removal(version="3.17")
public static final int LINK_DOCUMENT = 2; // HyperlinkType.DOCUMENT.getCode()
/**
* Link to an E-mail address
*
* @deprecated POI 3.15 beta 3. Use {@link HyperlinkType#EMAIL} instead.
*/
@Removal(version="3.17")
public static final int LINK_EMAIL = 3; // HyperlinkType.EMAIL.getCode()
/**
* Link to an file
*
* @deprecated POI 3.15 beta 3. Use {@link HyperlinkType#FILE} instead.
*/
@Removal(version="3.17")
public static final int LINK_FILE = 4; // HyperlinkType.FILE.getCode()
/**
* Hyperlink address. Depending on the hyperlink type it can be URL, e-mail, path to a file, etc.

View File

@ -53,19 +53,6 @@ public final class HSSFFormulaParser {
return parse(formula, workbook, FormulaType.CELL);
}
/**
* @param formula The formula to parse, excluding the leading equals sign
* @param workbook The parent workbook
* @param formulaType a constant from {@link FormulaType}
* @return the parsed formula tokens
* @throws FormulaParseException if the formula has incorrect syntax or is otherwise invalid
*
* @deprecated POI 3.15 beta 3. Use {@link #parse(String, HSSFWorkbook, FormulaType)} instead.
*/
@Removal(version="3.17")
public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType) throws FormulaParseException {
return parse(formula, workbook, FormulaType.forInt(formulaType));
}
/**
* @param formula The formula to parse, excluding the leading equals sign
* @param workbook The parent workbook
@ -77,22 +64,6 @@ public final class HSSFFormulaParser {
return parse(formula, workbook, formulaType, -1);
}
/**
* @param formula the formula to parse
* @param workbook the parent workbook
* @param formulaType a constant from {@link FormulaType}
* @param sheetIndex the 0-based index of the sheet this formula belongs to.
* The sheet index is required to resolve sheet-level names. <code>-1</code> means that
* the scope of the name will be ignored and the parser will match named ranges only by name
*
* @return the parsed formula tokens
* @throws FormulaParseException if the formula has incorrect syntax or is otherwise invalid
* @deprecated POI 3.15 beta 3. Use {@link #parse(String, HSSFWorkbook, FormulaType, int)} instead.
*/
@Removal(version="3.17")
public static Ptg[] parse(String formula, HSSFWorkbook workbook, int formulaType, int sheetIndex) throws FormulaParseException {
return parse(formula, workbook, FormulaType.forInt(formulaType), sheetIndex);
}
/**
* @param formula The formula to parse
* @param workbook The parent workbook

View File

@ -33,7 +33,6 @@ import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.util.Removal;
/**
* High level representation of the style of a cell in a sheet of a workbook.
@ -168,7 +167,7 @@ public final class HSSFCellStyle implements CellStyle {
/**
* set the font for this style
* @param font a font object created or retreived from the HSSFWorkbook object
* @param font a font object created or retrieved from the HSSFWorkbook object
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createFont()
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
*/
@ -262,26 +261,6 @@ public final class HSSFCellStyle implements CellStyle {
return _format.get123Prefix();
}
/**
* 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
* @deprecated POI 3.15 beta 3. Use {@link #setAlignment(HorizontalAlignment)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setAlignment(short align)
{
_format.setIndentNotParentAlignment(true);
_format.setAlignment(align);
}
/**
* set the type of horizontal alignment for the cell
* @param align - the type of alignment
@ -296,13 +275,6 @@ public final class HSSFCellStyle implements CellStyle {
/**
* 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
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
*/
@Deprecated
@ -342,23 +314,6 @@ public final class HSSFCellStyle implements CellStyle {
return _format.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
* @see VerticalAlignment
* @deprecated POI 3.15 beta 3. Use {@link #setVerticalAlignment(VerticalAlignment)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setVerticalAlignment(short align)
{
_format.setVerticalAlignment(align);
}
/**
* set the type of vertical alignment for the cell
* @param align the type of alignment
@ -372,10 +327,6 @@ public final class HSSFCellStyle implements CellStyle {
/**
* 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
* @see VerticalAlignment
* @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead.
*/
@ -465,33 +416,6 @@ public final class HSSFCellStyle implements CellStyle {
{
return _format.getIndent();
}
/**
* 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 2. Use {@link HSSFCellStyle#setBorderLeft(BorderStyle)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setBorderLeft(short border) {
_format.setIndentNotParentBorder(true);
_format.setBorderLeft(border);
}
/**
* set the type of border to use for the left border of the cell
@ -501,7 +425,8 @@ public final class HSSFCellStyle implements CellStyle {
@Override
public void setBorderLeft(BorderStyle border)
{
setBorderLeft(border.getCode());
_format.setIndentNotParentBorder(true);
_format.setBorderLeft(border.getCode());
}
/**
@ -525,34 +450,6 @@ public final class HSSFCellStyle implements CellStyle {
{
return BorderStyle.valueOf(_format.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 2. Use {@link HSSFCellStyle#setBorderRight(BorderStyle)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setBorderRight(short border)
{
_format.setIndentNotParentBorder(true);
_format.setBorderRight(border);
}
/**
* set the type of border to use for the right border of the cell
@ -562,7 +459,8 @@ public final class HSSFCellStyle implements CellStyle {
@Override
public void setBorderRight(BorderStyle border)
{
setBorderRight(border.getCode());
_format.setIndentNotParentBorder(true);
_format.setBorderRight(border.getCode());
}
/**
@ -586,34 +484,6 @@ public final class HSSFCellStyle implements CellStyle {
{
return BorderStyle.valueOf(_format.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 2. Use {@link HSSFCellStyle#setBorderTop(BorderStyle)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setBorderTop(short border)
{
_format.setIndentNotParentBorder(true);
_format.setBorderTop(border);
}
/**
* set the type of border to use for the top border of the cell
@ -623,7 +493,8 @@ public final class HSSFCellStyle implements CellStyle {
@Override
public void setBorderTop(BorderStyle border)
{
setBorderTop(border.getCode());
_format.setIndentNotParentBorder(true);
_format.setBorderTop(border.getCode());
}
/**
@ -647,34 +518,6 @@ public final class HSSFCellStyle implements CellStyle {
{
return BorderStyle.valueOf(_format.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 2. Use {@link HSSFCellStyle#setBorderBottom(BorderStyle)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setBorderBottom(short border)
{
_format.setIndentNotParentBorder(true);
_format.setBorderBottom(border);
}
/**
* set the type of border to use for the bottom border of the cell
@ -684,7 +527,8 @@ public final class HSSFCellStyle implements CellStyle {
@Override
public void setBorderBottom(BorderStyle border)
{
setBorderBottom(border.getCode());
_format.setIndentNotParentBorder(true);
_format.setBorderBottom(border.getCode());
}
/**
@ -792,39 +636,6 @@ public final class HSSFCellStyle implements CellStyle {
{
return _format.getBottomBorderPaletteIdx();
}
/**
* 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)
* @deprecated POI 3.15 beta 3. Use {@link #setFillPattern(FillPatternType)} instead.
*/
@Deprecated
@Removal(version="3.17")
@Override
public void setFillPattern(short fp)
{
setFillPattern(FillPatternType.forInt(fp));
}
/**
* setting to one fills the cell with the foreground color... No idea about

View File

@ -1,169 +0,0 @@
/* ====================================================================
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.hssf.util;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.util.CellUtil;
import org.apache.poi.util.Removal;
/**
* Various utility functions that make working with a cells and rows easier. The various
* methods that deal with style's allow you to create your HSSFCellStyles as you need them.
* When you apply a style change to a cell, the code will attempt to see if a style already
* exists that meets your needs. If not, then it will create a new style. This is to prevent
* creating too many styles. there is an upper limit in Excel on the number of styles that
* can be supported.
*
* @deprecated 3.15 beta2. Use {@link org.apache.poi.ss.util.CellUtil} instead.
*/
@Deprecated
@Removal(version="3.17")
public final class HSSFCellUtil {
private HSSFCellUtil() {
// no instances of this class
}
/**
* Get a row from the spreadsheet, and create it if it doesn't exist.
*
* @param rowIndex The 0 based row number
* @param sheet The sheet that the row is part of.
* @return The row indicated by the rowCounter
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#getRow} instead.
*/
public static HSSFRow getRow(int rowIndex, HSSFSheet sheet) {
return (HSSFRow) CellUtil.getRow(rowIndex, sheet);
}
/**
* Get a specific cell from a row. If the cell doesn't exist,
* then create it.
*
* @param row The row that the cell is part of
* @param columnIndex The column index that the cell is in.
* @return The cell indicated by the column.
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#getCell} instead.
*/
public static HSSFCell getCell(HSSFRow row, int columnIndex) {
return (HSSFCell) CellUtil.getCell(row, columnIndex);
}
/**
* Creates a cell, gives it a value, and applies a style if provided
*
* @param row the row to create the cell in
* @param column the column index to create the cell in
* @param value The value of the cell
* @param style If the style is not null, then set
* @return A new HSSFCell
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#createCell} instead.
*/
public static HSSFCell createCell(HSSFRow row, int column, String value, HSSFCellStyle style) {
return (HSSFCell) CellUtil.createCell(row, column, value, style);
}
/**
* Create a cell, and give it a value.
*
* @param row the row to create the cell in
* @param column the column index to create the cell in
* @param value The value of the cell
* @return A new HSSFCell.
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#createCell} instead.
*/
public static HSSFCell createCell(HSSFRow row, int column, String value) {
return createCell( row, column, value, null );
}
/**
* Take a cell, and align it.
*
* @param cell the cell to set the alignment for
* @param workbook The workbook that is being worked with.
* @param align the column alignment to use.
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#setAlignment} instead.
*
* @see HSSFCellStyle for alignment options
*/
public static void setAlignment(HSSFCell cell, HSSFWorkbook workbook, short align) {
setAlignment(cell, HorizontalAlignment.forInt(align));
}
/**
* Take a cell, and align it.
*
* @param cell the cell to set the alignment for
* @param align the column alignment to use.
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#setAlignment} instead.
*
* @see HSSFCellStyle for alignment options
*/
public static void setAlignment(HSSFCell cell, HorizontalAlignment align) {
CellUtil.setAlignment(cell, align);
}
/**
* Take a cell, and apply a font to it
*
* @param cell the cell to set the alignment for
* @param workbook The workbook that is being worked with.
* @param font The HSSFFont that you want to set.
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#setFont} instead.
*/
public static void setFont(HSSFCell cell, HSSFWorkbook workbook, HSSFFont font) {
CellUtil.setFont(cell, font);
}
/**
* This method attempt to find an already existing HSSFCellStyle that matches
* what you want the style to be. If it does not find the style, then it
* creates a new one. If it does create a new one, then it applies the
* propertyName and propertyValue to the style. This is necessary because
* Excel has an upper limit on the number of Styles that it supports.
*
* @param workbook The workbook that is being worked with.
* @param propertyName The name of the property that is to be changed.
* @param propertyValue The value of the property that is to be changed.
* @param cell The cell that needs it's style changes
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#setCellStyleProperty} instead.
*/
public static void setCellStyleProperty(HSSFCell cell, HSSFWorkbook workbook,
String propertyName, Object propertyValue) {
CellUtil.setCellStyleProperty(cell, propertyName, propertyValue);
}
/**
* Looks for text in the cell that should be unicode, like &alpha; and provides the
* unicode version of it.
*
* @param cell The cell to check for unicode values
* @return translated to unicode (the cell is modified in-place and returned)
*
* @deprecated 3.15 beta2. Removed in 3.17. Use {@link org.apache.poi.ss.util.CellUtil#translateUnicodeValues} instead.
*/
public static HSSFCell translateUnicodeValues(HSSFCell cell){
CellUtil.translateUnicodeValues(cell);
return cell;
}
}

View File

@ -19,8 +19,8 @@ package org.apache.poi.hssf.util;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.util.RegionUtil;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.RegionUtil;
/**
* Various utility functions that make working with a region of cells easier.
@ -42,7 +42,7 @@ public final class HSSFRegionUtil {
*/
public static void setBorderLeft(int border, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setBorderLeft(border, region, sheet, workbook);
RegionUtil.setBorderLeft(border, region, sheet);
}
/**
@ -55,7 +55,7 @@ public final class HSSFRegionUtil {
*/
public static void setLeftBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setLeftBorderColor(color, region, sheet, workbook);
RegionUtil.setLeftBorderColor(color, region, sheet);
}
/**
@ -68,7 +68,7 @@ public final class HSSFRegionUtil {
*/
public static void setBorderRight(int border, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setBorderRight(border, region, sheet, workbook);
RegionUtil.setBorderRight(border, region, sheet);
}
/**
@ -81,7 +81,7 @@ public final class HSSFRegionUtil {
*/
public static void setRightBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setRightBorderColor(color, region, sheet, workbook);
RegionUtil.setRightBorderColor(color, region, sheet);
}
/**
@ -94,7 +94,7 @@ public final class HSSFRegionUtil {
*/
public static void setBorderBottom(int border, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setBorderBottom(border, region, sheet, workbook);
RegionUtil.setBorderBottom(border, region, sheet);
}
/**
@ -107,7 +107,7 @@ public final class HSSFRegionUtil {
*/
public static void setBottomBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setBottomBorderColor(color, region, sheet, workbook);
RegionUtil.setBottomBorderColor(color, region, sheet);
}
/**
@ -120,7 +120,7 @@ public final class HSSFRegionUtil {
*/
public static void setBorderTop(int border, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setBorderTop(border, region, sheet, workbook);
RegionUtil.setBorderTop(border, region, sheet);
}
/**
@ -133,6 +133,6 @@ public final class HSSFRegionUtil {
*/
public static void setTopBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook) {
RegionUtil.setTopBorderColor(color, region, sheet, workbook);
RegionUtil.setTopBorderColor(color, region, sheet);
}
}

View File

@ -17,318 +17,8 @@
package org.apache.poi.ss.usermodel;
import org.apache.poi.util.Removal;
public interface CellStyle {
/**
* general (normal) horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#GENERAL} instead.
*/
@Removal(version="3.17")
short ALIGN_GENERAL = 0x0; //HorizontalAlignment.GENERAL.getCode();
/**
* left-justified horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#LEFT} instead.
*/
@Removal(version="3.17")
short ALIGN_LEFT = 0x1; //HorizontalAlignment.LEFT.getCode();
/**
* center horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER} instead.
*/
@Removal(version="3.17")
short ALIGN_CENTER = 0x2; //HorizontalAlignment.CENTER.getCode();
/**
* right-justified horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#RIGHT} instead.
*/
@Removal(version="3.17")
short ALIGN_RIGHT = 0x3; //HorizontalAlignment.RIGHT.getCode();
/**
* fill? horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#FILL} instead.
*/
@Removal(version="3.17")
short ALIGN_FILL = 0x4; //HorizontalAlignment.FILL.getCode();
/**
* justified horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#JUSTIFY} instead.
*/
@Removal(version="3.17")
short ALIGN_JUSTIFY = 0x5; //HorizontalAlignment.JUSTIFY.getCode();
/**
* center-selection? horizontal alignment
* @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER_SELECTION} instead.
*/
@Removal(version="3.17")
short ALIGN_CENTER_SELECTION = 0x6; //HorizontalAlignment.CENTER_SELECTION.getCode();
/**
* top-aligned vertical alignment
* @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#TOP} instead.
*/
@Removal(version="3.17")
short VERTICAL_TOP = 0x0; //VerticalAlignment.TOP.getCode();
/**
* center-aligned vertical alignment
* @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#CENTER} instead.
*/
@Removal(version="3.17")
short VERTICAL_CENTER = 0x1; //VerticalAlignment.CENTER.getCode();
/**
* bottom-aligned vertical alignment
* @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#BOTTOM} instead.
*/
@Removal(version="3.17")
short VERTICAL_BOTTOM = 0x2; //VerticalAlignment.BOTTOM.getCode();
/**
* vertically justified vertical alignment
* @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#JUSTIFY} instead.
*/
@Removal(version="3.17")
short VERTICAL_JUSTIFY = 0x3; //VerticalAlignment.JUSTIFY.getCode();
/**
* No border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#NONE} instead.
*/
@Removal(version="3.17")
short BORDER_NONE = 0x0; //BorderStyle.NONE.getCode();
/**
* Thin border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#THIN} instead.
*/
@Removal(version="3.17")
short BORDER_THIN = 0x1; //BorderStyle.THIN.getCode();
/**
* Medium border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM} instead.
*/
@Removal(version="3.17")
short BORDER_MEDIUM = 0x2; //BorderStyle.MEDIUM.getCode();
/**
* dash border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#DASHED} instead.
*/
@Removal(version="3.17")
short BORDER_DASHED = 0x3; //BorderStyle.DASHED.getCode();
/**
* dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#DOTTED} instead.
*/
@Removal(version="3.17")
short BORDER_DOTTED = 0x4; //BorderStyle.DOTTED.getCode();
/**
* Thick border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#THICK} instead.
*/
@Removal(version="3.17")
short BORDER_THICK = 0x5; //BorderStyle.THICK.getCode();
/**
* double-line border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#DOUBLE} instead.
*/
@Removal(version="3.17")
short BORDER_DOUBLE = 0x6; //BorderStyle.DOUBLE.getCode();
/**
* hair-line border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#HAIR} instead.
*/
@Removal(version="3.17")
short BORDER_HAIR = 0x7; //BorderStyle.HAIR.getCode();
/**
* Medium dashed border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASHED} instead.
*/
@Removal(version="3.17")
short BORDER_MEDIUM_DASHED = 0x8; //BorderStyle.MEDIUM_DASHED.getCode();
/**
* dash-dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT} instead.
*/
@Removal(version="3.17")
short BORDER_DASH_DOT = 0x9; //BorderStyle.DASH_DOT.getCode();
/**
* medium dash-dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT} instead.
*/
@Removal(version="3.17")
short BORDER_MEDIUM_DASH_DOT = 0xA; //BorderStyle.MEDIUM_DASH_DOT.getCode();
/**
* dash-dot-dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT_DOT} instead.
*/
@Removal(version="3.17")
short BORDER_DASH_DOT_DOT = 0xB; //BorderStyle.DASH_DOT_DOT.getCode();
/**
* medium dash-dot-dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT_DOT} instead.
*/
@Removal(version="3.17")
short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; //BorderStyle.MEDIUM_DASH_DOT_DOT.getCode();
/**
* slanted dash-dot border
* @deprecated 3.15 beta 2. Use {@link BorderStyle#SLANTED_DASH_DOT} instead.
*/
@Removal(version="3.17")
short BORDER_SLANTED_DASH_DOT = 0xD; //BorderStyle.SLANTED_DASH_DOT.getCode();
/**
* Fill Pattern: No background
* @deprecated 3.15 beta 3. Use {@link FillPatternType#NO_FILL} instead.
*/
@Removal(version="3.17")
short NO_FILL = 0; //FillPatternType.NO_FILL.getCode();
/**
* Fill Pattern: Solidly filled
* @deprecated 3.15 beta 3. Use {@link FillPatternType#SOLID_FOREGROUND} instead.
*/
@Removal(version="3.17")
short SOLID_FOREGROUND = 1; //FillPatternType.SOLID_FOREGROUND.getCode();
/**
* Fill Pattern: Small fine dots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#FINE_DOTS} instead.
*/
@Removal(version="3.17")
short FINE_DOTS = 2; //FillPatternType.FINE_DOTS.getCode();
/**
* Fill Pattern: Wide dots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#ALT_BARS} instead.
*/
@Removal(version="3.17")
short ALT_BARS = 3; //FillPatternType.ALT_BARS.getCode();
/**
* Fill Pattern: Sparse dots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#SPARSE_DOTS} instead.
*/
@Removal(version="3.17")
short SPARSE_DOTS = 4; //FillPatternType.SPARSE_DOTS.getCode();
/**
* Fill Pattern: Thick horizontal bands
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_HORZ_BANDS} instead.
*/
@Removal(version="3.17")
short THICK_HORZ_BANDS = 5; //FillPatternType.THICK_HORZ_BANDS.getCode();
/**
* Fill Pattern: Thick vertical bands
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_VERT_BANDS} instead.
*/
@Removal(version="3.17")
short THICK_VERT_BANDS = 6; //FillPatternType.THICK_VERT_BANDS.getCode();
/**
* Fill Pattern: Thick backward facing diagonals
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_BACKWARD_DIAG} instead.
*/
@Removal(version="3.17")
short THICK_BACKWARD_DIAG = 7; //FillPatternType.THICK_BACKWARD_DIAG.getCode();
/**
* Fill Pattern: Thick forward facing diagonals
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_FORWARD_DIAG} instead.
*/
@Removal(version="3.17")
short THICK_FORWARD_DIAG = 8; //FillPatternType.THICK_FORWARD_DIAG.getCode();
/**
* Fill Pattern: Large spots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#BIG_SPOTS} instead.
*/
@Removal(version="3.17")
short BIG_SPOTS = 9; //FillPatternType.BIG_SPOTS.getCode();
/**
* Fill Pattern: Brick-like layout
* @deprecated 3.15 beta 3. Use {@link FillPatternType#BRICKS} instead.
*/
@Removal(version="3.17")
short BRICKS = 10; //FillPatternType.BRICKS.getCode();
/**
* Fill Pattern: Thin horizontal bands
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_HORZ_BANDS} instead.
*/
@Removal(version="3.17")
short THIN_HORZ_BANDS = 11; //FillPatternType.THIN_HORZ_BANDS.getCode();
/**
* Fill Pattern: Thin vertical bands
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_VERT_BANDS} instead.
*/
@Removal(version="3.17")
short THIN_VERT_BANDS = 12; //FillPatternType.THIN_VERT_BANDS.getCode();
/**
* Fill Pattern: Thin backward diagonal
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_BACKWARD_DIAG} instead.
*/
@Removal(version="3.17")
short THIN_BACKWARD_DIAG = 13; //FillPatternType.THIN_BACKWARD_DIAG.getCode();
/**
* Fill Pattern: Thin forward diagonal
* @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_FORWARD_DIAG} instead.
*/
@Removal(version="3.17")
short THIN_FORWARD_DIAG = 14; //FillPatternType.THIN_FORWARD_DIAG.getCode();
/**
* Fill Pattern: Squares
* @deprecated 3.15 beta 3. Use {@link FillPatternType#SQUARES} instead.
*/
@Removal(version="3.17")
short SQUARES = 15; //FillPatternType.SQUARES.getCode();
/**
* Fill Pattern: Diamonds
* @deprecated 3.15 beta 3. Use {@link FillPatternType#DIAMONDS} instead.
*/
@Removal(version="3.17")
short DIAMONDS = 16; //FillPatternType.DIAMONDS.getCode();
/**
* Fill Pattern: Less Dots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#LESS_DOTS} instead.
*/
@Removal(version="3.17")
short LESS_DOTS = 17; //FillPatternType.LESS_DOTS.getCode();
/**
* Fill Pattern: Least Dots
* @deprecated 3.15 beta 3. Use {@link FillPatternType#LEAST_DOTS} instead.
*/
@Removal(version="3.17")
short LEAST_DOTS = 18; //FillPatternType.LEAST_DOTS.getCode();
/**
* 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
@ -414,19 +104,6 @@ public interface CellStyle {
*/
boolean getQuotePrefixed();
/**
* 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
* @deprecated POI 3.15 beta 3. Use {@link #setAlignment(HorizontalAlignment)} instead.
*/
void setAlignment(short align);
/**
* set the type of horizontal alignment for the cell
* @param align - the type of alignment
@ -436,13 +113,6 @@ public interface CellStyle {
/**
* 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
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
*/
short getAlignment();
@ -469,16 +139,6 @@ public interface CellStyle {
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
* @deprecated POI 3.15 beta 3. Use {@link #setVerticalAlignment(VerticalAlignment)} instead.
*/
void setVerticalAlignment(short align);
/**
* set the type of vertical alignment for the cell
* @param align the type of alignment
@ -488,10 +148,6 @@ public interface CellStyle {
/**
* 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
* @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead.
*/
short getVerticalAlignment();
@ -538,28 +194,6 @@ public interface CellStyle {
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 2. Use {@link #setBorderLeft(BorderStyle)} instead
*/
@Removal(version="3.17")
void setBorderLeft(short border);
/**
* set the type of border to use for the left border of the cell
* @param border type
@ -581,28 +215,6 @@ public interface CellStyle {
*/
BorderStyle getBorderLeftEnum();
/**
* 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 2. Use {@link #setBorderRight(BorderStyle)} instead
*/
@Removal(version="3.17")
void setBorderRight(short border);
/**
* set the type of border to use for the right border of the cell
* @param border type
@ -624,28 +236,6 @@ public interface CellStyle {
*/
BorderStyle getBorderRightEnum();
/**
* 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 2. Use {@link #setBorderTop(BorderStyle)} instead
*/
@Removal(version="3.17")
void setBorderTop(short border);
/**
* set the type of border to use for the top border of the cell
* @param border type
@ -666,28 +256,6 @@ public interface CellStyle {
* @since POI 3.15
*/
BorderStyle getBorderTopEnum();
/**
* 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 2. Use {@link #setBorderBottom(BorderStyle)} instead.
*/
@Removal(version="3.17")
void setBorderBottom(short border);
/**
* set the type of border to use for the bottom border of the cell
@ -761,50 +329,6 @@ public interface CellStyle {
* 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)
* @deprecated POI 3.15 beta 3. Use {@link #setFillPattern(FillPatternType)} instead.
*/
void setFillPattern(short fp);
/**
* 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 {@link FillPatternType#SOLID_FOREGROUND} to fill w/foreground color)
* @since POI 3.15 beta 3
*/

View File

@ -261,7 +261,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> {
/**
* Get the Sheet object at the given index.
*
* @param index of the sheet number (0-based physical & logical)
* @param index of the sheet number (0-based physical &amp; logical)
* @return Sheet at the provided index
* @throws IllegalArgumentException if the index is out of range (index
* &lt; 0 || index &gt;= getNumberOfSheets()).

View File

@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.poi.ss.usermodel.BorderStyle;
@ -188,29 +187,6 @@ public final class CellUtil {
return createCell(row, column, value, null);
}
/**
* Take a cell, and align it.
*
* This is superior to cell.getCellStyle().setAlignment(align) because
* this method will not modify the CellStyle object that may be referenced
* by multiple cells. Instead, this method will search for existing CellStyles
* that match the desired CellStyle, creating a new CellStyle with the desired
* style if no match exists.
*
* @param cell the cell to set the alignment for
* @param workbook The workbook that is being worked with.
* @param align the column alignment to use.
*
* @deprecated 3.15-beta2. Use {@link #setAlignment(Cell, HorizontalAlignment)} instead.
*
* @see CellStyle for alignment options
*/
@Deprecated
@Removal(version="3.17")
public static void setAlignment(Cell cell, Workbook workbook, short align) {
setAlignment(cell, HorizontalAlignment.forInt(align));
}
/**
* Take a cell, and align it.
*
@ -658,40 +634,6 @@ public final class CellUtil {
properties.put(name, value);
}
/**
* Utility method that puts the named short value to the given map.
*
* @param properties map of properties (String -> Object)
* @param name property name
* @param value property value
*/
private static void putShort(Map<String, Object> properties, String name, short value) {
properties.put(name, value);
}
/**
* Utility method that puts the named BorderStyle, HorizontalAlignment, VerticalAlignment, etc
* value to the given map.
*
* @param properties map of properties (String -> Object)
* @param name property name
* @param value property value
*/
private static void putEnum(Map<String, Object> properties, String name, Enum<?> value) {
properties.put(name, value);
}
/**
* Utility method that puts the named boolean value to the given map.
*
* @param properties map of properties (String -> Object)
* @param name property name
* @param value property value
*/
private static void putBoolean(Map<String, Object> properties, String name, boolean value) {
properties.put(name, value);
}
/**
* Looks for text in the cell that should be unicode, like &alpha; and provides the
* unicode version of it.

View File

@ -21,7 +21,6 @@ import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
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.util.Removal;
/**
@ -58,20 +57,6 @@ public final class RegionUtil {
}
}
/**
* Sets the left border style for a region of cells by manipulating the cell style of the individual
* cells on the left
*
* @param border The new border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setBorderLeft(BorderStyle, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setBorderLeft(int border, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setBorderLeft(border, region, sheet);
}
/**
* Sets the left border style for a region of cells by manipulating the cell style of the individual
* cells on the left
@ -113,20 +98,6 @@ public final class RegionUtil {
}
}
/**
* Sets the left border color for a region of cells by manipulating the cell style of the individual
* cells on the left
*
* @param color The color of the border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setLeftBorderColor(int, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setLeftBorderColor(int color, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setLeftBorderColor(color, region, sheet);
}
/**
* Sets the left border color for a region of cells by manipulating the cell style of the individual
* cells on the left
@ -147,20 +118,6 @@ public final class RegionUtil {
}
}
/**
* Sets the right border style for a region of cells by manipulating the cell style of the individual
* cells on the right
*
* @param border The new border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setBorderRight(BorderStyle, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setBorderRight(int border, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setBorderRight(border, region, sheet);
}
/**
* Sets the right border style for a region of cells by manipulating the cell style of the individual
* cells on the right
@ -202,20 +159,6 @@ public final class RegionUtil {
}
}
/**
* Sets the right border color for a region of cells by manipulating the cell style of the individual
* cells on the right
*
* @param color The color of the border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setRightBorderColor(int, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setRightBorderColor(int color, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setRightBorderColor(color, region, sheet);
}
/**
* Sets the right border color for a region of cells by manipulating the cell style of the individual
* cells on the right
@ -236,20 +179,6 @@ public final class RegionUtil {
}
}
/**
* Sets the bottom border style for a region of cells by manipulating the cell style of the individual
* cells on the bottom
*
* @param border The new border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setBorderBottom(BorderStyle, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setBorderBottom(int border, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setBorderBottom(border, region, sheet);
}
/**
* Sets the bottom border style for a region of cells by manipulating the cell style of the individual
* cells on the bottom
@ -291,20 +220,6 @@ public final class RegionUtil {
}
}
/**
* Sets the bottom border color for a region of cells by manipulating the cell style of the individual
* cells on the bottom
*
* @param color The color of the border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setBottomBorderColor(int, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setBottomBorderColor(int color, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setBottomBorderColor(color, region, sheet);
}
/**
* Sets the bottom border color for a region of cells by manipulating the cell style of the individual
* cells on the bottom
@ -325,20 +240,6 @@ public final class RegionUtil {
}
}
/**
* Sets the top border style for a region of cells by manipulating the cell style of the individual
* cells on the top
*
* @param border The new border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setBorderTop(BorderStyle, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setBorderTop(int border, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setBorderTop(border, region, sheet);
}
/**
* Sets the top border style for a region of cells by manipulating the cell style of the individual
* cells on the top
@ -380,20 +281,6 @@ public final class RegionUtil {
}
}
/**
* Sets the top border color for a region of cells by manipulating the cell style of the individual
* cells on the top
*
* @param color The color of the border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
* @deprecated 3.15 beta 2. Use {@link #setTopBorderColor(int, CellRangeAddress, Sheet)}.
*/
@Removal(version="3.17")
public static void setTopBorderColor(int color, CellRangeAddress region, Sheet sheet, Workbook workbook) {
setTopBorderColor(color, region, sheet);
}
/**
* Sets the top border color for a region of cells by manipulating the cell style of the individual
* cells on the top

View File

@ -28,7 +28,6 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.model.ThemesTable;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellAlignment;
@ -221,13 +220,6 @@ public class XSSFCellStyle implements CellStyle {
* Get the type of horizontal alignment for the cell
*
* @return short - the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
*/
@Override
@ -503,25 +495,7 @@ public class XSSFCellStyle implements CellStyle {
/**
* Get the fill pattern
* @return fill pattern, default value is {@link org.apache.poi.ss.usermodel.CellStyle#NO_FILL}
*
* @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
* @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
* @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
* @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
* @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
* @return fill pattern, default value is the code for {@link org.apache.poi.ss.usermodel.FillPatternType#NO_FILL}
* @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead.
*/
@Override
@ -742,11 +716,7 @@ public class XSSFCellStyle implements CellStyle {
/**
* Get the type of vertical alignment for the cell
*
* @return align the type of alignment, default value is {@link org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM}
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
* @return align the type of alignment, default value is {@link org.apache.poi.ss.usermodel.VerticalAlignment}
* @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead.
*/
@Override
@ -779,25 +749,6 @@ public class XSSFCellStyle implements CellStyle {
return align != null && align.getWrapText();
}
/**
* Set the type of horizontal alignment for the cell
*
* @param align - the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
* @deprecated POI 3.15 beta 3. Use {@link #setAlignment(HorizontalAlignment)} instead.
*/
@Removal(version="3.17")
@Override
public void setAlignment(short align) {
setAlignment(HorizontalAlignment.forInt(align));
}
/**
* Set the type of horizontal alignment for the cell
*
@ -808,18 +759,6 @@ public class XSSFCellStyle implements CellStyle {
getCellAlignment().setHorizontal(align);
}
/**
* Set the type of border to use for the bottom border of the cell
*
* @param border the type of border to use
* @deprecated 3.15 beta 2. Use {@link #setBorderBottom(BorderStyle)}
*/
@Removal(version="3.17")
@Override
public void setBorderBottom(short border) {
setBorderBottom(BorderStyle.valueOf(border));
}
/**
* Set the type of border to use for the bottom border of the cell
*
@ -840,17 +779,6 @@ public class XSSFCellStyle implements CellStyle {
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the left border of the cell
* @param border the type of border to use
* @deprecated 3.15 beta 2. Use {@link #setBorderLeft(BorderStyle)}
*/
@Removal(version="3.17")
@Override
public void setBorderLeft(short border) {
setBorderLeft(BorderStyle.valueOf(border));
}
/**
* Set the type of border to use for the left border of the cell
*
@ -870,18 +798,6 @@ public class XSSFCellStyle implements CellStyle {
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the right border of the cell
*
* @param border the type of border to use
* @deprecated 3.15 beta 2. Use {@link #setBorderRight(BorderStyle)}
*/
@Removal(version="3.17")
@Override
public void setBorderRight(short border) {
setBorderRight(BorderStyle.valueOf(border));
}
/**
* Set the type of border to use for the right border of the cell
*
@ -901,18 +817,6 @@ public class XSSFCellStyle implements CellStyle {
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the top border of the cell
*
* @param border the type of border to use
* @deprecated 3.15 beta 2. Use {@link #setBorderTop(BorderStyle)}
*/
@Removal(version="3.17")
@Override
public void setBorderTop(short border) {
setBorderTop(BorderStyle.valueOf(border));
}
/**
* Set the type of border to use for the top border of the cell
*
@ -1122,39 +1026,6 @@ public class XSSFCellStyle implements CellStyle {
return ct;
}
/**
* This element is used to specify cell fill information for pattern and solid color cell fills.
* For solid cell fills (no pattern), foreground color is used.
* For cell fills with patterns specified, then the cell fill color is specified by the background color.
*
* @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
* @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
* @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
* @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
* @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
* @see #setFillBackgroundColor(short)
* @see #setFillForegroundColor(short)
* @param fp fill pattern (set to {@link org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND} to fill w/foreground color)
* @deprecated POI 3.15. Use {@link #setFillPattern(FillPatternType)} instead.
*/
@Removal(version="3.17")
@Override
public void setFillPattern(short fp) {
setFillPattern(FillPatternType.forInt(fp));
}
/**
* This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern),
* foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element.
@ -1362,23 +1233,6 @@ public class XSSFCellStyle implements CellStyle {
_cellXf.setApplyBorder(true);
}
/**
* Set the type of vertical alignment for the cell
*
* @param align - align the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
* @see org.apache.poi.ss.usermodel.VerticalAlignment
* @deprecated POI 3.15 beta 3. Use {@link #setVerticalAlignment(VerticalAlignment)} instead.
*/
@Removal(version="3.17")
@Override
public void setVerticalAlignment(short align) {
setVerticalAlignment(VerticalAlignment.forInt(align));
}
/**
* Set the type of vertical alignment for the cell
*

View File

@ -26,7 +26,7 @@ import java.util.Locale;
import java.util.Map;
import org.apache.commons.codec.binary.Hex;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.ThemesTable.ThemeElement;
@ -130,7 +130,7 @@ public class TestThemesTable {
if (createFiles) {
XSSFCellStyle cs = row.getSheet().getWorkbook().createCellStyle();
cs.setFillForegroundColor(color);
cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
cs.setFillPattern(FillPatternType.SOLID_FOREGROUND);
row.createCell(1).setCellStyle(cs);
}
}

View File

@ -32,8 +32,8 @@ import java.util.Calendar;
import java.util.Date;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Row;
@ -242,17 +242,17 @@ public final class TestUnfixedBugs {
sheet.addMergedRegion(range4);
// set border
RegionUtil.setBorderBottom(CellStyle.BORDER_THIN, range1, sheet, wb);
RegionUtil.setBorderBottom(BorderStyle.THIN, range1, sheet);
row2.getCell(0).getCellStyle().setBorderBottom(CellStyle.BORDER_THIN);
row2.getCell(1).getCellStyle().setBorderBottom(CellStyle.BORDER_THIN);
row2.getCell(0).getCellStyle().setBorderBottom(BorderStyle.THIN);
row2.getCell(1).getCellStyle().setBorderBottom(BorderStyle.THIN);
Cell cell0 = CellUtil.getCell(row3, 0);
CellUtil.setCellStyleProperty(cell0, CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN);
CellUtil.setCellStyleProperty(cell0, CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
Cell cell1 = CellUtil.getCell(row3, 1);
CellUtil.setCellStyleProperty(cell1, CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN);
CellUtil.setCellStyleProperty(cell1, CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
RegionUtil.setBorderBottom(CellStyle.BORDER_THIN, range4, sheet, wb);
RegionUtil.setBorderBottom(BorderStyle.THIN, range4, sheet);
// write to file
OutputStream stream = new FileOutputStream(new File("C:/temp/55752.xlsx"));

View File

@ -94,7 +94,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedNames;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTFontImpl;
@SuppressWarnings("deprecation")
public final class TestXSSFBugs extends BaseTestBugzillaIssues {
public TestXSSFBugs() {
super(XSSFITestDataProvider.instance);
@ -1112,12 +1111,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
CellStyle blueStyle = wb.createCellStyle();
blueStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());
blueStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
blueStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(1, blueStyle.getIndex());
CellStyle pinkStyle = wb.createCellStyle();
pinkStyle.setFillForegroundColor(IndexedColors.PINK.getIndex());
pinkStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
pinkStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(2, pinkStyle.getIndex());
// Starts empty
@ -2979,13 +2978,13 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
XSSFColor color = new XSSFColor(java.awt.Color.RED);
XSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(color);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(style);
// Everything is fine at this point, cell is red
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN); //or BorderStyle.THIN
properties.put(CellUtil.BORDER_BOTTOM, BorderStyle.THIN);
CellUtil.setCellStyleProperties(cell, properties);
// Now the cell is all black

View File

@ -580,13 +580,13 @@ public class TestXSSFCellStyle {
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPatternEnum());
assertEquals(CellStyle.NO_FILL, defaultStyle.getFillPattern());
assertEquals(FillPatternType.NO_FILL.getCode(), defaultStyle.getFillPattern());
XSSFCellStyle customStyle = wb.createCellStyle();
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPatternEnum());
assertEquals(CellStyle.SOLID_FOREGROUND, customStyle.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), customStyle.getFillPattern());
assertEquals(3, styles.getFills().size());
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
@ -598,7 +598,7 @@ public class TestXSSFCellStyle {
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND, style.getFillPatternEnum());
assertEquals(CellStyle.SOLID_FOREGROUND, style.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), style.getFillPattern());
assertEquals(4, styles.getFills().size());
style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
@ -619,7 +619,7 @@ public class TestXSSFCellStyle {
int num = stylesTable.getFills().size();
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND, cellStyle.getFillPatternEnum());
assertEquals(CellStyle.SOLID_FOREGROUND, cellStyle.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), cellStyle.getFillPattern());
assertEquals(num + 1, stylesTable.getFills().size());
int fillId = (int)cellStyle.getCoreXf().getFillId();
assertTrue(fillId > 0);
@ -635,7 +635,7 @@ public class TestXSSFCellStyle {
cellStyle.setFillPattern(FillPatternType.NO_FILL);
assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPatternEnum());
assertEquals(CellStyle.NO_FILL, cellStyle.getFillPattern());
assertEquals(FillPatternType.NO_FILL.getCode(), cellStyle.getFillPattern());
fillId = (int)cellStyle.getCoreXf().getFillId();
ctFill2 = stylesTable.getFillAt(fillId).getCTFill();
assertFalse(ctFill2.getPatternFill().isSetPatternType());
@ -675,22 +675,22 @@ public class TestXSSFCellStyle {
}
@Test
public void testGetSetAlignement() {
public void testGetSetAlignment() {
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
assertEquals(HorizontalAlignment.GENERAL, cellStyle.getAlignmentEnum());
cellStyle.setAlignment(XSSFCellStyle.ALIGN_LEFT);
assertEquals(XSSFCellStyle.ALIGN_LEFT, cellStyle.getAlignment());
cellStyle.setAlignment(HorizontalAlignment.LEFT);
assertEquals(HorizontalAlignment.LEFT.getCode(), cellStyle.getAlignment());
assertEquals(HorizontalAlignment.LEFT, cellStyle.getAlignmentEnum());
assertEquals(STHorizontalAlignment.LEFT, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
cellStyle.setAlignment(HorizontalAlignment.JUSTIFY);
assertEquals(XSSFCellStyle.ALIGN_JUSTIFY, cellStyle.getAlignment());
assertEquals(HorizontalAlignment.JUSTIFY.getCode(), cellStyle.getAlignment());
assertEquals(HorizontalAlignment.JUSTIFY, cellStyle.getAlignmentEnum());
assertEquals(STHorizontalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
cellStyle.setAlignment(HorizontalAlignment.CENTER);
assertEquals(XSSFCellStyle.ALIGN_CENTER, cellStyle.getAlignment());
assertEquals(HorizontalAlignment.CENTER.getCode(), cellStyle.getAlignment());
assertEquals(HorizontalAlignment.CENTER, cellStyle.getAlignmentEnum());
assertEquals(STHorizontalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
}
@ -698,16 +698,16 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetVerticalAlignment() {
assertEquals(VerticalAlignment.BOTTOM, cellStyle.getVerticalAlignmentEnum());
assertEquals(XSSFCellStyle.VERTICAL_BOTTOM, cellStyle.getVerticalAlignment());
assertEquals(VerticalAlignment.BOTTOM.getCode(), cellStyle.getVerticalAlignment());
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
assertEquals(XSSFCellStyle.VERTICAL_CENTER, cellStyle.getVerticalAlignment());
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
assertEquals(VerticalAlignment.CENTER.getCode(), cellStyle.getVerticalAlignment());
assertEquals(VerticalAlignment.CENTER, cellStyle.getVerticalAlignmentEnum());
assertEquals(STVerticalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_JUSTIFY);
assertEquals(XSSFCellStyle.VERTICAL_JUSTIFY, cellStyle.getVerticalAlignment());
cellStyle.setVerticalAlignment(VerticalAlignment.JUSTIFY);
assertEquals(VerticalAlignment.JUSTIFY.getCode(), cellStyle.getVerticalAlignment());
assertEquals(VerticalAlignment.JUSTIFY, cellStyle.getVerticalAlignmentEnum());
assertEquals(STVerticalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
}
@ -734,23 +734,23 @@ public class TestXSSFCellStyle {
assertEquals(2, wb.getNumberOfFonts());
XSSFCellStyle orig = wb.createCellStyle();
orig.setAlignment(CellStyle.ALIGN_RIGHT);
orig.setAlignment(HorizontalAlignment.RIGHT);
orig.setFont(fnt);
orig.setDataFormat((short)18);
assertTrue(CellStyle.ALIGN_RIGHT == orig.getAlignment());
assertTrue(fnt == orig.getFont());
assertTrue(18 == orig.getDataFormat());
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum());
assertEquals(fnt, orig.getFont());
assertEquals(18, orig.getDataFormat());
XSSFCellStyle clone = wb.createCellStyle();
assertFalse(CellStyle.ALIGN_RIGHT == clone.getAlignment());
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
assertFalse(fnt == clone.getFont());
assertFalse(18 == clone.getDataFormat());
clone.cloneStyleFrom(orig);
assertTrue(CellStyle.ALIGN_RIGHT == clone.getAlignment());
assertTrue(fnt == clone.getFont());
assertTrue(18 == clone.getDataFormat());
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
assertEquals(fnt, clone.getFont());
assertEquals(18, clone.getDataFormat());
assertEquals(2, wb.getNumberOfFonts());
XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb);
@ -779,11 +779,11 @@ public class TestXSSFCellStyle {
fmt.getFormat("MadeUpTwo");
XSSFCellStyle orig = wbOrig.createCellStyle();
orig.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
orig.setAlignment(HorizontalAlignment.RIGHT);
orig.setFont(fnt);
orig.setDataFormat(fmt.getFormat("Test##"));
assertTrue(XSSFCellStyle.ALIGN_RIGHT == orig.getAlignment());
assertTrue(HorizontalAlignment.RIGHT == orig.getAlignmentEnum());
assertTrue(fnt == orig.getFont());
assertTrue(fmt.getFormat("Test##") == orig.getDataFormat());
@ -803,7 +803,7 @@ public class TestXSSFCellStyle {
assertEquals(1, wbClone.getNumberOfFonts());
assertEquals(0, wbClone.getStylesSource().getNumberFormats().size());
assertFalse(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment());
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
assertNotEquals("TestingFont", clone.getFont().getFontName());
clone.cloneStyleFrom(orig);
@ -812,7 +812,7 @@ public class TestXSSFCellStyle {
assertEquals(2, wbClone.getNumCellStyles());
assertEquals(1, wbClone.getStylesSource().getNumberFormats().size());
assertEquals(HSSFCellStyle.ALIGN_RIGHT, clone.getAlignment());
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
assertEquals("TestingFont", clone.getFont().getFontName());
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
@ -824,7 +824,7 @@ public class TestXSSFCellStyle {
assertEquals(1, wbReload.getStylesSource().getNumberFormats().size());
XSSFCellStyle reload = wbReload.getCellStyleAt((short)1);
assertEquals(HSSFCellStyle.ALIGN_RIGHT, reload.getAlignment());
assertEquals(HorizontalAlignment.RIGHT, reload.getAlignmentEnum());
assertEquals("TestingFont", reload.getFont().getFontName());
assertEquals(fmtClone.getFormat("Test##"), reload.getDataFormat());
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
@ -944,8 +944,8 @@ public class TestXSSFCellStyle {
cellStyle2.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex());
cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cellStyle2.setAlignment(CellStyle.ALIGN_RIGHT);
cellStyle2.setVerticalAlignment(CellStyle.VERTICAL_TOP);
cellStyle2.setAlignment(HorizontalAlignment.RIGHT);
cellStyle2.setVerticalAlignment(VerticalAlignment.TOP);
cell.setCellStyle(cellStyle2);
@ -955,10 +955,10 @@ public class TestXSSFCellStyle {
CellStyle styleBack = cellBack.getCellStyle();
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillBackgroundColor());
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillForegroundColor());
assertEquals(CellStyle.ALIGN_RIGHT, styleBack.getAlignment());
assertEquals(CellStyle.VERTICAL_TOP, styleBack.getVerticalAlignment());
assertEquals(HorizontalAlignment.RIGHT, styleBack.getAlignmentEnum());
assertEquals(VerticalAlignment.TOP, styleBack.getVerticalAlignmentEnum());
assertEquals(FillPatternType.SOLID_FOREGROUND, styleBack.getFillPatternEnum());
assertEquals(CellStyle.SOLID_FOREGROUND, styleBack.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), styleBack.getFillPattern());
wbBack.close();

View File

@ -28,7 +28,9 @@ import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@ -187,11 +189,11 @@ public final class TestCellStyle extends TestCase {
cs.setBorderRight(BorderStyle.THIN);
cs.setBorderTop(BorderStyle.THIN);
cs.setFillForegroundColor(( short ) 0xA);
cs.setFillPattern(( short ) 1);
cs.setFillPattern(FillPatternType.DIAMONDS);
fnt.setColor(( short ) 0xf);
fnt.setItalic(true);
cs2.setFillForegroundColor(( short ) 0x0);
cs2.setFillPattern(( short ) 1);
cs2.setFillPattern(FillPatternType.DIAMONDS);
cs2.setFont(fnt);
for (int rownum = 0; rownum < 100; rownum++) {
r = s.createRow(rownum);
@ -226,23 +228,23 @@ public final class TestCellStyle extends TestCase {
assertEquals(5, wb.getNumberOfFonts());
HSSFCellStyle orig = wb.createCellStyle();
orig.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
orig.setAlignment(HorizontalAlignment.JUSTIFY);
orig.setFont(fnt);
orig.setDataFormat((short)18);
assertTrue(HSSFCellStyle.ALIGN_RIGHT == orig.getAlignment());
assertTrue(fnt == orig.getFont(wb));
assertTrue(18 == orig.getDataFormat());
assertEquals(HorizontalAlignment.JUSTIFY, orig.getAlignmentEnum());
assertEquals(fnt, orig.getFont(wb));
assertEquals(18, orig.getDataFormat());
HSSFCellStyle clone = wb.createCellStyle();
assertFalse(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment());
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
assertFalse(fnt == clone.getFont(wb));
assertFalse(18 == clone.getDataFormat());
clone.cloneStyleFrom(orig);
assertTrue(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment());
assertTrue(fnt == clone.getFont(wb));
assertTrue(18 == clone.getDataFormat());
assertEquals(HorizontalAlignment.JUSTIFY, clone.getAlignmentEnum());
assertEquals(fnt, clone.getFont(wb));
assertEquals(18, clone.getDataFormat());
assertEquals(5, wb.getNumberOfFonts());
}
@ -262,13 +264,13 @@ public final class TestCellStyle extends TestCase {
fmt.getFormat("MadeUpTwo");
HSSFCellStyle orig = wbOrig.createCellStyle();
orig.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
orig.setAlignment(HorizontalAlignment.RIGHT);
orig.setFont(fnt);
orig.setDataFormat(fmt.getFormat("Test##"));
assertTrue(HSSFCellStyle.ALIGN_RIGHT == orig.getAlignment());
assertTrue(fnt == orig.getFont(wbOrig));
assertTrue(fmt.getFormat("Test##") == orig.getDataFormat());
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum());
assertEquals(fnt, orig.getFont(wbOrig));
assertEquals(fmt.getFormat("Test##"), orig.getDataFormat());
// Now a style on another workbook
HSSFWorkbook wbClone = new HSSFWorkbook();
@ -278,13 +280,13 @@ public final class TestCellStyle extends TestCase {
HSSFCellStyle clone = wbClone.createCellStyle();
assertEquals(4, wbClone.getNumberOfFonts());
assertFalse(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment());
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
assertFalse("TestingFont" == clone.getFont(wbClone).getFontName());
clone.cloneStyleFrom(orig);
assertTrue(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment());
assertTrue("TestingFont" == clone.getFont(wbClone).getFontName());
assertTrue(fmtClone.getFormat("Test##") == clone.getDataFormat());
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
assertEquals("TestingFont", clone.getFont(wbClone).getFontName());
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
assertEquals(5, wbClone.getNumberOfFonts());
}

View File

@ -17,6 +17,7 @@
package org.apache.poi.hssf.usermodel;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import junit.framework.TestCase;
@ -158,119 +159,119 @@ public final class TestHSSFOptimiser extends TestCase {
}
public void testOptimiseStyles() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFWorkbook wb = new HSSFWorkbook();
// Two fonts
assertEquals(4, wb.getNumberOfFonts());
// Two fonts
assertEquals(4, wb.getNumberOfFonts());
HSSFFont f1 = wb.createFont();
f1.setFontHeight((short) 11);
f1.setFontName("Testing");
HSSFFont f1 = wb.createFont();
f1.setFontHeight((short) 11);
f1.setFontName("Testing");
HSSFFont f2 = wb.createFont();
f2.setFontHeight((short) 22);
f2.setFontName("Also Testing");
HSSFFont f2 = wb.createFont();
f2.setFontHeight((short) 22);
f2.setFontName("Also Testing");
assertEquals(6, wb.getNumberOfFonts());
assertEquals(6, wb.getNumberOfFonts());
// Several styles
assertEquals(21, wb.getNumCellStyles());
// Several styles
assertEquals(21, wb.getNumCellStyles());
HSSFCellStyle cs1 = wb.createCellStyle();
cs1.setFont(f1);
HSSFCellStyle cs1 = wb.createCellStyle();
cs1.setFont(f1);
HSSFCellStyle cs2 = wb.createCellStyle();
cs2.setFont(f2);
HSSFCellStyle cs2 = wb.createCellStyle();
cs2.setFont(f2);
HSSFCellStyle cs3 = wb.createCellStyle();
cs3.setFont(f1);
HSSFCellStyle cs3 = wb.createCellStyle();
cs3.setFont(f1);
HSSFCellStyle cs4 = wb.createCellStyle();
cs4.setFont(f1);
cs4.setAlignment((short) 22);
HSSFCellStyle cs4 = wb.createCellStyle();
cs4.setFont(f1);
cs4.setAlignment(HorizontalAlignment.CENTER);
HSSFCellStyle cs5 = wb.createCellStyle();
cs5.setFont(f2);
cs5.setAlignment((short) 111);
HSSFCellStyle cs5 = wb.createCellStyle();
cs5.setFont(f2);
cs5.setAlignment(HorizontalAlignment.FILL);
HSSFCellStyle cs6 = wb.createCellStyle();
cs6.setFont(f2);
HSSFCellStyle cs6 = wb.createCellStyle();
cs6.setFont(f2);
assertEquals(27, wb.getNumCellStyles());
assertEquals(27, wb.getNumCellStyles());
// Use them
HSSFSheet s = wb.createSheet();
HSSFRow r = s.createRow(0);
// Use them
HSSFSheet s = wb.createSheet();
HSSFRow r = s.createRow(0);
r.createCell(0).setCellStyle(cs1);
r.createCell(1).setCellStyle(cs2);
r.createCell(2).setCellStyle(cs3);
r.createCell(3).setCellStyle(cs4);
r.createCell(4).setCellStyle(cs5);
r.createCell(5).setCellStyle(cs6);
r.createCell(6).setCellStyle(cs1);
r.createCell(7).setCellStyle(cs2);
r.createCell(0).setCellStyle(cs1);
r.createCell(1).setCellStyle(cs2);
r.createCell(2).setCellStyle(cs3);
r.createCell(3).setCellStyle(cs4);
r.createCell(4).setCellStyle(cs5);
r.createCell(5).setCellStyle(cs6);
r.createCell(6).setCellStyle(cs1);
r.createCell(7).setCellStyle(cs2);
assertEquals(21, r.getCell(0).getCellValueRecord().getXFIndex());
assertEquals(26, r.getCell(5).getCellValueRecord().getXFIndex());
assertEquals(21, r.getCell(6).getCellValueRecord().getXFIndex());
assertEquals(21, r.getCell(0).getCellValueRecord().getXFIndex());
assertEquals(26, r.getCell(5).getCellValueRecord().getXFIndex());
assertEquals(21, r.getCell(6).getCellValueRecord().getXFIndex());
// Optimise
HSSFOptimiser.optimiseCellStyles(wb);
// Optimise
HSSFOptimiser.optimiseCellStyles(wb);
// Check
assertEquals(6, wb.getNumberOfFonts());
assertEquals(25, wb.getNumCellStyles());
// Check
assertEquals(6, wb.getNumberOfFonts());
assertEquals(25, wb.getNumCellStyles());
// cs1 -> 21
assertEquals(21, r.getCell(0).getCellValueRecord().getXFIndex());
// cs2 -> 22
assertEquals(22, r.getCell(1).getCellValueRecord().getXFIndex());
assertEquals(22, r.getCell(1).getCellStyle().getFont(wb).getFontHeight());
// cs3 = cs1 -> 21
assertEquals(21, r.getCell(2).getCellValueRecord().getXFIndex());
// cs4 --> 24 -> 23
assertEquals(23, r.getCell(3).getCellValueRecord().getXFIndex());
// cs5 --> 25 -> 24
assertEquals(24, r.getCell(4).getCellValueRecord().getXFIndex());
// cs6 = cs2 -> 22
assertEquals(22, r.getCell(5).getCellValueRecord().getXFIndex());
// cs1 -> 21
assertEquals(21, r.getCell(6).getCellValueRecord().getXFIndex());
// cs2 -> 22
assertEquals(22, r.getCell(7).getCellValueRecord().getXFIndex());
// Add a new duplicate, and two that aren't used
HSSFCellStyle csD = wb.createCellStyle();
csD.setFont(f1);
r.createCell(8).setCellStyle(csD);
HSSFFont f3 = wb.createFont();
f3.setFontHeight((short) 23);
f3.setFontName("Testing 3");
HSSFFont f4 = wb.createFont();
f4.setFontHeight((short) 24);
f4.setFontName("Testing 4");
// cs1 -> 21
assertEquals(21, r.getCell(0).getCellValueRecord().getXFIndex());
// cs2 -> 22
assertEquals(22, r.getCell(1).getCellValueRecord().getXFIndex());
assertEquals(22, r.getCell(1).getCellStyle().getFont(wb).getFontHeight());
// cs3 = cs1 -> 21
assertEquals(21, r.getCell(2).getCellValueRecord().getXFIndex());
// cs4 --> 24 -> 23
assertEquals(23, r.getCell(3).getCellValueRecord().getXFIndex());
// cs5 --> 25 -> 24
assertEquals(24, r.getCell(4).getCellValueRecord().getXFIndex());
// cs6 = cs2 -> 22
assertEquals(22, r.getCell(5).getCellValueRecord().getXFIndex());
// cs1 -> 21
assertEquals(21, r.getCell(6).getCellValueRecord().getXFIndex());
// cs2 -> 22
assertEquals(22, r.getCell(7).getCellValueRecord().getXFIndex());
HSSFCellStyle csU1 = wb.createCellStyle();
csU1.setFont(f3);
HSSFCellStyle csU2 = wb.createCellStyle();
csU2.setFont(f4);
// Check before the optimise
assertEquals(8, wb.getNumberOfFonts());
assertEquals(28, wb.getNumCellStyles());
// Optimise, should remove the two un-used ones and the one duplicate
HSSFOptimiser.optimiseCellStyles(wb);
// Check
assertEquals(8, wb.getNumberOfFonts());
assertEquals(25, wb.getNumCellStyles());
// csD -> cs1 -> 21
assertEquals(21, r.getCell(8).getCellValueRecord().getXFIndex());
// Add a new duplicate, and two that aren't used
HSSFCellStyle csD = wb.createCellStyle();
csD.setFont(f1);
r.createCell(8).setCellStyle(csD);
HSSFFont f3 = wb.createFont();
f3.setFontHeight((short) 23);
f3.setFontName("Testing 3");
HSSFFont f4 = wb.createFont();
f4.setFontHeight((short) 24);
f4.setFontName("Testing 4");
HSSFCellStyle csU1 = wb.createCellStyle();
csU1.setFont(f3);
HSSFCellStyle csU2 = wb.createCellStyle();
csU2.setFont(f4);
// Check before the optimise
assertEquals(8, wb.getNumberOfFonts());
assertEquals(28, wb.getNumCellStyles());
// Optimise, should remove the two un-used ones and the one duplicate
HSSFOptimiser.optimiseCellStyles(wb);
// Check
assertEquals(8, wb.getNumberOfFonts());
assertEquals(25, wb.getNumCellStyles());
// csD -> cs1 -> 21
assertEquals(21, r.getCell(8).getCellValueRecord().getXFIndex());
}
public void testOptimiseStylesCheckActualStyles() {

View File

@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.util.IOUtils;
import junit.framework.TestCase;
@ -118,11 +119,11 @@ public final class TestRowStyle extends TestCase {
cs.setBorderRight(BorderStyle.THIN);
cs.setBorderTop(BorderStyle.THIN);
cs.setFillForegroundColor(( short ) 0xA);
cs.setFillPattern(( short ) 1);
cs.setFillPattern(FillPatternType.BRICKS);
fnt.setColor(( short ) 0xf);
fnt.setItalic(true);
cs2.setFillForegroundColor(( short ) 0x0);
cs2.setFillPattern(( short ) 1);
cs2.setFillPattern(FillPatternType.BRICKS);
cs2.setFont(fnt);
for (int rownum = 0; rownum < 100; rownum++)
{
@ -159,7 +160,7 @@ public final class TestRowStyle extends TestCase {
assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor());
assertEquals("FillPattern for row:", 0x1, cs.getFillPattern());
assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPatternEnum());
rownum++;
if (rownum >= 100) break; // I feel too lazy to check if this isreqd :-/
@ -168,7 +169,7 @@ public final class TestRowStyle extends TestCase {
assertNotNull("Row is not null", r);
cs2 = r.getRowStyle();
assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0);
assertEquals("FillPattern for row: ", cs2.getFillPattern(), (short) 0x1);
assertEquals("FillPattern for row: ", cs2.getFillPatternEnum(), FillPatternType.BRICKS);
}
IOUtils.closeQuietly(wb2);
}

View File

@ -1041,14 +1041,13 @@ public abstract class BaseTestBugzillaIssues {
wb.close();
}
@SuppressWarnings("deprecation")
@Test
public void bug56981() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
CellStyle vertTop = wb.createCellStyle();
vertTop.setVerticalAlignment(CellStyle.VERTICAL_TOP);
vertTop.setVerticalAlignment(VerticalAlignment.TOP);
CellStyle vertBottom = wb.createCellStyle();
vertBottom.setVerticalAlignment(CellStyle.VERTICAL_BOTTOM);
vertBottom.setVerticalAlignment(VerticalAlignment.BOTTOM);
Sheet sheet = wb.createSheet("Sheet 1");
Row row = sheet.createRow(0);
Cell top = row.createCell(0);
@ -1298,7 +1297,6 @@ public abstract class BaseTestBugzillaIssues {
wb2.close();
}
@SuppressWarnings("deprecation")
@Test
public void bug58260() throws IOException {
//Create workbook and worksheet
@ -1320,7 +1318,7 @@ public abstract class BaseTestBugzillaIssues {
} catch (IllegalStateException e) {
fail("Failed for row " + i);
}
style.setAlignment(CellStyle.ALIGN_RIGHT);
style.setAlignment(HorizontalAlignment.RIGHT);
if((wb instanceof HSSFWorkbook)) {
// there are some predefined styles
assertEquals(i+21, style.getIndex());

View File

@ -232,17 +232,17 @@ public class BaseTestCellUtil {
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
// HSSFCellStyle wraps an underlying style record, and the underlying
// style record is the same between multiple getCellStyle() calls.
assertEquals(CellStyle.ALIGN_GENERAL, A1.getCellStyle().getAlignment());
assertEquals(CellStyle.ALIGN_GENERAL, B1.getCellStyle().getAlignment());
assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignmentEnum());
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
// get/set alignment modifies the cell's style
CellUtil.setAlignment(A1, null, CellStyle.ALIGN_RIGHT);
assertEquals(CellStyle.ALIGN_RIGHT, A1.getCellStyle().getAlignment());
CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT);
assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignmentEnum());
// get/set alignment doesn't affect the style of cells with
// the same style prior to modifying the style
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
assertEquals(CellStyle.ALIGN_GENERAL, B1.getCellStyle().getAlignment());
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
wb.close();
}
@ -377,15 +377,13 @@ public class BaseTestCellUtil {
Workbook wb1 = _testDataProvider.createWorkbook();
Cell A1 = wb1.createSheet().createRow(0).createCell(0);
Map<String, Object> properties = new HashMap<String, Object>();
// FIXME: Use FillPatternType.BRICKS enum
properties.put(CellUtil.FILL_PATTERN, CellStyle.BRICKS);
properties.put(CellUtil.FILL_PATTERN, FillPatternType.BRICKS);
properties.put(CellUtil.FILL_FOREGROUND_COLOR, IndexedColors.BLUE.index);
properties.put(CellUtil.FILL_BACKGROUND_COLOR, IndexedColors.RED.index);
CellUtil.setCellStyleProperties(A1, properties);
CellStyle style = A1.getCellStyle();
// FIXME: Use FillPatternType.BRICKS enum
assertEquals("fill pattern", CellStyle.BRICKS, style.getFillPattern());
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum());
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
wb1.close();
@ -399,14 +397,12 @@ public class BaseTestCellUtil {
Workbook wb1 = _testDataProvider.createWorkbook();
Cell A1 = wb1.createSheet().createRow(0).createCell(0);
Map<String, Object> properties = new HashMap<String, Object>();
// FIXME: Use FillPatternType.BRICKS enum
properties.put(CellUtil.FILL_PATTERN, FillPatternType.BRICKS);
properties.put(CellUtil.FILL_FOREGROUND_COLOR, IndexedColors.BLUE.index);
properties.put(CellUtil.FILL_BACKGROUND_COLOR, IndexedColors.RED.index);
CellUtil.setCellStyleProperties(A1, properties);
CellStyle style = A1.getCellStyle();
// FIXME: Use FillPatternType.BRICKS enum
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum());
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));