From f74b254a407792bd1210731fa8e230257c1c8d73 Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Mon, 29 Apr 2002 11:08:22 +0000 Subject: [PATCH] Fix examples and updated documentation git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352556 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/xdocs/hssf/how-to.xml | 235 +++++++++--------- src/documentation/xdocs/hssf/quick-guide.xml | 12 +- src/documentation/xdocs/todo.xml | 3 +- .../hssf/usermodel/examples/BigExample.java | 7 +- .../poi/hssf/usermodel/examples/Borders.java | 26 +- .../usermodel/examples/FrillsAndFills.java | 5 +- 6 files changed, 133 insertions(+), 155 deletions(-) diff --git a/src/documentation/xdocs/hssf/how-to.xml b/src/documentation/xdocs/hssf/how-to.xml index 8c5d930db..ae2eb74d0 100644 --- a/src/documentation/xdocs/hssf/how-to.xml +++ b/src/documentation/xdocs/hssf/how-to.xml @@ -75,141 +75,142 @@

Here is some example code (excerpted and adapted from org.apache.poi.hssf.dev.HSSF test class):

-
diff --git a/src/documentation/xdocs/hssf/quick-guide.xml b/src/documentation/xdocs/hssf/quick-guide.xml index 2d660255d..d54e45ae2 100644 --- a/src/documentation/xdocs/hssf/quick-guide.xml +++ b/src/documentation/xdocs/hssf/quick-guide.xml @@ -179,13 +179,13 @@ // Style the cell with borders all around. HSSFCellStyle style = wb.createCellStyle(); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); - style.setBottomBorderColor(HSSFCellStyle.BLACK); + style.setBottomBorderColor(HSSFColor.BLACK.index); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); - style.setLeftBorderColor(HSSFCellStyle.GREEN); + style.setLeftBorderColor(HSSFColor.GREEN.index); style.setBorderRight(HSSFCellStyle.BORDER_THIN); - style.setRightBorderColor(HSSFCellStyle.BLUE); + style.setRightBorderColor(HSSFColor.BLUE.index); style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED); - style.setTopBorderColor(HSSFCellStyle.AUTOMATIC); + style.setTopBorderColor(HSSFColor.BLACK.index); cell.setCellStyle(style); // Write the output to a file @@ -205,7 +205,7 @@ // Aqua background HSSFCellStyle style = wb.createCellStyle(); - style.setFillBackgroundColor(HSSFCellStyle.AQUA); + style.setFillBackgroundColor(HSSFColor.AQUA.index); style.setFillPattern(HSSFCellStyle.BIG_SPOTS); HSSFCell cell = row.createCell((short) 1); cell.setCellValue("X"); @@ -213,7 +213,7 @@ // Orange "foreground", foreground being the fill foreground not the font color. style = wb.createCellStyle(); - style.setFillForegroundColor(HSSFCellStyle.ORANGE); + style.setFillForegroundColor(HSSFColor.ORANGE.index); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); cell = row.createCell((short) 2); cell.setCellValue("X"); diff --git a/src/documentation/xdocs/todo.xml b/src/documentation/xdocs/todo.xml index 35ef984a9..f308ec585 100644 --- a/src/documentation/xdocs/todo.xml +++ b/src/documentation/xdocs/todo.xml @@ -21,9 +21,8 @@ Finish Charts - Add Formulas. + Finish Formulas. - diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/BigExample.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/BigExample.java index 1b528a401..d6bd14c6b 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/BigExample.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/BigExample.java @@ -55,6 +55,7 @@ package org.apache.poi.hssf.usermodel.examples; import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; import java.io.FileOutputStream; import java.io.IOException; @@ -93,7 +94,7 @@ public class BigExample //set font 1 to 12 point type f.setFontHeightInPoints((short) 12); //make it red - f.setColor((short) HSSFCellStyle.RED); + f.setColor((short) HSSFColor.RED.index); // make it bold //arial is the default font f.setBoldweight(f.BOLDWEIGHT_BOLD); @@ -101,7 +102,7 @@ public class BigExample //set font 2 to 10 point type f2.setFontHeightInPoints((short) 10); //make it the color at palette index 0xf (white) - f2.setColor((short) HSSFCellStyle.WHITE); + f2.setColor((short) HSSFColor.WHITE.index); //make it bold f2.setBoldweight(f2.BOLDWEIGHT_BOLD); @@ -115,7 +116,7 @@ public class BigExample //fill w fg fill color cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND); // set foreground fill to red - cs2.setFillForegroundColor((short) HSSFCellStyle.RED); + cs2.setFillForegroundColor((short) HSSFColor.RED.index); // set the font cs2.setFont(f2); diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/Borders.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/Borders.java index 9f35244d9..864b59ebc 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/Borders.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/Borders.java @@ -55,6 +55,7 @@ package org.apache.poi.hssf.usermodel.examples; import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; import java.io.FileOutputStream; import java.io.IOException; @@ -69,31 +70,6 @@ public class Borders public static void main(String[] args) throws IOException { - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet("new sheet"); - // Create a row and put some cells in it. Rows are 0 based. - HSSFRow row = sheet.createRow((short) 1); - - // Create a cell and put a value in it. - HSSFCell cell = row.createCell((short) 1); - cell.setCellValue(4); - - // Style the cell with borders all around. - HSSFCellStyle style = wb.createCellStyle(); - style.setBorderBottom(HSSFCellStyle.BORDER_THIN); - style.setBottomBorderColor(HSSFCellStyle.BLACK); - style.setBorderLeft(HSSFCellStyle.BORDER_THIN); - style.setLeftBorderColor(HSSFCellStyle.GREEN); - style.setBorderRight(HSSFCellStyle.BORDER_THIN); - style.setRightBorderColor(HSSFCellStyle.BLUE); - style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED); - style.setTopBorderColor(HSSFCellStyle.AUTOMATIC); - cell.setCellStyle(style); - - // Write the output to a file - FileOutputStream fileOut = new FileOutputStream("workbook.xls"); - wb.write(fileOut); - fileOut.close(); } } diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/FrillsAndFills.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/FrillsAndFills.java index ffadff8ee..8e97e1135 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/FrillsAndFills.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/FrillsAndFills.java @@ -55,6 +55,7 @@ package org.apache.poi.hssf.usermodel.examples; import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; import java.io.FileOutputStream; import java.io.IOException; @@ -77,7 +78,7 @@ public class FrillsAndFills // Aqua background HSSFCellStyle style = wb.createCellStyle(); - style.setFillBackgroundColor(HSSFCellStyle.AQUA); + style.setFillBackgroundColor(HSSFColor.AQUA.index); style.setFillPattern(HSSFCellStyle.BIG_SPOTS); HSSFCell cell = row.createCell((short) 1); cell.setCellValue("X"); @@ -85,7 +86,7 @@ public class FrillsAndFills // Orange "foreground", foreground being the fill foreground not the font color. style = wb.createCellStyle(); - style.setFillForegroundColor(HSSFCellStyle.ORANGE); + style.setFillForegroundColor(HSSFColor.ORANGE.index); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); cell = row.createCell((short) 2); cell.setCellValue("X");