aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-06-11 09:15:57 +0000
committerJaven O'Neal <onealj@apache.org>2016-06-11 09:15:57 +0000
commita0e1e136b1a6de2999cc3f26b2a0e649910e4fcc (patch)
treedce260258582bfc46b185d0af0f731e1507a5649 /src/examples
parentba1446c4f7ec278c9712494a7eccbb57ef7c9f97 (diff)
downloadpoi-a0e1e136b1a6de2999cc3f26b2a0e649910e4fcc.tar.gz
poi-a0e1e136b1a6de2999cc3f26b2a0e649910e4fcc.zip
replace usage of all deprecated CellStyle.BORDER_* constants with BorderStyle.*
update PropertyTemplate functions to require enum instead of short borderType git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ss_border_property_template@1747868 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/DrawingBorders.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/examples/src/org/apache/poi/ss/examples/DrawingBorders.java b/src/examples/src/org/apache/poi/ss/examples/DrawingBorders.java
index 1910bfa7d0..be9f1307d0 100644
--- a/src/examples/src/org/apache/poi/ss/examples/DrawingBorders.java
+++ b/src/examples/src/org/apache/poi/ss/examples/DrawingBorders.java
@@ -23,13 +23,14 @@ import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.PropertyTemplate;
+import org.apache.poi.ss.util.PropertyTemplate.Extent;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -66,29 +67,21 @@ public class DrawingBorders {
// draw borders (three 3x3 grids)
PropertyTemplate pt = new PropertyTemplate();
+
// #1) these borders will all be medium in default color
- pt.drawBorders(new CellRangeAddress(1, 3, 1, 3),
- CellStyle.BORDER_MEDIUM, PropertyTemplate.Extent.ALL);
+ pt.drawBorders(new CellRangeAddress(1, 3, 1, 3), BorderStyle.MEDIUM, Extent.ALL);
+
// #2) these cells will have medium outside borders and thin inside borders
- pt.drawBorders(new CellRangeAddress(5, 7, 1, 3),
- CellStyle.BORDER_MEDIUM, PropertyTemplate.Extent.OUTSIDE);
- pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), CellStyle.BORDER_THIN,
- PropertyTemplate.Extent.INSIDE);
+ pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), BorderStyle.MEDIUM, Extent.OUTSIDE);
+ pt.drawBorders(new CellRangeAddress(5, 7, 1, 3), BorderStyle.THIN, Extent.INSIDE);
+
// #3) these cells will all be medium weight with different colors for the
// outside, inside horizontal, and inside vertical borders. The center
// cell will have no borders.
- pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),
- CellStyle.BORDER_MEDIUM, IndexedColors.RED.getIndex(),
- PropertyTemplate.Extent.OUTSIDE);
- pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),
- CellStyle.BORDER_MEDIUM, IndexedColors.BLUE.getIndex(),
- PropertyTemplate.Extent.INSIDE_VERTICAL);
- pt.drawBorders(new CellRangeAddress(9, 11, 1, 3),
- CellStyle.BORDER_MEDIUM, IndexedColors.GREEN.getIndex(),
- PropertyTemplate.Extent.INSIDE_HORIZONTAL);
- pt.drawBorders(new CellRangeAddress(10, 10, 2, 2),
- CellStyle.BORDER_NONE,
- PropertyTemplate.Extent.ALL);
+ pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.RED.getIndex(), Extent.OUTSIDE);
+ pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.BLUE.getIndex(), Extent.INSIDE_VERTICAL);
+ pt.drawBorders(new CellRangeAddress(9, 11, 1, 3), BorderStyle.MEDIUM, IndexedColors.GREEN.getIndex(), Extent.INSIDE_HORIZONTAL);
+ pt.drawBorders(new CellRangeAddress(10, 10, 2, 2), BorderStyle.NONE, Extent.ALL);
// apply borders to sheet
pt.applyBorders(sh1);