poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1135656 - /poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
Date Tue, 14 Jun 2011 15:49:17 GMT
Author: yegor
Date: Tue Jun 14 15:49:17 2011
New Revision: 1135656

URL: http://svn.apache.org/viewvc?rev=1135656&view=rev
Log:
added an example on conditional formatting in the site's quick guide

Modified:
    poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml

Modified: poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml?rev=1135656&r1=1135655&r2=1135656&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml Tue Jun 14 15:49:17
2011
@@ -71,6 +71,7 @@
                     <li><link href="#Validation">Data Validation</link></li>
                     <li><link href="#Embedded">Embedded Objects</link></li>
                     <li><link href="#Autofilter">Autofilters</link></li>
+                    <li><link href="#ConditionalFormatting">Conditional Formatting</link></li>
                 </ul>
             </section>
             <section><title>Features</title>
@@ -1662,5 +1663,41 @@ Examples:
     sheet.setAutoFilter(CellRangeAddress.valueOf("C5:F200"));
        </source>
      </section>  
+     <anchor id="ConditionalFormatting"/>
+     <section><title>Conditional Formatting (HSSF Only)</title>
+       <source>
+    HSSFWorkbook workbook = new HSSFWorkbook();
+    HSSFSheet sheet = workbook.createSheet();
+    String formula = "7";
+
+    HSSFSheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();
+
+    HSSFConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(formula);
+    HSSFFontFormatting fontFmt = rule1.createFontFormatting();
+    fontFmt.setFontStyle(true, false);
+
+    HSSFBorderFormatting bordFmt = rule1.createBorderFormatting();
+    bordFmt.setBorderBottom(HSSFBorderFormatting.BORDER_THIN);
+    bordFmt.setBorderTop(HSSFBorderFormatting.BORDER_THICK);
+    bordFmt.setBorderLeft(HSSFBorderFormatting.BORDER_DASHED);
+    bordFmt.setBorderRight(HSSFBorderFormatting.BORDER_DOTTED);
+
+    HSSFPatternFormatting patternFmt = rule1.createPatternFormatting();
+    patternFmt.setFillBackgroundColor(HSSFColor.YELLOW.index);
+
+    HSSFConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(ComparisonOperator.BETWEEN,
"1", "2");
+    HSSFConditionalFormattingRule [] cfRules =
+    {
+        rule1, rule2
+    };
+
+    CellRangeAddress [] regions = {
+        new CellRangeAddress(2, 4, 0, 0), // A3:A5
+    };
+
+    sheetCF.addConditionalFormatting(regions, cfRules);
+    sheetCF.addConditionalFormatting(regions, cfRules);
+       </source>
+     </section>  
     </body>
 </document>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message