mirror of https://github.com/apache/poi.git
Remove use of deprecated methods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812907 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dffa1ccd9c
commit
2cd8c7bc65
|
@ -156,7 +156,7 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
||||||
Font font = new Font(f.getFontName(),fontstyle,fontheight);
|
Font font = new Font(f.getFontName(),fontstyle,fontheight);
|
||||||
editor.setFont(font);
|
editor.setFont(font);
|
||||||
|
|
||||||
if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) {
|
if (style.getFillPattern() == FillPatternType.SOLID_FOREGROUND) {
|
||||||
editor.setBackground(getAWTColor(style.getFillForegroundColor(), white));
|
editor.setBackground(getAWTColor(style.getFillForegroundColor(), white));
|
||||||
} else {
|
} else {
|
||||||
editor.setBackground(white);
|
editor.setBackground(white);
|
||||||
|
@ -187,7 +187,7 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
||||||
default:
|
default:
|
||||||
editor.setText("?");
|
editor.setText("?");
|
||||||
}
|
}
|
||||||
switch (style.getAlignmentEnum()) {
|
switch (style.getAlignment()) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
case JUSTIFY:
|
case JUSTIFY:
|
||||||
case FILL:
|
case FILL:
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class SVTableCellRenderer extends JLabel
|
||||||
HSSFFont f = wb.getFontAt(s.getFontIndex());
|
HSSFFont f = wb.getFontAt(s.getFontIndex());
|
||||||
setFont(SVTableUtils.makeFont(f));
|
setFont(SVTableUtils.makeFont(f));
|
||||||
|
|
||||||
if (s.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) {
|
if (s.getFillPattern() == FillPatternType.SOLID_FOREGROUND) {
|
||||||
setBackground(SVTableUtils.getAWTColor(s.getFillForegroundColor(), SVTableUtils.white));
|
setBackground(SVTableUtils.getAWTColor(s.getFillForegroundColor(), SVTableUtils.white));
|
||||||
} else setBackground(SVTableUtils.white);
|
} else setBackground(SVTableUtils.white);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class SVTableCellRenderer extends JLabel
|
||||||
setValue("?");
|
setValue("?");
|
||||||
}
|
}
|
||||||
//Set the text alignment of the cell
|
//Set the text alignment of the cell
|
||||||
switch (s.getAlignmentEnum()) {
|
switch (s.getAlignment()) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
case JUSTIFY:
|
case JUSTIFY:
|
||||||
case FILL:
|
case FILL:
|
||||||
|
|
|
@ -330,8 +330,8 @@ public class ExcelComparator {
|
||||||
*/
|
*/
|
||||||
private void isCellAlignmentMatches(Locator loc1, Locator loc2) {
|
private void isCellAlignmentMatches(Locator loc1, Locator loc2) {
|
||||||
// TODO: check for NPE
|
// TODO: check for NPE
|
||||||
HorizontalAlignment align1 = loc1.cell.getCellStyle().getAlignmentEnum();
|
HorizontalAlignment align1 = loc1.cell.getCellStyle().getAlignment();
|
||||||
HorizontalAlignment align2 = loc2.cell.getCellStyle().getAlignmentEnum();
|
HorizontalAlignment align2 = loc2.cell.getCellStyle().getAlignment();
|
||||||
if (align1 != align2) {
|
if (align1 != align2) {
|
||||||
addMessage(loc1, loc2,
|
addMessage(loc1, loc2,
|
||||||
"Cell Alignment does not Match ::",
|
"Cell Alignment does not Match ::",
|
||||||
|
@ -460,8 +460,8 @@ public class ExcelComparator {
|
||||||
*/
|
*/
|
||||||
private void isCellFillPatternMatches(Locator loc1, Locator loc2) {
|
private void isCellFillPatternMatches(Locator loc1, Locator loc2) {
|
||||||
// TOOO: Check for NPE
|
// TOOO: Check for NPE
|
||||||
FillPatternType fill1 = loc1.cell.getCellStyle().getFillPatternEnum();
|
FillPatternType fill1 = loc1.cell.getCellStyle().getFillPattern();
|
||||||
FillPatternType fill2 = loc2.cell.getCellStyle().getFillPatternEnum();
|
FillPatternType fill2 = loc2.cell.getCellStyle().getFillPattern();
|
||||||
if (fill1 != fill2) {
|
if (fill1 != fill2) {
|
||||||
addMessage(loc1, loc2,
|
addMessage(loc1, loc2,
|
||||||
"Cell Fill pattern does not Match ::",
|
"Cell Fill pattern does not Match ::",
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class HSSFHtmlHelper implements HtmlHelper {
|
||||||
@Override
|
@Override
|
||||||
public void colorStyles(CellStyle style, Formatter out) {
|
public void colorStyles(CellStyle style, Formatter out) {
|
||||||
HSSFCellStyle cs = (HSSFCellStyle) style;
|
HSSFCellStyle cs = (HSSFCellStyle) style;
|
||||||
out.format(" /* fill pattern = %d */%n", cs.getFillPatternEnum().getCode());
|
out.format(" /* fill pattern = %d */%n", cs.getFillPattern().getCode());
|
||||||
styleColor(out, "background-color", cs.getFillForegroundColor());
|
styleColor(out, "background-color", cs.getFillForegroundColor());
|
||||||
styleColor(out, "color", cs.getFont(wb).getColor());
|
styleColor(out, "color", cs.getFont(wb).getColor());
|
||||||
styleColor(out, "border-left-color", cs.getLeftBorderColor());
|
styleColor(out, "border-left-color", cs.getLeftBorderColor());
|
||||||
|
|
|
@ -289,8 +289,8 @@ public class ToHtml {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void styleContents(CellStyle style) {
|
private void styleContents(CellStyle style) {
|
||||||
styleOut("text-align", style.getAlignmentEnum(), HALIGN);
|
styleOut("text-align", style.getAlignment(), HALIGN);
|
||||||
styleOut("vertical-align", style.getVerticalAlignmentEnum(), VALIGN);
|
styleOut("vertical-align", style.getVerticalAlignment(), VALIGN);
|
||||||
fontStyle(style);
|
fontStyle(style);
|
||||||
borderStyles(style);
|
borderStyles(style);
|
||||||
helper.colorStyles(style, out);
|
helper.colorStyles(style, out);
|
||||||
|
@ -493,7 +493,7 @@ public class ToHtml {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String tagStyle(Cell cell, CellStyle style) {
|
private String tagStyle(Cell cell, CellStyle style) {
|
||||||
if (style.getAlignmentEnum() == HorizontalAlignment.GENERAL) {
|
if (style.getAlignment() == HorizontalAlignment.GENERAL) {
|
||||||
switch (ultimateCellType(cell)) {
|
switch (ultimateCellType(cell)) {
|
||||||
case STRING:
|
case STRING:
|
||||||
return "style=\"text-align: left;\"";
|
return "style=\"text-align: left;\"";
|
||||||
|
|
|
@ -272,25 +272,16 @@ public final class HSSFCellStyle implements CellStyle {
|
||||||
_format.setAlignment(align.getCode());
|
_format.setAlignment(align.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the type of horizontal alignment for the cell
|
|
||||||
* @return align - the type of alignment
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
@Override
|
||||||
public short getAlignment()
|
public HorizontalAlignment getAlignment()
|
||||||
{
|
{
|
||||||
return _format.getAlignment();
|
return HorizontalAlignment.forInt(_format.getAlignment());
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* get the type of horizontal alignment for the cell
|
|
||||||
* @return align - the type of alignment
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public HorizontalAlignment getAlignmentEnum()
|
public HorizontalAlignment getAlignmentEnum()
|
||||||
{
|
{
|
||||||
return HorizontalAlignment.forInt(_format.getAlignment());
|
return getAlignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,28 +315,16 @@ public final class HSSFCellStyle implements CellStyle {
|
||||||
_format.setVerticalAlignment(align.getCode());
|
_format.setVerticalAlignment(align.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the type of vertical alignment for the cell
|
|
||||||
* @return align the type of alignment
|
|
||||||
* @see VerticalAlignment
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
@Override
|
||||||
public short getVerticalAlignment()
|
public VerticalAlignment getVerticalAlignment() {
|
||||||
{
|
|
||||||
return _format.getVerticalAlignment();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* get the type of vertical alignment for the cell
|
|
||||||
* @return align the type of alignment
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VerticalAlignment getVerticalAlignmentEnum()
|
|
||||||
{
|
|
||||||
return VerticalAlignment.forInt(_format.getVerticalAlignment());
|
return VerticalAlignment.forInt(_format.getVerticalAlignment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerticalAlignment getVerticalAlignmentEnum() {
|
||||||
|
return getVerticalAlignment();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the degree of rotation for the text in the cell
|
* set the degree of rotation for the text in the cell
|
||||||
*
|
*
|
||||||
|
@ -649,28 +628,15 @@ public final class HSSFCellStyle implements CellStyle {
|
||||||
_format.setAdtlFillPattern(fp.getCode());
|
_format.setAdtlFillPattern(fp.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the fill pattern
|
|
||||||
* @return fill pattern
|
|
||||||
* @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
@Override
|
||||||
public short getFillPattern()
|
public FillPatternType getFillPattern()
|
||||||
{
|
|
||||||
return getFillPatternEnum().getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the fill pattern
|
|
||||||
* @return fill pattern
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public FillPatternType getFillPatternEnum()
|
|
||||||
{
|
{
|
||||||
return FillPatternType.forInt(_format.getAdtlFillPattern());
|
return FillPatternType.forInt(_format.getAdtlFillPattern());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FillPatternType getFillPatternEnum() { return getFillPattern(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the background and foreground fills are set correctly when one
|
* Checks if the background and foreground fills are set correctly when one
|
||||||
* or the other is set to the default color.
|
* or the other is set to the default color.
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.apache.poi.ss.usermodel;
|
package org.apache.poi.ss.usermodel;
|
||||||
|
|
||||||
|
import org.apache.poi.util.Removal;
|
||||||
|
|
||||||
public interface CellStyle {
|
public interface CellStyle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,13 +115,15 @@ public interface CellStyle {
|
||||||
/**
|
/**
|
||||||
* get the type of horizontal alignment for the cell
|
* get the type of horizontal alignment for the cell
|
||||||
* @return align - the type of alignment
|
* @return align - the type of alignment
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
|
|
||||||
*/
|
*/
|
||||||
short getAlignment();
|
HorizontalAlignment getAlignment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the type of horizontal alignment for the cell
|
* get the type of horizontal alignment for the cell
|
||||||
* @return align - the type of alignment
|
* @return align - the type of alignment
|
||||||
|
* @deprecated use <code>getAlignment()</code> instead
|
||||||
*/
|
*/
|
||||||
|
@Removal(version = "4.2")
|
||||||
HorizontalAlignment getAlignmentEnum();
|
HorizontalAlignment getAlignmentEnum();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,14 +133,12 @@ public interface CellStyle {
|
||||||
*
|
*
|
||||||
* @param wrapped wrap text or not
|
* @param wrapped wrap text or not
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void setWrapText(boolean wrapped);
|
void setWrapText(boolean wrapped);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get whether the text should be wrapped
|
* get whether the text should be wrapped
|
||||||
* @return wrap text or not
|
* @return wrap text or not
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boolean getWrapText();
|
boolean getWrapText();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,13 +150,15 @@ public interface CellStyle {
|
||||||
/**
|
/**
|
||||||
* get the type of vertical alignment for the cell
|
* get the type of vertical alignment for the cell
|
||||||
* @return align the type of alignment
|
* @return align the type of alignment
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead.
|
|
||||||
*/
|
*/
|
||||||
short getVerticalAlignment();
|
VerticalAlignment getVerticalAlignment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the type of vertical alignment for the cell
|
* get the type of vertical alignment for the cell
|
||||||
* @return align the type of alignment
|
* @return align the type of alignment
|
||||||
|
* @deprecated use <code>getVerticalAlignment()</code> instead
|
||||||
*/
|
*/
|
||||||
|
@Removal(version = "4.2")
|
||||||
VerticalAlignment getVerticalAlignmentEnum();
|
VerticalAlignment getVerticalAlignmentEnum();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,16 +339,21 @@ public interface CellStyle {
|
||||||
void setFillPattern(FillPatternType fp);
|
void setFillPattern(FillPatternType fp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the fill pattern (??) - set to 1 to fill with foreground color
|
* Get the fill pattern
|
||||||
* @return fill pattern
|
*
|
||||||
* @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead.
|
* @return the fill pattern, default value is {@link FillPatternType#NO_FILL}
|
||||||
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
short getFillPattern();
|
FillPatternType getFillPattern();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the fill pattern (??) - set to 1 to fill with foreground color
|
* Get the fill pattern
|
||||||
* @return fill pattern
|
*
|
||||||
|
* @return the fill pattern, default value is {@link FillPatternType#NO_FILL}
|
||||||
* @since POI 3.15 beta 3
|
* @since POI 3.15 beta 3
|
||||||
|
* @deprecated use <code>getFillPattern()</code> instead
|
||||||
*/
|
*/
|
||||||
|
@Removal(version = "4.2")
|
||||||
FillPatternType getFillPatternEnum();
|
FillPatternType getFillPatternEnum();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +361,6 @@ public interface CellStyle {
|
||||||
*
|
*
|
||||||
* @param bg color
|
* @param bg color
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void setFillBackgroundColor(short bg);
|
void setFillBackgroundColor(short bg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -335,15 +335,15 @@ public final class CellUtil {
|
||||||
*/
|
*/
|
||||||
private static Map<String, Object> getFormatProperties(CellStyle style) {
|
private static Map<String, Object> getFormatProperties(CellStyle style) {
|
||||||
Map<String, Object> properties = new HashMap<>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
put(properties, ALIGNMENT, style.getAlignmentEnum());
|
put(properties, ALIGNMENT, style.getAlignment());
|
||||||
put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignmentEnum());
|
put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignment());
|
||||||
put(properties, BORDER_BOTTOM, style.getBorderBottomEnum());
|
put(properties, BORDER_BOTTOM, style.getBorderBottomEnum());
|
||||||
put(properties, BORDER_LEFT, style.getBorderLeftEnum());
|
put(properties, BORDER_LEFT, style.getBorderLeftEnum());
|
||||||
put(properties, BORDER_RIGHT, style.getBorderRightEnum());
|
put(properties, BORDER_RIGHT, style.getBorderRightEnum());
|
||||||
put(properties, BORDER_TOP, style.getBorderTopEnum());
|
put(properties, BORDER_TOP, style.getBorderTopEnum());
|
||||||
put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor());
|
put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor());
|
||||||
put(properties, DATA_FORMAT, style.getDataFormat());
|
put(properties, DATA_FORMAT, style.getDataFormat());
|
||||||
put(properties, FILL_PATTERN, style.getFillPatternEnum());
|
put(properties, FILL_PATTERN, style.getFillPattern());
|
||||||
put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor());
|
put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor());
|
||||||
put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor());
|
put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor());
|
||||||
put(properties, FONT, style.getFontIndex());
|
put(properties, FONT, style.getFontIndex());
|
||||||
|
|
|
@ -217,24 +217,8 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
_cellXf.setApplyBorder(true);
|
_cellXf.setApplyBorder(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type of horizontal alignment for the cell
|
|
||||||
*
|
|
||||||
* @return short - the type of alignment
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public short getAlignment() {
|
public HorizontalAlignment getAlignment() {
|
||||||
return getAlignmentEnum().getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type of horizontal alignment for the cell
|
|
||||||
*
|
|
||||||
* @return HorizontalAlignment - the type of alignment
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public HorizontalAlignment getAlignmentEnum() {
|
|
||||||
CTCellAlignment align = _cellXf.getAlignment();
|
CTCellAlignment align = _cellXf.getAlignment();
|
||||||
if(align != null && align.isSetHorizontal()) {
|
if(align != null && align.isSetHorizontal()) {
|
||||||
return HorizontalAlignment.forInt(align.getHorizontal().intValue()-1);
|
return HorizontalAlignment.forInt(align.getHorizontal().intValue()-1);
|
||||||
|
@ -242,6 +226,10 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
return HorizontalAlignment.GENERAL;
|
return HorizontalAlignment.GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HorizontalAlignment getAlignmentEnum() {
|
||||||
|
return getAlignment();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get the type of border to use for the bottom border of the cell
|
* Get the type of border to use for the bottom border of the cell
|
||||||
* Will be removed when {@link #getBorderBottom()} returns a BorderStyle enum
|
* Will be removed when {@link #getBorderBottom()} returns a BorderStyle enum
|
||||||
|
@ -494,23 +482,8 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
return fillForegroundColor;
|
return fillForegroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the fill pattern
|
|
||||||
* @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
|
@Override
|
||||||
public short getFillPattern() {
|
public FillPatternType getFillPattern() {
|
||||||
return getFillPatternEnum().getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the fill pattern
|
|
||||||
*
|
|
||||||
* @return the fill pattern, default value is {@link FillPatternType#NO_FILL}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public FillPatternType getFillPatternEnum() {
|
|
||||||
// bug 56295: handle missing applyFill attribute as "true" because Excel does as well
|
// bug 56295: handle missing applyFill attribute as "true" because Excel does as well
|
||||||
if(_cellXf.isSetApplyFill() && !_cellXf.getApplyFill()) return FillPatternType.NO_FILL;
|
if(_cellXf.isSetApplyFill() && !_cellXf.getApplyFill()) return FillPatternType.NO_FILL;
|
||||||
|
|
||||||
|
@ -522,6 +495,11 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
return FillPatternType.forInt(ptrn.intValue() - 1);
|
return FillPatternType.forInt(ptrn.intValue() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FillPatternType getFillPatternEnum() {
|
||||||
|
return getFillPattern();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the font for this style
|
* Gets the font for this style
|
||||||
* @return Font - font
|
* @return Font - font
|
||||||
|
@ -708,24 +686,8 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
return border.getBorderColor(BorderSide.TOP);
|
return border.getBorderColor(BorderSide.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type of vertical alignment for the cell
|
|
||||||
*
|
|
||||||
* @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
|
@Override
|
||||||
public short getVerticalAlignment() {
|
public VerticalAlignment getVerticalAlignment() {
|
||||||
return getVerticalAlignmentEnum().getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type of vertical alignment for the cell
|
|
||||||
*
|
|
||||||
* @return the type of alignment, default value is {@link VerticalAlignment#BOTTOM}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VerticalAlignment getVerticalAlignmentEnum() {
|
|
||||||
CTCellAlignment align = _cellXf.getAlignment();
|
CTCellAlignment align = _cellXf.getAlignment();
|
||||||
if(align != null && align.isSetVertical()) {
|
if(align != null && align.isSetVertical()) {
|
||||||
return VerticalAlignment.forInt(align.getVertical().intValue()-1);
|
return VerticalAlignment.forInt(align.getVertical().intValue()-1);
|
||||||
|
@ -733,6 +695,11 @@ public class XSSFCellStyle implements CellStyle {
|
||||||
return VerticalAlignment.BOTTOM;
|
return VerticalAlignment.BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerticalAlignment getVerticalAlignmentEnum() {
|
||||||
|
return getVerticalAlignment();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the text should be wrapped
|
* Whether the text should be wrapped
|
||||||
*
|
*
|
||||||
|
|
|
@ -555,7 +555,7 @@ public class TestXSSFCellStyle {
|
||||||
HSSFCellStyle style2 = wb2.createCellStyle();
|
HSSFCellStyle style2 = wb2.createCellStyle();
|
||||||
assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor());
|
assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor());
|
||||||
assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor());
|
assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor());
|
||||||
assertEquals(style2.getFillPatternEnum(), style1.getFillPatternEnum());
|
assertEquals(style2.getFillPattern(), style1.getFillPattern());
|
||||||
assertEquals(style2.getFillPattern(), style1.getFillPattern());
|
assertEquals(style2.getFillPattern(), style1.getFillPattern());
|
||||||
|
|
||||||
assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor());
|
assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor());
|
||||||
|
@ -570,7 +570,6 @@ public class TestXSSFCellStyle {
|
||||||
wb2.close();
|
wb2.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFillForegroundColor() throws IOException {
|
public void testGetFillForegroundColor() throws IOException {
|
||||||
XSSFWorkbook wb = new XSSFWorkbook();
|
XSSFWorkbook wb = new XSSFWorkbook();
|
||||||
|
@ -581,14 +580,12 @@ public class TestXSSFCellStyle {
|
||||||
XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0);
|
XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0);
|
||||||
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
|
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
|
||||||
assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
|
assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
|
||||||
assertEquals(FillPatternType.NO_FILL.getCode(), defaultStyle.getFillPattern());
|
|
||||||
|
|
||||||
XSSFCellStyle customStyle = wb.createCellStyle();
|
XSSFCellStyle customStyle = wb.createCellStyle();
|
||||||
|
|
||||||
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPatternEnum());
|
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPattern());
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), customStyle.getFillPattern());
|
|
||||||
assertEquals(3, styles.getFills().size());
|
assertEquals(3, styles.getFills().size());
|
||||||
|
|
||||||
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
|
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
|
||||||
|
@ -599,8 +596,7 @@ public class TestXSSFCellStyle {
|
||||||
XSSFCellStyle style = wb.createCellStyle();
|
XSSFCellStyle style = wb.createCellStyle();
|
||||||
|
|
||||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND, style.getFillPatternEnum());
|
assertEquals(FillPatternType.SOLID_FOREGROUND, style.getFillPattern());
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), style.getFillPattern());
|
|
||||||
assertEquals(4, styles.getFills().size());
|
assertEquals(4, styles.getFills().size());
|
||||||
|
|
||||||
style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
|
style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
|
||||||
|
@ -612,17 +608,14 @@ public class TestXSSFCellStyle {
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFillPattern() {
|
public void testGetFillPattern() {
|
||||||
|
|
||||||
assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPatternEnum().getCode());
|
assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPattern().getCode());
|
||||||
assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPattern());
|
|
||||||
|
|
||||||
int num = stylesTable.getFills().size();
|
int num = stylesTable.getFills().size();
|
||||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND, cellStyle.getFillPatternEnum());
|
assertEquals(FillPatternType.SOLID_FOREGROUND, cellStyle.getFillPattern());
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), cellStyle.getFillPattern());
|
|
||||||
assertEquals(num + 1, stylesTable.getFills().size());
|
assertEquals(num + 1, stylesTable.getFills().size());
|
||||||
int fillId = (int)cellStyle.getCoreXf().getFillId();
|
int fillId = (int)cellStyle.getCoreXf().getFillId();
|
||||||
assertTrue(fillId > 0);
|
assertTrue(fillId > 0);
|
||||||
|
@ -637,8 +630,7 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals(num + 1, stylesTable.getFills().size());
|
assertEquals(num + 1, stylesTable.getFills().size());
|
||||||
|
|
||||||
cellStyle.setFillPattern(FillPatternType.NO_FILL);
|
cellStyle.setFillPattern(FillPatternType.NO_FILL);
|
||||||
assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPattern());
|
||||||
assertEquals(FillPatternType.NO_FILL.getCode(), cellStyle.getFillPattern());
|
|
||||||
fillId = (int)cellStyle.getCoreXf().getFillId();
|
fillId = (int)cellStyle.getCoreXf().getFillId();
|
||||||
ctFill2 = stylesTable.getFillAt(fillId).getCTFill();
|
ctFill2 = stylesTable.getFillAt(fillId).getCTFill();
|
||||||
assertFalse(ctFill2.getPatternFill().isSetPatternType());
|
assertFalse(ctFill2.getPatternFill().isSetPatternType());
|
||||||
|
@ -677,25 +669,21 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals((short)13, cellStyle.getIndention());
|
assertEquals((short)13, cellStyle.getIndention());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSetAlignment() {
|
public void testGetSetAlignment() {
|
||||||
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, cellStyle.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, cellStyle.getAlignment());
|
||||||
|
|
||||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||||
assertEquals(HorizontalAlignment.LEFT.getCode(), cellStyle.getAlignment());
|
assertEquals(HorizontalAlignment.LEFT, cellStyle.getAlignment());
|
||||||
assertEquals(HorizontalAlignment.LEFT, cellStyle.getAlignmentEnum());
|
|
||||||
assertEquals(STHorizontalAlignment.LEFT, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
assertEquals(STHorizontalAlignment.LEFT, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
||||||
|
|
||||||
cellStyle.setAlignment(HorizontalAlignment.JUSTIFY);
|
cellStyle.setAlignment(HorizontalAlignment.JUSTIFY);
|
||||||
assertEquals(HorizontalAlignment.JUSTIFY.getCode(), cellStyle.getAlignment());
|
assertEquals(HorizontalAlignment.JUSTIFY, cellStyle.getAlignment());
|
||||||
assertEquals(HorizontalAlignment.JUSTIFY, cellStyle.getAlignmentEnum());
|
|
||||||
assertEquals(STHorizontalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
assertEquals(STHorizontalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
||||||
|
|
||||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
assertEquals(HorizontalAlignment.CENTER.getCode(), cellStyle.getAlignment());
|
assertEquals(HorizontalAlignment.CENTER, cellStyle.getAlignment());
|
||||||
assertEquals(HorizontalAlignment.CENTER, cellStyle.getAlignmentEnum());
|
|
||||||
assertEquals(STHorizontalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
assertEquals(STHorizontalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,21 +705,17 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals(ReadingOrder.CONTEXT.getCode(), cellStyle.getCellAlignment().getCTCellAlignment().getReadingOrder());
|
assertEquals(ReadingOrder.CONTEXT.getCode(), cellStyle.getCellAlignment().getCTCellAlignment().getReadingOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSetVerticalAlignment() {
|
public void testGetSetVerticalAlignment() {
|
||||||
assertEquals(VerticalAlignment.BOTTOM, cellStyle.getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.BOTTOM, cellStyle.getVerticalAlignment());
|
||||||
assertEquals(VerticalAlignment.BOTTOM.getCode(), cellStyle.getVerticalAlignment());
|
|
||||||
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
||||||
|
|
||||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
assertEquals(VerticalAlignment.CENTER.getCode(), cellStyle.getVerticalAlignment());
|
assertEquals(VerticalAlignment.CENTER, cellStyle.getVerticalAlignment());
|
||||||
assertEquals(VerticalAlignment.CENTER, cellStyle.getVerticalAlignmentEnum());
|
|
||||||
assertEquals(STVerticalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
assertEquals(STVerticalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
||||||
|
|
||||||
cellStyle.setVerticalAlignment(VerticalAlignment.JUSTIFY);
|
cellStyle.setVerticalAlignment(VerticalAlignment.JUSTIFY);
|
||||||
assertEquals(VerticalAlignment.JUSTIFY.getCode(), cellStyle.getVerticalAlignment());
|
assertEquals(VerticalAlignment.JUSTIFY, cellStyle.getVerticalAlignment());
|
||||||
assertEquals(VerticalAlignment.JUSTIFY, cellStyle.getVerticalAlignmentEnum());
|
|
||||||
assertEquals(STVerticalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
assertEquals(STVerticalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getVertical());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,17 +745,17 @@ public class TestXSSFCellStyle {
|
||||||
orig.setFont(fnt);
|
orig.setFont(fnt);
|
||||||
orig.setDataFormat((short)18);
|
orig.setDataFormat((short)18);
|
||||||
|
|
||||||
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignment());
|
||||||
assertEquals(fnt, orig.getFont());
|
assertEquals(fnt, orig.getFont());
|
||||||
assertEquals(18, orig.getDataFormat());
|
assertEquals(18, orig.getDataFormat());
|
||||||
|
|
||||||
XSSFCellStyle clone = wb.createCellStyle();
|
XSSFCellStyle clone = wb.createCellStyle();
|
||||||
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
|
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
|
||||||
assertFalse(fnt == clone.getFont());
|
assertFalse(fnt == clone.getFont());
|
||||||
assertFalse(18 == clone.getDataFormat());
|
assertFalse(18 == clone.getDataFormat());
|
||||||
|
|
||||||
clone.cloneStyleFrom(orig);
|
clone.cloneStyleFrom(orig);
|
||||||
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment());
|
||||||
assertEquals(fnt, clone.getFont());
|
assertEquals(fnt, clone.getFont());
|
||||||
assertEquals(18, clone.getDataFormat());
|
assertEquals(18, clone.getDataFormat());
|
||||||
assertEquals(2, wb.getNumberOfFonts());
|
assertEquals(2, wb.getNumberOfFonts());
|
||||||
|
@ -806,7 +790,7 @@ public class TestXSSFCellStyle {
|
||||||
orig.setFont(fnt);
|
orig.setFont(fnt);
|
||||||
orig.setDataFormat(fmt.getFormat("Test##"));
|
orig.setDataFormat(fmt.getFormat("Test##"));
|
||||||
|
|
||||||
assertTrue(HorizontalAlignment.RIGHT == orig.getAlignmentEnum());
|
assertTrue(HorizontalAlignment.RIGHT == orig.getAlignment());
|
||||||
assertTrue(fnt == orig.getFont());
|
assertTrue(fnt == orig.getFont());
|
||||||
assertTrue(fmt.getFormat("Test##") == orig.getDataFormat());
|
assertTrue(fmt.getFormat("Test##") == orig.getDataFormat());
|
||||||
|
|
||||||
|
@ -826,7 +810,7 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals(1, wbClone.getNumberOfFonts());
|
assertEquals(1, wbClone.getNumberOfFonts());
|
||||||
assertEquals(0, wbClone.getStylesSource().getNumberFormats().size());
|
assertEquals(0, wbClone.getStylesSource().getNumberFormats().size());
|
||||||
|
|
||||||
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
|
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
|
||||||
assertNotEquals("TestingFont", clone.getFont().getFontName());
|
assertNotEquals("TestingFont", clone.getFont().getFontName());
|
||||||
|
|
||||||
clone.cloneStyleFrom(orig);
|
clone.cloneStyleFrom(orig);
|
||||||
|
@ -835,7 +819,7 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals(2, wbClone.getNumCellStyles());
|
assertEquals(2, wbClone.getNumCellStyles());
|
||||||
assertEquals(1, wbClone.getStylesSource().getNumberFormats().size());
|
assertEquals(1, wbClone.getStylesSource().getNumberFormats().size());
|
||||||
|
|
||||||
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment());
|
||||||
assertEquals("TestingFont", clone.getFont().getFontName());
|
assertEquals("TestingFont", clone.getFont().getFontName());
|
||||||
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
|
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
|
||||||
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
||||||
|
@ -847,7 +831,7 @@ public class TestXSSFCellStyle {
|
||||||
assertEquals(1, wbReload.getStylesSource().getNumberFormats().size());
|
assertEquals(1, wbReload.getStylesSource().getNumberFormats().size());
|
||||||
|
|
||||||
XSSFCellStyle reload = wbReload.getCellStyleAt((short)1);
|
XSSFCellStyle reload = wbReload.getCellStyleAt((short)1);
|
||||||
assertEquals(HorizontalAlignment.RIGHT, reload.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, reload.getAlignment());
|
||||||
assertEquals("TestingFont", reload.getFont().getFontName());
|
assertEquals("TestingFont", reload.getFont().getFontName());
|
||||||
assertEquals(fmtClone.getFormat("Test##"), reload.getDataFormat());
|
assertEquals(fmtClone.getFormat("Test##"), reload.getDataFormat());
|
||||||
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
||||||
|
@ -951,7 +935,7 @@ public class TestXSSFCellStyle {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetColor() throws IOException {
|
public void testSetColor() throws IOException {
|
||||||
Workbook wb = new XSSFWorkbook();
|
try(Workbook wb = new XSSFWorkbook()) {
|
||||||
Sheet sheet = wb.createSheet();
|
Sheet sheet = wb.createSheet();
|
||||||
Row row = sheet.createRow(0);
|
Row row = sheet.createRow(0);
|
||||||
|
|
||||||
|
@ -972,21 +956,17 @@ public class TestXSSFCellStyle {
|
||||||
|
|
||||||
cell.setCellStyle(cellStyle2);
|
cell.setCellStyle(cellStyle2);
|
||||||
|
|
||||||
Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
|
try (Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb)) {
|
||||||
Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(1);
|
Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(1);
|
||||||
assertNotNull(cellBack);
|
assertNotNull(cellBack);
|
||||||
CellStyle styleBack = cellBack.getCellStyle();
|
CellStyle styleBack = cellBack.getCellStyle();
|
||||||
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillBackgroundColor());
|
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillBackgroundColor());
|
||||||
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillForegroundColor());
|
assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillForegroundColor());
|
||||||
assertEquals(HorizontalAlignment.RIGHT, styleBack.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, styleBack.getAlignment());
|
||||||
assertEquals(VerticalAlignment.TOP, styleBack.getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.TOP, styleBack.getVerticalAlignment());
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND, styleBack.getFillPatternEnum());
|
assertEquals(FillPatternType.SOLID_FOREGROUND, styleBack.getFillPattern());
|
||||||
//noinspection deprecation
|
}
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), styleBack.getFillPattern());
|
}
|
||||||
|
|
||||||
wbBack.close();
|
|
||||||
|
|
||||||
wb.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyStyles(Workbook reference, Workbook target) {
|
public static void copyStyles(Workbook reference, Workbook target) {
|
||||||
|
@ -1070,7 +1050,7 @@ public class TestXSSFCellStyle {
|
||||||
assertNull(cellStyle.getFillBackgroundColorColor());
|
assertNull(cellStyle.getFillBackgroundColorColor());
|
||||||
|
|
||||||
cellStyle.setFillPattern(FillPatternType.NO_FILL);
|
cellStyle.setFillPattern(FillPatternType.NO_FILL);
|
||||||
assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPattern());
|
||||||
|
|
||||||
cellStyle.setBottomBorderColor(null);
|
cellStyle.setBottomBorderColor(null);
|
||||||
assertNull(cellStyle.getBottomBorderXSSFColor());
|
assertNull(cellStyle.getBottomBorderXSSFColor());
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter
|
||||||
*/
|
*/
|
||||||
protected boolean isEmptyStyle( CellStyle cellStyle ) {
|
protected boolean isEmptyStyle( CellStyle cellStyle ) {
|
||||||
return cellStyle == null || (
|
return cellStyle == null || (
|
||||||
cellStyle.getFillPattern() == 0
|
cellStyle.getFillPattern() == FillPatternType.NO_FILL
|
||||||
&& cellStyle.getBorderTopEnum() == BorderStyle.NONE
|
&& cellStyle.getBorderTopEnum() == BorderStyle.NONE
|
||||||
&& cellStyle.getBorderRightEnum() == BorderStyle.NONE
|
&& cellStyle.getBorderRightEnum() == BorderStyle.NONE
|
||||||
&& cellStyle.getBorderBottomEnum() == BorderStyle.NONE
|
&& cellStyle.getBorderBottomEnum() == BorderStyle.NONE
|
||||||
|
@ -336,16 +336,16 @@ public class ExcelToFoConverter extends AbstractExcelConverter
|
||||||
{
|
{
|
||||||
blockTarget.setAttribute( "white-space-collapse", "false" );
|
blockTarget.setAttribute( "white-space-collapse", "false" );
|
||||||
{
|
{
|
||||||
String textAlign = ExcelToFoUtils.getAlign( cellStyle.getAlignmentEnum() );
|
String textAlign = ExcelToFoUtils.getAlign( cellStyle.getAlignment() );
|
||||||
if ( ExcelToFoUtils.isNotEmpty( textAlign ) )
|
if ( ExcelToFoUtils.isNotEmpty( textAlign ) )
|
||||||
blockTarget.setAttribute( "text-align", textAlign );
|
blockTarget.setAttribute( "text-align", textAlign );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cellStyle.getFillPatternEnum() == FillPatternType.NO_FILL )
|
if ( cellStyle.getFillPattern() == FillPatternType.NO_FILL )
|
||||||
{
|
{
|
||||||
// no fill
|
// no fill
|
||||||
}
|
}
|
||||||
else if ( cellStyle.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND )
|
else if ( cellStyle.getFillPattern() == FillPatternType.SOLID_FOREGROUND )
|
||||||
{
|
{
|
||||||
final HSSFColor foregroundColor = cellStyle
|
final HSSFColor foregroundColor = cellStyle
|
||||||
.getFillForegroundColorColor();
|
.getFillForegroundColorColor();
|
||||||
|
|
|
@ -190,9 +190,9 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
|
||||||
StringBuilder style = new StringBuilder();
|
StringBuilder style = new StringBuilder();
|
||||||
|
|
||||||
style.append( "white-space:pre-wrap;" );
|
style.append( "white-space:pre-wrap;" );
|
||||||
ExcelToHtmlUtils.appendAlign( style, cellStyle.getAlignmentEnum() );
|
ExcelToHtmlUtils.appendAlign( style, cellStyle.getAlignment() );
|
||||||
|
|
||||||
switch (cellStyle.getFillPatternEnum()) {
|
switch (cellStyle.getFillPattern()) {
|
||||||
// no fill
|
// no fill
|
||||||
case NO_FILL: break;
|
case NO_FILL: break;
|
||||||
case SOLID_FOREGROUND:
|
case SOLID_FOREGROUND:
|
||||||
|
@ -444,7 +444,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
|
||||||
innerDivStyle.append( "overflow:hidden;max-height:" );
|
innerDivStyle.append( "overflow:hidden;max-height:" );
|
||||||
innerDivStyle.append( normalHeightPt );
|
innerDivStyle.append( normalHeightPt );
|
||||||
innerDivStyle.append( "pt;white-space:nowrap;" );
|
innerDivStyle.append( "pt;white-space:nowrap;" );
|
||||||
ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignmentEnum() );
|
ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignment() );
|
||||||
htmlDocumentFacade.addStyleClass( outerDiv, cssClassPrefixDiv,
|
htmlDocumentFacade.addStyleClass( outerDiv, cssClassPrefixDiv,
|
||||||
innerDivStyle.toString() );
|
innerDivStyle.toString() );
|
||||||
|
|
||||||
|
|
|
@ -232,17 +232,17 @@ public final class TestCellStyle extends TestCase {
|
||||||
orig.setFont(fnt);
|
orig.setFont(fnt);
|
||||||
orig.setDataFormat((short)18);
|
orig.setDataFormat((short)18);
|
||||||
|
|
||||||
assertEquals(HorizontalAlignment.JUSTIFY, orig.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.JUSTIFY, orig.getAlignment());
|
||||||
assertEquals(fnt, orig.getFont(wb));
|
assertEquals(fnt, orig.getFont(wb));
|
||||||
assertEquals(18, orig.getDataFormat());
|
assertEquals(18, orig.getDataFormat());
|
||||||
|
|
||||||
HSSFCellStyle clone = wb.createCellStyle();
|
HSSFCellStyle clone = wb.createCellStyle();
|
||||||
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
|
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
|
||||||
assertFalse(fnt == clone.getFont(wb));
|
assertFalse(fnt == clone.getFont(wb));
|
||||||
assertFalse(18 == clone.getDataFormat());
|
assertFalse(18 == clone.getDataFormat());
|
||||||
|
|
||||||
clone.cloneStyleFrom(orig);
|
clone.cloneStyleFrom(orig);
|
||||||
assertEquals(HorizontalAlignment.JUSTIFY, clone.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.JUSTIFY, clone.getAlignment());
|
||||||
assertEquals(fnt, clone.getFont(wb));
|
assertEquals(fnt, clone.getFont(wb));
|
||||||
assertEquals(18, clone.getDataFormat());
|
assertEquals(18, clone.getDataFormat());
|
||||||
assertEquals(5, wb.getNumberOfFonts());
|
assertEquals(5, wb.getNumberOfFonts());
|
||||||
|
@ -268,7 +268,7 @@ public final class TestCellStyle extends TestCase {
|
||||||
orig.setFont(fnt);
|
orig.setFont(fnt);
|
||||||
orig.setDataFormat(fmt.getFormat("Test##"));
|
orig.setDataFormat(fmt.getFormat("Test##"));
|
||||||
|
|
||||||
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, orig.getAlignment());
|
||||||
assertEquals(fnt, orig.getFont(wbOrig));
|
assertEquals(fnt, orig.getFont(wbOrig));
|
||||||
assertEquals(fmt.getFormat("Test##"), orig.getDataFormat());
|
assertEquals(fmt.getFormat("Test##"), orig.getDataFormat());
|
||||||
|
|
||||||
|
@ -280,11 +280,11 @@ public final class TestCellStyle extends TestCase {
|
||||||
HSSFCellStyle clone = wbClone.createCellStyle();
|
HSSFCellStyle clone = wbClone.createCellStyle();
|
||||||
assertEquals(4, wbClone.getNumberOfFonts());
|
assertEquals(4, wbClone.getNumberOfFonts());
|
||||||
|
|
||||||
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum());
|
assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
|
||||||
assertFalse("TestingFont" == clone.getFont(wbClone).getFontName());
|
assertFalse("TestingFont" == clone.getFont(wbClone).getFontName());
|
||||||
|
|
||||||
clone.cloneStyleFrom(orig);
|
clone.cloneStyleFrom(orig);
|
||||||
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment());
|
||||||
assertEquals("TestingFont", clone.getFont(wbClone).getFontName());
|
assertEquals("TestingFont", clone.getFont(wbClone).getFontName());
|
||||||
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
|
assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat());
|
||||||
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##"));
|
||||||
|
|
|
@ -103,7 +103,7 @@ public final class TestHSSFPalette {
|
||||||
assertEquals(64, cellA.getCellStyle().getFillForegroundColor());
|
assertEquals(64, cellA.getCellStyle().getFillForegroundColor());
|
||||||
assertEquals(64, cellA.getCellStyle().getFillBackgroundColor());
|
assertEquals(64, cellA.getCellStyle().getFillBackgroundColor());
|
||||||
assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor());
|
assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern());
|
||||||
assertEquals("0:0:0", p.getColor((short)64).getHexString());
|
assertEquals("0:0:0", p.getColor((short)64).getHexString());
|
||||||
assertEquals(null, p.getColor((short)32767));
|
assertEquals(null, p.getColor((short)32767));
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public final class TestHSSFPalette {
|
||||||
assertEquals(64, cellB.getCellStyle().getFillForegroundColor());
|
assertEquals(64, cellB.getCellStyle().getFillForegroundColor());
|
||||||
assertEquals(64, cellB.getCellStyle().getFillBackgroundColor());
|
assertEquals(64, cellB.getCellStyle().getFillBackgroundColor());
|
||||||
assertEquals(10, cellB.getCellStyle().getFont(book).getColor());
|
assertEquals(10, cellB.getCellStyle().getFont(book).getColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPattern());
|
||||||
assertEquals("0:0:0", p.getColor((short)64).getHexString());
|
assertEquals("0:0:0", p.getColor((short)64).getHexString());
|
||||||
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
|
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public final class TestHSSFPalette {
|
||||||
assertEquals(11, cellC.getCellStyle().getFillForegroundColor());
|
assertEquals(11, cellC.getCellStyle().getFillForegroundColor());
|
||||||
assertEquals(64, cellC.getCellStyle().getFillBackgroundColor());
|
assertEquals(64, cellC.getCellStyle().getFillBackgroundColor());
|
||||||
assertEquals(10, cellC.getCellStyle().getFont(book).getColor());
|
assertEquals(10, cellC.getCellStyle().getFont(book).getColor());
|
||||||
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPatternEnum());
|
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPattern());
|
||||||
assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
|
assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
|
||||||
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
|
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public final class TestHSSFPalette {
|
||||||
assertEquals(13, cellD.getCellStyle().getFillForegroundColor());
|
assertEquals(13, cellD.getCellStyle().getFillForegroundColor());
|
||||||
assertEquals(64, cellD.getCellStyle().getFillBackgroundColor());
|
assertEquals(64, cellD.getCellStyle().getFillBackgroundColor());
|
||||||
assertEquals(14, cellD.getCellStyle().getFont(book).getColor());
|
assertEquals(14, cellD.getCellStyle().getFont(book).getColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPattern());
|
||||||
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
|
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
|
||||||
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
|
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public final class TestHSSFPalette {
|
||||||
assertEquals(13, cellE.getCellStyle().getFillForegroundColor());
|
assertEquals(13, cellE.getCellStyle().getFillForegroundColor());
|
||||||
assertEquals(64, cellE.getCellStyle().getFillBackgroundColor());
|
assertEquals(64, cellE.getCellStyle().getFillBackgroundColor());
|
||||||
assertEquals(14, cellE.getCellStyle().getFont(book).getColor());
|
assertEquals(14, cellE.getCellStyle().getFont(book).getColor());
|
||||||
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPatternEnum());
|
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPattern());
|
||||||
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
|
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
|
||||||
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
|
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ public final class TestRowStyle extends TestCase {
|
||||||
assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum());
|
assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum());
|
||||||
assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum());
|
assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum());
|
||||||
assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor());
|
assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor());
|
||||||
assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPatternEnum());
|
assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPattern());
|
||||||
|
|
||||||
rownum++;
|
rownum++;
|
||||||
if (rownum >= 100) break; // I feel too lazy to check if this isreqd :-/
|
if (rownum >= 100) break; // I feel too lazy to check if this isreqd :-/
|
||||||
|
@ -169,7 +169,7 @@ public final class TestRowStyle extends TestCase {
|
||||||
assertNotNull("Row is not null", r);
|
assertNotNull("Row is not null", r);
|
||||||
cs2 = r.getRowStyle();
|
cs2 = r.getRowStyle();
|
||||||
assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0);
|
assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0);
|
||||||
assertEquals("FillPattern for row: ", cs2.getFillPatternEnum(), FillPatternType.BRICKS);
|
assertEquals("FillPattern for row: ", cs2.getFillPattern(), FillPatternType.BRICKS);
|
||||||
}
|
}
|
||||||
IOUtils.closeQuietly(wb2);
|
IOUtils.closeQuietly(wb2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,7 +715,7 @@ public abstract class BaseTestCell {
|
||||||
assertFalse(style.getHidden());
|
assertFalse(style.getHidden());
|
||||||
assertEquals(0, style.getIndention());
|
assertEquals(0, style.getIndention());
|
||||||
assertEquals(0, style.getFontIndex());
|
assertEquals(0, style.getFontIndex());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, style.getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, style.getAlignment());
|
||||||
assertEquals(0, style.getDataFormat());
|
assertEquals(0, style.getDataFormat());
|
||||||
assertEquals(false, style.getWrapText());
|
assertEquals(false, style.getWrapText());
|
||||||
|
|
||||||
|
|
|
@ -224,17 +224,17 @@ public class BaseTestCellUtil {
|
||||||
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
||||||
// HSSFCellStyle wraps an underlying style record, and the underlying
|
// HSSFCellStyle wraps an underlying style record, and the underlying
|
||||||
// style record is the same between multiple getCellStyle() calls.
|
// style record is the same between multiple getCellStyle() calls.
|
||||||
assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignment());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
// get/set alignment modifies the cell's style
|
// get/set alignment modifies the cell's style
|
||||||
CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT);
|
CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT);
|
||||||
assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
// get/set alignment doesn't affect the style of cells with
|
// get/set alignment doesn't affect the style of cells with
|
||||||
// the same style prior to modifying the style
|
// the same style prior to modifying the style
|
||||||
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
@ -252,17 +252,17 @@ public class BaseTestCellUtil {
|
||||||
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
||||||
// HSSFCellStyle wraps an underlying style record, and the underlying
|
// HSSFCellStyle wraps an underlying style record, and the underlying
|
||||||
// style record is the same between multiple getCellStyle() calls.
|
// style record is the same between multiple getCellStyle() calls.
|
||||||
assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignment());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
// get/set alignment modifies the cell's style
|
// get/set alignment modifies the cell's style
|
||||||
CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT);
|
CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT);
|
||||||
assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
// get/set alignment doesn't affect the style of cells with
|
// get/set alignment doesn't affect the style of cells with
|
||||||
// the same style prior to modifying the style
|
// the same style prior to modifying the style
|
||||||
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
||||||
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum());
|
assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment());
|
||||||
|
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
@ -280,17 +280,17 @@ public class BaseTestCellUtil {
|
||||||
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
// should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call.
|
||||||
// HSSFCellStyle wraps an underlying style record, and the underlying
|
// HSSFCellStyle wraps an underlying style record, and the underlying
|
||||||
// style record is the same between multiple getCellStyle() calls.
|
// style record is the same between multiple getCellStyle() calls.
|
||||||
assertEquals(VerticalAlignment.BOTTOM, A1.getCellStyle().getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.BOTTOM, A1.getCellStyle().getVerticalAlignment());
|
||||||
assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignment());
|
||||||
|
|
||||||
// get/set alignment modifies the cell's style
|
// get/set alignment modifies the cell's style
|
||||||
CellUtil.setVerticalAlignment(A1, VerticalAlignment.TOP);
|
CellUtil.setVerticalAlignment(A1, VerticalAlignment.TOP);
|
||||||
assertEquals(VerticalAlignment.TOP, A1.getCellStyle().getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.TOP, A1.getCellStyle().getVerticalAlignment());
|
||||||
|
|
||||||
// get/set alignment doesn't affect the style of cells with
|
// get/set alignment doesn't affect the style of cells with
|
||||||
// the same style prior to modifying the style
|
// the same style prior to modifying the style
|
||||||
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
|
||||||
assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignmentEnum());
|
assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignment());
|
||||||
|
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ public class BaseTestCellUtil {
|
||||||
|
|
||||||
CellUtil.setCellStyleProperties(A1, properties);
|
CellUtil.setCellStyleProperties(A1, properties);
|
||||||
CellStyle style = A1.getCellStyle();
|
CellStyle style = A1.getCellStyle();
|
||||||
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum());
|
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPattern());
|
||||||
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
|
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
|
||||||
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
|
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
|
||||||
wb1.close();
|
wb1.close();
|
||||||
|
@ -395,7 +395,7 @@ public class BaseTestCellUtil {
|
||||||
|
|
||||||
CellUtil.setCellStyleProperties(A1, properties);
|
CellUtil.setCellStyleProperties(A1, properties);
|
||||||
CellStyle style = A1.getCellStyle();
|
CellStyle style = A1.getCellStyle();
|
||||||
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum());
|
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPattern());
|
||||||
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
|
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
|
||||||
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
|
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue