diff options
author | Yegor Kozlov <yegor@apache.org> | 2008-11-21 09:22:07 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2008-11-21 09:22:07 +0000 |
commit | d3dd1fbbcd814db8d0b8b1534796f795730b5c53 (patch) | |
tree | 41c0b7dbbad410d57e932fda7fa9965f44076de8 /src/documentation | |
parent | 1c556150f75de460d9c65b9a847fee50c1c2659c (diff) | |
download | poi-d3dd1fbbcd814db8d0b8b1534796f795730b5c53.tar.gz poi-d3dd1fbbcd814db8d0b8b1534796f795730b5c53.zip |
renamed Name.setFormula to more descriptive setRefersToFormula, also misc improvements in the site docs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@719547 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/documentation')
-rw-r--r-- | src/documentation/content/xdocs/spreadsheet/how-to.xml | 1 | ||||
-rw-r--r-- | src/documentation/content/xdocs/spreadsheet/quick-guide.xml | 25 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/documentation/content/xdocs/spreadsheet/how-to.xml b/src/documentation/content/xdocs/spreadsheet/how-to.xml index 8451813f0f..d21be707e2 100644 --- a/src/documentation/content/xdocs/spreadsheet/how-to.xml +++ b/src/documentation/content/xdocs/spreadsheet/how-to.xml @@ -182,6 +182,7 @@ wb.setSheetName(0, "\u0422\u0435\u0441\u0442\u043E\u0432\u0430\u044F " + // in case of plain ascii // wb.setSheetName(0, "HSSF Test"); // create a sheet with 30 rows (0-29) +int rownum; for (rownum = (short) 0; rownum < 30; rownum++) { // create a row diff --git a/src/documentation/content/xdocs/spreadsheet/quick-guide.xml b/src/documentation/content/xdocs/spreadsheet/quick-guide.xml index 2688bc9f23..e7d2ae798b 100644 --- a/src/documentation/content/xdocs/spreadsheet/quick-guide.xml +++ b/src/documentation/content/xdocs/spreadsheet/quick-guide.xml @@ -1243,19 +1243,24 @@ Examples: Name namedCell = wb.createName(); namedCell.setNameName(cname); String reference = sname+"!A1:A1"; // area reference - namedCell.setReference(reference); + namedCell.setRefersToFormula(reference); // 2. create named range for a single cell using cellreference - Name namedCell = wb.createName(); - namedCell.setNameName(cname); + Name namedCel2 = wb.createName(); + namedCel2.setNameName(cname); String reference = sname+"!A1"; // cell reference - namedCell.setReference(reference); + namedCel2.setRefersToFormula(reference); // 3. create named range for an area using AreaReference - Name namedCell = wb.createName(); - namedCell.setNameName(cname); + Name namedCel3 = wb.createName(); + namedCel3.setNameName(cname); String reference = sname+"!A1:C5"; // area reference - namedCell.setReference(reference); + namedCel3.setRefersToFormula(reference); + + // 4. create named formula + Name namedCel4 = wb.createName(); + namedCel4.setNameName("my_sum"); + namedCel4.setRefersToFormula("SUM(sname+!$I$2:$I$6)"); </source> <p> Reading from Named Range / Named Cell @@ -1270,7 +1275,7 @@ Examples: Name aNamedCell = wb.getNameAt(namedCellIdx); // retrieve the cell at the named range and test its contents - AreaReference aref = new AreaReference(aNamedCell.getReference()); + AreaReference aref = new AreaReference(aNamedCell.getRefersToFormula()); CellReference[] crefs = aref.getAllReferencedCells(); for (int i=0; i<crefs.length; i++) { Sheet s = wb.getSheet(crefs[i].getSheetName()); @@ -1295,7 +1300,7 @@ Examples: // Retrieve the cell at the named range and test its contents // Will get back one AreaReference for C10, and // another for D12 to D14 - AreaReference[] arefs = AreaReference.generateContiguous(aNamedCell.getReference()); + AreaReference[] arefs = AreaReference.generateContiguous(aNamedCell.getRefersToFormula()); for (int i=0; i<arefs.length; i++) { // Only get the corners of the Area // (use arefs[i].getAllReferencedCells() to get all cells) @@ -1320,7 +1325,7 @@ Examples: if(name.isDeleted()){ //named range points to a deleted cell. } else { - AreaReference ref = new AreaReference(name.getReference()); + AreaReference ref = new AreaReference(name.getRefersToFormula()); } </source> </section> |