SVTableUtils.getAWTColor(s.getRightBorderColor(), SVTableUtils.black),
SVTableUtils.getAWTColor(s.getBottomBorderColor(), SVTableUtils.black),
SVTableUtils.getAWTColor(s.getLeftBorderColor(), SVTableUtils.black),
- s.getBorderTopEnum(), s.getBorderRightEnum(),
- s.getBorderBottomEnum(), s.getBorderLeftEnum(),
+ s.getBorderTop(), s.getBorderRight(),
+ s.getBorderBottom(), s.getBorderLeft(),
hasFocus);
setBorder(cellBorder);
isBorderSet=true;
String borderName;
switch (borderSide) {
case 't': default:
- b1 = style1.getBorderTopEnum() == BorderStyle.THIN;
- b2 = style2.getBorderTopEnum() == BorderStyle.THIN;
+ b1 = style1.getBorderTop() == BorderStyle.THIN;
+ b2 = style2.getBorderTop() == BorderStyle.THIN;
borderName = "TOP";
break;
case 'b':
- b1 = style1.getBorderBottomEnum() == BorderStyle.THIN;
- b2 = style2.getBorderBottomEnum() == BorderStyle.THIN;
+ b1 = style1.getBorderBottom() == BorderStyle.THIN;
+ b2 = style2.getBorderBottom() == BorderStyle.THIN;
borderName = "BOTTOM";
break;
case 'l':
- b1 = style1.getBorderLeftEnum() == BorderStyle.THIN;
- b2 = style2.getBorderLeftEnum() == BorderStyle.THIN;
+ b1 = style1.getBorderLeft() == BorderStyle.THIN;
+ b2 = style2.getBorderLeft() == BorderStyle.THIN;
borderName = "LEFT";
break;
case 'r':
- b1 = style1.getBorderRightEnum() == BorderStyle.THIN;
- b2 = style2.getBorderRightEnum() == BorderStyle.THIN;
+ b1 = style1.getBorderRight() == BorderStyle.THIN;
+ b2 = style2.getBorderRight() == BorderStyle.THIN;
borderName = "RIGHT";
break;
}
}
private void borderStyles(CellStyle style) {
- styleOut("border-left", style.getBorderLeftEnum(), BORDER);
- styleOut("border-right", style.getBorderRightEnum(), BORDER);
- styleOut("border-top", style.getBorderTopEnum(), BORDER);
- styleOut("border-bottom", style.getBorderBottomEnum(), BORDER);
+ styleOut("border-left", style.getBorderLeft(), BORDER);
+ styleOut("border-right", style.getBorderRight(), BORDER);
+ styleOut("border-top", style.getBorderTop(), BORDER);
+ styleOut("border-bottom", style.getBorderBottom(), BORDER);
}
private void fontStyle(CellStyle style) {
_format.setBorderLeft(border.getCode());
}
- /**
- * get the type of border to use for the left border of the cell
- * @return border type
- * @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderLeftEnum()}.
- */
- @Deprecated
@Override
- public short getBorderLeft()
- {
- return _format.getBorderLeft();
- }
- /**
- * get the type of border to use for the left border of the cell
- * @return border type
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderLeftEnum()
+ public BorderStyle getBorderLeft()
{
return BorderStyle.valueOf(_format.getBorderLeft());
}
-
+
+ @Override
+ public BorderStyle getBorderLeftEnum() { return getBorderLeft(); }
+
/**
* set the type of border to use for the right border of the cell
* @param border type
_format.setBorderRight(border.getCode());
}
- /**
- * get the type of border to use for the right border of the cell
- * @return border type
- * @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderRightEnum()}.
- */
- @Deprecated
@Override
- public short getBorderRight()
- {
- return _format.getBorderRight();
- }
- /**
- * get the type of border to use for the right border of the cell
- * @return border type
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderRightEnum()
+ public BorderStyle getBorderRight()
{
return BorderStyle.valueOf(_format.getBorderRight());
}
-
+
+ @Override
+ public BorderStyle getBorderRightEnum() { return getBorderRight(); }
+
/**
* set the type of border to use for the top border of the cell
* @param border type
_format.setBorderTop(border.getCode());
}
- /**
- * get the type of border to use for the top border of the cell
- * @return border type
- * @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderTopEnum()}.
- */
- @Deprecated
@Override
- public short getBorderTop()
- {
- return _format.getBorderTop();
- }
- /**
- * get the type of border to use for the top border of the cell
- * @return border type
- * @since 3.15
- */
- @Override
- public BorderStyle getBorderTopEnum()
+ public BorderStyle getBorderTop()
{
return BorderStyle.valueOf(_format.getBorderTop());
}
-
+
+ @Override
+ public BorderStyle getBorderTopEnum() { return getBorderTop(); }
+
/**
* set the type of border to use for the bottom border of the cell
* @param border type
_format.setBorderBottom(border.getCode());
}
- /**
- * get the type of border to use for the bottom border of the cell
- * @return border type
- * @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderBottomEnum()}.
- */
- @Deprecated
@Override
- public short getBorderBottom()
- {
- return _format.getBorderBottom();
- }
- /**
- * get the type of border to use for the bottom border of the cell
- * @return border type
- * @since 3.15
- */
- @Override
- public BorderStyle getBorderBottomEnum()
+ public BorderStyle getBorderBottom()
{
return BorderStyle.valueOf(_format.getBorderBottom());
}
+ @Override
+ public BorderStyle getBorderBottomEnum() { return getBorderBottom(); }
+
/**
* set the color to use for the left border
* @param color The index of the color definition
/**
* get the type of border to use for the left border of the cell
* @return border type
- * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()} instead.
- * This will return a BorderStyle enum in the future.
+ * @since POI 4.0.0
*/
- short getBorderLeft();
+ BorderStyle getBorderLeft();
+
/**
* get the type of border to use for the left border of the cell
* @return border type
* @since POI 3.15
+ * @deprecated use <code>getBorderLeft()</code> instead
*/
+ @Removal(version = "4.2")
BorderStyle getBorderLeftEnum();
/**
/**
* get the type of border to use for the right border of the cell
* @return border type
- * @deprecated POI 3.15. Use {@link #getBorderRightEnum()} instead.
- * This will return a BorderStyle enum in the future.
+ * @since POI 4.0.0
*/
- short getBorderRight();
+ BorderStyle getBorderRight();
+
/**
* get the type of border to use for the right border of the cell
* @return border type
* @since POI 3.15
+ * @deprecated use <code>getBorderRight()</code> instead
*/
+ @Removal(version = "4.2")
BorderStyle getBorderRightEnum();
/**
/**
* get the type of border to use for the top border of the cell
* @return border type
- * @deprecated POI 3.15. Use {@link #getBorderTopEnum()} instead.
- * This will return a BorderStyle enum in the future.
+ * @since POI 4.0.0
*/
- short getBorderTop();
+ BorderStyle getBorderTop();
+
/**
* get the type of border to use for the top border of the cell
* @return border type
* @since POI 3.15
+ * @deprecated use <code>getBorderTop()</code> instead
*/
+ @Removal(version = "4.2")
BorderStyle getBorderTopEnum();
-
+
/**
* set the type of border to use for the bottom border of the cell
* @param border type
/**
* get the type of border to use for the bottom border of the cell
* @return border type
- * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()} instead.
- * This will return a BorderStyle enum in the future.
+ * @since POI 4.0.0
*/
- short getBorderBottom();
+ BorderStyle getBorderBottom();
+
/**
* get the type of border to use for the bottom border of the cell
* @return border type
* @since POI 3.15
+ * @deprecated use <code>getBorderBottom()</code> instead
*/
+ @Removal(version = "4.2")
BorderStyle getBorderBottomEnum();
/**
Map<String, Object> properties = new HashMap<>();
put(properties, ALIGNMENT, style.getAlignment());
put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignment());
- put(properties, BORDER_BOTTOM, style.getBorderBottomEnum());
- put(properties, BORDER_LEFT, style.getBorderLeftEnum());
- put(properties, BORDER_RIGHT, style.getBorderRightEnum());
- put(properties, BORDER_TOP, style.getBorderTopEnum());
+ put(properties, BORDER_BOTTOM, style.getBorderBottom());
+ put(properties, BORDER_LEFT, style.getBorderLeft());
+ put(properties, BORDER_RIGHT, style.getBorderRight());
+ put(properties, BORDER_TOP, style.getBorderTop());
put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor());
put(properties, DATA_FORMAT, style.getDataFormat());
put(properties, FILL_PATTERN, style.getFillPattern());
public HorizontalAlignment getAlignmentEnum() {
return getAlignment();
}
- /**
- * Get the type of border to use for the bottom border of the cell
- * Will be removed when {@link #getBorderBottom()} returns a BorderStyle enum
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @since POI 3.15
- */
+
@Override
- public BorderStyle getBorderBottomEnum() {
+ public BorderStyle getBorderBottom() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
}
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
- /**
- * Get the type of border to use for the bottom border of the cell
- * This will return a BorderStyle enum in the future.
- *
- * @return border type code
- * @deprecated 3.15 beta 2. Use {@link #getBorderBottomEnum()}
- */
- public short getBorderBottom() {
- return getBorderBottomEnum().getCode();
+
+ @Override
+ public BorderStyle getBorderBottomEnum() {
+ return getBorderBottom();
}
- /**
- * Get the type of border to use for the left border of the cell
- * Will be removed when {@link #getBorderLeft()} returns a BorderStyle enum
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderLeftEnum() {
+ public BorderStyle getBorderLeft() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
- /**
- * Get the type of border to use for the left border of the cell
- * This will return a BorderStyle enum in the future.
- *
- * @return border type code
- * @deprecated 3.15 beta 2. Use {@link #getBorderLeftEnum()}
- */
- public short getBorderLeft() {
- return getBorderLeftEnum().getCode();
- }
+ @Override
+ public BorderStyle getBorderLeftEnum() { return getBorderLeft(); }
- /**
- * Get the type of border to use for the right border of the cell
- * Will be removed when {@link #getBorderRight()} returns a BorderStyle enum
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderRightEnum() {
+ public BorderStyle getBorderRight() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
}
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
- /**
- * Get the type of border to use for the right border of the cell
- * This will return a BorderStyle enum in the future.
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @deprecated 3.15 beta 2. Use {@link #getBorderRightEnum()} instead
- */
- public short getBorderRight() {
- return getBorderRightEnum().getCode();
+
+ @Override
+ public BorderStyle getBorderRightEnum() {
+ return getBorderRight();
}
- /**
- * Get the type of border to use for the top border of the cell
- * Will be removed when {@link #getBorderTop()} returns a BorderStyle enum
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderTopEnum() {
+ public BorderStyle getBorderTop() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
}
return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
- /**
- * Get the type of border to use for the top border of the cell
- * This will return a BorderStyle enum in the future.
- *
- * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
- * @deprecated 3.15 beta 2. Use {@link #getBorderTopEnum()} instead.
- */
- public short getBorderTop() {
- return getBorderTopEnum().getCode();
+
+ @Override
+ public BorderStyle getBorderTopEnum() {
+ return getBorderTop();
}
/**
for (Row row: sheet) {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
- assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
}
}
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
if (cell.getColumnIndex() != 1 || row.getRowNum() == 0) {
- assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderTop());
}
if (cell.getColumnIndex() != 1 || row.getRowNum() == 2) {
- assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderBottom());
}
if (cell.getColumnIndex() == 0 || row.getRowNum() != 1) {
- assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderLeft());
}
if (cell.getColumnIndex() == 2 || row.getRowNum() != 1) {
- assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderRight());
}
}
}
for (Row row : sheet) {
for (Cell cell : row) {
CellStyle cs = cell.getCellStyle();
- assertEquals(BorderStyle.MEDIUM, cs.getBorderTopEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderBottomEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderLeftEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderTop());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderBottom());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderLeft());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
@Test
public void testGetSetBorderBottom() {
//default values
- assertEquals(BorderStyle.NONE, cellStyle.getBorderBottomEnum());
+ assertEquals(BorderStyle.NONE, cellStyle.getBorderBottom());
int num = stylesTable.getBorders().size();
cellStyle.setBorderBottom(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottomEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottom());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderBottom(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottomEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottom());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@Test
public void testGetSetBorderRight() {
//default values
- assertEquals(BorderStyle.NONE, cellStyle.getBorderRightEnum());
+ assertEquals(BorderStyle.NONE, cellStyle.getBorderRight());
int num = stylesTable.getBorders().size();
cellStyle.setBorderRight(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRight());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderRight(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRight());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@Test
public void testGetSetBorderLeft() {
//default values
- assertEquals(BorderStyle.NONE, cellStyle.getBorderLeftEnum());
+ assertEquals(BorderStyle.NONE, cellStyle.getBorderLeft());
int num = stylesTable.getBorders().size();
cellStyle.setBorderLeft(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeftEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeft());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderLeft(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeftEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeft());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@Test
public void testGetSetBorderTop() {
//default values
- assertEquals(BorderStyle.NONE, cellStyle.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, cellStyle.getBorderTop());
int num = stylesTable.getBorders().size();
cellStyle.setBorderTop(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTopEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTop());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderTop(BorderStyle.MEDIUM);
- assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTopEnum());
+ assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTop());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
private void testGetSetBorderXMLBean(BorderStyle border, STBorderStyle.Enum expected) {
cellStyle.setBorderTop(border);
- assertEquals(border, cellStyle.getBorderTopEnum());
+ assertEquals(border, cellStyle.getBorderTop());
int borderId = (int)cellStyle.getCoreXf().getBorderId();
assertTrue(borderId > 0);
//check changes in the underlying xml bean
@Test
public void testGetSetBorderNone() {
cellStyle.setBorderTop(BorderStyle.NONE);
- assertEquals(BorderStyle.NONE, cellStyle.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, cellStyle.getBorderTop());
int borderId = (int)cellStyle.getCoreXf().getBorderId();
assertTrue(borderId > 0);
//check changes in the underlying xml bean
assertEquals(style2.getRightBorderColor(), style1.getRightBorderColor());
assertEquals(style2.getBottomBorderColor(), style1.getBottomBorderColor());
- assertEquals(style2.getBorderBottomEnum(), style1.getBorderBottomEnum());
- assertEquals(style2.getBorderLeftEnum(), style1.getBorderLeftEnum());
- assertEquals(style2.getBorderRightEnum(), style1.getBorderRightEnum());
- assertEquals(style2.getBorderTopEnum(), style1.getBorderTopEnum());
+ assertEquals(style2.getBorderBottom(), style1.getBorderBottom());
+ assertEquals(style2.getBorderLeft(), style1.getBorderLeft());
+ assertEquals(style2.getBorderRight(), style1.getBorderRight());
+ assertEquals(style2.getBorderTop(), style1.getBorderTop());
wb2.close();
}
Workbook copy = XSSFTestDataSamples.writeOutAndReadBack(target);
// previously this failed because the border-element was not copied over
- copy.getCellStyleAt((short)1).getBorderBottomEnum();
+ copy.getCellStyleAt((short)1).getBorderBottom();
copy.close();
protected boolean isEmptyStyle( CellStyle cellStyle ) {
return cellStyle == null || (
cellStyle.getFillPattern() == FillPatternType.NO_FILL
- && cellStyle.getBorderTopEnum() == BorderStyle.NONE
- && cellStyle.getBorderRightEnum() == BorderStyle.NONE
- && cellStyle.getBorderBottomEnum() == BorderStyle.NONE
- && cellStyle.getBorderLeftEnum() == BorderStyle.NONE
+ && cellStyle.getBorderTop() == BorderStyle.NONE
+ && cellStyle.getBorderRight() == BorderStyle.NONE
+ && cellStyle.getBorderBottom() == BorderStyle.NONE
+ && cellStyle.getBorderLeft() == BorderStyle.NONE
);
}
}
processCellStyleBorder( workbook, cellTarget, "top",
- cellStyle.getBorderTopEnum(), cellStyle.getTopBorderColor() );
+ cellStyle.getBorderTop(), cellStyle.getTopBorderColor() );
processCellStyleBorder( workbook, cellTarget, "right",
- cellStyle.getBorderRightEnum(), cellStyle.getRightBorderColor() );
+ cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
processCellStyleBorder( workbook, cellTarget, "bottom",
- cellStyle.getBorderBottomEnum(), cellStyle.getBottomBorderColor() );
+ cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
processCellStyleBorder( workbook, cellTarget, "left",
- cellStyle.getBorderLeftEnum(), cellStyle.getLeftBorderColor() );
+ cellStyle.getBorderLeft(), cellStyle.getLeftBorderColor() );
HSSFFont font = cellStyle.getFont( workbook );
processCellStyleFont( workbook, blockTarget, font );
break;
}
- buildStyle_border( workbook, style, "top", cellStyle.getBorderTopEnum(),
+ buildStyle_border( workbook, style, "top", cellStyle.getBorderTop(),
cellStyle.getTopBorderColor() );
buildStyle_border( workbook, style, "right",
- cellStyle.getBorderRightEnum(), cellStyle.getRightBorderColor() );
+ cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
buildStyle_border( workbook, style, "bottom",
- cellStyle.getBorderBottomEnum(), cellStyle.getBottomBorderColor() );
- buildStyle_border( workbook, style, "left", cellStyle.getBorderLeftEnum(),
+ cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
+ buildStyle_border( workbook, style, "left", cellStyle.getBorderLeft(),
cellStyle.getLeftBorderColor() );
HSSFFont font = cellStyle.getFont( workbook );
Row row = sheet.getRow(0);
CellStyle rstyle = row.getRowStyle();
assertNotNull(rstyle);
- assertEquals(BorderStyle.DOUBLE, rstyle.getBorderBottomEnum());
+ assertEquals(BorderStyle.DOUBLE, rstyle.getBorderBottom());
wb.close();
}
HSSFCellStyle cs;
cs = s.getRow(0).getCell(0).getCellStyle();
- assertEquals(BorderStyle.HAIR, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.HAIR, cs.getBorderRight());
cs = s.getRow(1).getCell(1).getCellStyle();
- assertEquals(BorderStyle.DOTTED, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.DOTTED, cs.getBorderRight());
cs = s.getRow(2).getCell(2).getCellStyle();
- assertEquals(BorderStyle.DASH_DOT_DOT, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.DASH_DOT_DOT, cs.getBorderRight());
cs = s.getRow(3).getCell(3).getCellStyle();
- assertEquals(BorderStyle.DASHED, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.DASHED, cs.getBorderRight());
cs = s.getRow(4).getCell(4).getCellStyle();
- assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderRight());
cs = s.getRow(5).getCell(5).getCellStyle();
- assertEquals(BorderStyle.MEDIUM_DASH_DOT_DOT, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM_DASH_DOT_DOT, cs.getBorderRight());
cs = s.getRow(6).getCell(6).getCellStyle();
- assertEquals(BorderStyle.SLANTED_DASH_DOT, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.SLANTED_DASH_DOT, cs.getBorderRight());
cs = s.getRow(7).getCell(7).getCellStyle();
- assertEquals(BorderStyle.MEDIUM_DASH_DOT, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM_DASH_DOT, cs.getBorderRight());
cs = s.getRow(8).getCell(8).getCellStyle();
- assertEquals(BorderStyle.MEDIUM_DASHED, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM_DASHED, cs.getBorderRight());
cs = s.getRow(9).getCell(9).getCellStyle();
- assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
cs = s.getRow(10).getCell(10).getCellStyle();
- assertEquals(BorderStyle.THICK, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THICK, cs.getBorderRight());
cs = s.getRow(11).getCell(11).getCellStyle();
- assertEquals(BorderStyle.DOUBLE, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.DOUBLE, cs.getBorderRight());
}
public void testShrinkToFit() {
newCell.setCellValue("2testtext2");
CellStyle newStyle = newCell.getCellStyle();
- assertEquals(BorderStyle.DOTTED, newStyle.getBorderBottomEnum());
+ assertEquals(BorderStyle.DOTTED, newStyle.getBorderBottom());
assertEquals(Font.COLOR_RED, ((HSSFCellStyle)newStyle).getFont(wb).getColor());
// OutputStream out = new FileOutputStream("/tmp/56959.xls");
// Check
assertEquals(23, wb.getNumCellStyles());
- assertEquals(BorderStyle.THICK, r.getCell(0).getCellStyle().getBorderBottomEnum());
- assertEquals(BorderStyle.DASH_DOT, r.getCell(1).getCellStyle().getBorderBottomEnum());
- assertEquals(BorderStyle.THICK, r.getCell(2).getCellStyle().getBorderBottomEnum());
+ assertEquals(BorderStyle.THICK, r.getCell(0).getCellStyle().getBorderBottom());
+ assertEquals(BorderStyle.DASH_DOT, r.getCell(1).getCellStyle().getBorderBottom());
+ assertEquals(BorderStyle.THICK, r.getCell(2).getCellStyle().getBorderBottom());
}
}
assertNotNull("Row is not null", r);
cs = r.getRowStyle();
- assertEquals("Bottom Border Style for row:", BorderStyle.THIN, cs.getBorderBottomEnum());
- assertEquals("Left Border Style for row:", BorderStyle.THIN, cs.getBorderLeftEnum());
- assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum());
- assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum());
+ assertEquals("Bottom Border Style for row:", BorderStyle.THIN, cs.getBorderBottom());
+ assertEquals("Left Border Style for row:", BorderStyle.THIN, cs.getBorderLeft());
+ assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRight());
+ assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTop());
assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor());
assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPattern());
protected void assertBorderStyleEquals(BorderStyle expected, Cell cell) {
CellStyle style = cell.getCellStyle();
- assertEquals(expected, style.getBorderTopEnum());
- assertEquals(expected, style.getBorderBottomEnum());
- assertEquals(expected, style.getBorderLeftEnum());
- assertEquals(expected, style.getBorderRightEnum());
+ assertEquals(expected, style.getBorderTop());
+ assertEquals(expected, style.getBorderBottom());
+ assertEquals(expected, style.getBorderLeft());
+ assertEquals(expected, style.getBorderRight());
}
}
assertNotNull("Formula Cell Style", cs);
assertEquals("Font Index Matches", f.getIndex(), cs.getFontIndex());
- assertEquals("Top Border", BorderStyle.THIN, cs.getBorderTopEnum());
- assertEquals("Left Border", BorderStyle.THIN, cs.getBorderLeftEnum());
- assertEquals("Right Border", BorderStyle.THIN, cs.getBorderRightEnum());
- assertEquals("Bottom Border", BorderStyle.THIN, cs.getBorderBottomEnum());
+ assertEquals("Top Border", BorderStyle.THIN, cs.getBorderTop());
+ assertEquals("Left Border", BorderStyle.THIN, cs.getBorderLeft());
+ assertEquals("Right Border", BorderStyle.THIN, cs.getBorderRight());
+ assertEquals("Bottom Border", BorderStyle.THIN, cs.getBorderBottom());
wb2.close();
}
// A valid BorderStyle constant, as a Short
CellUtil.setCellStyleProperty(c, CellUtil.BORDER_BOTTOM, BorderStyle.DASH_DOT.getCode());
- assertEquals(BorderStyle.DASH_DOT, c.getCellStyle().getBorderBottomEnum());
+ assertEquals(BorderStyle.DASH_DOT, c.getCellStyle().getBorderBottom());
// A valid BorderStyle constant, as an Enum
CellUtil.setCellStyleProperty(c, CellUtil.BORDER_TOP, BorderStyle.MEDIUM_DASH_DOT);
- assertEquals(BorderStyle.MEDIUM_DASH_DOT, c.getCellStyle().getBorderTopEnum());
+ assertEquals(BorderStyle.MEDIUM_DASH_DOT, c.getCellStyle().getBorderTop());
wb.close();
}
for (Row row: sheet) {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
- assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
- assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
}
}
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
if (cell.getColumnIndex() != 1 || row.getRowNum() == 0) {
- assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderTop());
}
if (cell.getColumnIndex() != 1 || row.getRowNum() == 2) {
- assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderBottomEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderBottom());
}
if (cell.getColumnIndex() == 0 || row.getRowNum() != 1) {
- assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderLeftEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderLeft());
}
if (cell.getColumnIndex() == 2 || row.getRowNum() != 1) {
- assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
} else {
- assertEquals(BorderStyle.NONE, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.NONE, cs.getBorderRight());
}
}
}
for (Row row : sheet) {
for (Cell cell : row) {
CellStyle cs = cell.getCellStyle();
- assertEquals(BorderStyle.MEDIUM, cs.getBorderTopEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderBottomEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderLeftEnum());
- assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderTop());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderBottom());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderLeft());
+ assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
@Test
public void setBorderTop() {
- assertEquals(NONE, getCellStyle(0, 0).getBorderTopEnum());
- assertEquals(NONE, getCellStyle(0, 1).getBorderTopEnum());
- assertEquals(NONE, getCellStyle(0, 2).getBorderTopEnum());
+ assertEquals(NONE, getCellStyle(0, 0).getBorderTop());
+ assertEquals(NONE, getCellStyle(0, 1).getBorderTop());
+ assertEquals(NONE, getCellStyle(0, 2).getBorderTop());
RegionUtil.setBorderTop(THIN, A1C3, sheet);
- assertEquals(THIN, getCellStyle(0, 0).getBorderTopEnum());
- assertEquals(THIN, getCellStyle(0, 1).getBorderTopEnum());
- assertEquals(THIN, getCellStyle(0, 2).getBorderTopEnum());
+ assertEquals(THIN, getCellStyle(0, 0).getBorderTop());
+ assertEquals(THIN, getCellStyle(0, 1).getBorderTop());
+ assertEquals(THIN, getCellStyle(0, 2).getBorderTop());
}
@Test
public void setBorderBottom() {
- assertEquals(NONE, getCellStyle(2, 0).getBorderBottomEnum());
- assertEquals(NONE, getCellStyle(2, 1).getBorderBottomEnum());
- assertEquals(NONE, getCellStyle(2, 2).getBorderBottomEnum());
+ assertEquals(NONE, getCellStyle(2, 0).getBorderBottom());
+ assertEquals(NONE, getCellStyle(2, 1).getBorderBottom());
+ assertEquals(NONE, getCellStyle(2, 2).getBorderBottom());
RegionUtil.setBorderBottom(THIN, A1C3, sheet);
- assertEquals(THIN, getCellStyle(2, 0).getBorderBottomEnum());
- assertEquals(THIN, getCellStyle(2, 1).getBorderBottomEnum());
- assertEquals(THIN, getCellStyle(2, 2).getBorderBottomEnum());
+ assertEquals(THIN, getCellStyle(2, 0).getBorderBottom());
+ assertEquals(THIN, getCellStyle(2, 1).getBorderBottom());
+ assertEquals(THIN, getCellStyle(2, 2).getBorderBottom());
}
@Test
public void setBorderRight() {
- assertEquals(NONE, getCellStyle(0, 2).getBorderRightEnum());
- assertEquals(NONE, getCellStyle(1, 2).getBorderRightEnum());
- assertEquals(NONE, getCellStyle(2, 2).getBorderRightEnum());
+ assertEquals(NONE, getCellStyle(0, 2).getBorderRight());
+ assertEquals(NONE, getCellStyle(1, 2).getBorderRight());
+ assertEquals(NONE, getCellStyle(2, 2).getBorderRight());
RegionUtil.setBorderRight(THIN, A1C3, sheet);
- assertEquals(THIN, getCellStyle(0, 2).getBorderRightEnum());
- assertEquals(THIN, getCellStyle(1, 2).getBorderRightEnum());
- assertEquals(THIN, getCellStyle(2, 2).getBorderRightEnum());
+ assertEquals(THIN, getCellStyle(0, 2).getBorderRight());
+ assertEquals(THIN, getCellStyle(1, 2).getBorderRight());
+ assertEquals(THIN, getCellStyle(2, 2).getBorderRight());
}
@Test
public void setBorderLeft() {
- assertEquals(NONE, getCellStyle(0, 0).getBorderLeftEnum());
- assertEquals(NONE, getCellStyle(1, 0).getBorderLeftEnum());
- assertEquals(NONE, getCellStyle(2, 0).getBorderLeftEnum());
+ assertEquals(NONE, getCellStyle(0, 0).getBorderLeft());
+ assertEquals(NONE, getCellStyle(1, 0).getBorderLeft());
+ assertEquals(NONE, getCellStyle(2, 0).getBorderLeft());
RegionUtil.setBorderLeft(THIN, A1C3, sheet);
- assertEquals(THIN, getCellStyle(0, 0).getBorderLeftEnum());
- assertEquals(THIN, getCellStyle(1, 0).getBorderLeftEnum());
- assertEquals(THIN, getCellStyle(2, 0).getBorderLeftEnum());
+ assertEquals(THIN, getCellStyle(0, 0).getBorderLeft());
+ assertEquals(THIN, getCellStyle(1, 0).getBorderLeft());
+ assertEquals(THIN, getCellStyle(2, 0).getBorderLeft());
}
@Test
@Test
public void bordersCanBeAddedToNonExistantCells() {
RegionUtil.setBorderTop(THIN, A1C3, sheet);
- assertEquals(THIN, getCellStyle(0, 0).getBorderTopEnum());
- assertEquals(THIN, getCellStyle(0, 1).getBorderTopEnum());
- assertEquals(THIN, getCellStyle(0, 2).getBorderTopEnum());
+ assertEquals(THIN, getCellStyle(0, 0).getBorderTop());
+ assertEquals(THIN, getCellStyle(0, 1).getBorderTop());
+ assertEquals(THIN, getCellStyle(0, 2).getBorderTop());
}
@Test
public void borderColorsCanBeAddedToNonExistantCells() {