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/ooxml/interfaces-jdk15/org/apache/poi/ss | |
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/ooxml/interfaces-jdk15/org/apache/poi/ss')
-rw-r--r-- | src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Name.java | 99 | ||||
-rw-r--r-- | src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java | 2 |
2 files changed, 81 insertions, 20 deletions
diff --git a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Name.java b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Name.java index 6ca59a651f..b896b30ee7 100644 --- a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Name.java +++ b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Name.java @@ -17,44 +17,105 @@ package org.apache.poi.ss.usermodel; +/** + * Represents a defined name for a range of cells. + * <p> + * A name is a meaningful shorthand that makes it easier to understand the purpose of a + * cell reference, constant or a formula. + * </p> + * Examples: + * <pre><blockquote> + * Sheet sheet = workbook.createSheet("Loan Calculator"); + * Name name; + * + * name = workbook.createName(); + * name.setNameName("Interest_Rate"); + * name.setRefersToFormula("'Loan Calculator'!$E$5"); + * + * name = wb.createName(); + * name.setNameName("Loan_Amount"); + * name.setRefersToFormula("'Loan Calculator'!$E$4"); + * + * name = wb.createName(); + * name.setNameName("Number_of_Payments"); + * name.setRefersToFormula("'Loan Calculator'!$E$10"); + * + * name = wb.createName(); + * name.setNameName("Monthly_Payment"); + * name.setRefersToFormula("-PMT(Interest_Rate/12,Number_of_Payments,Loan_Amount)"); + * + * name = wb.createName(); + * name.setNameName("Values_Entered"); + * name.setRefersToFormula("IF(Loan_Amount*Interest_Rate>0,1,0)"); + * + * </blockquote></pre> + */ public interface Name { - /** Get the sheets name which this named range is referenced to + /** + * Get the sheets name which this named range is referenced to + * * @return sheet name, which this named range refered to */ String getSheetName(); /** - * gets the name of the named range + * Gets the name of the named range + * * @return named range name */ String getNameName(); /** - * sets the name of the named range - * @param nameName named range name to set + * Sets the name of the named range + * + * <p>The following is a list of syntax rules that you need to be aware of when you create and edit names.</p> + * <ul> + * <li><strong>Valid characters</strong> + * The first character of a name must be a letter, an underscore character (_), or a backslash (\). + * Remaining characters in the name can be letters, numbers, periods, and underscore characters. + * </li> + * <li><strong>Cell references disallowed</strong> + * Names cannot be the same as a cell reference, such as Z$100 or R1C1.</li> + * <li><strong>Spaces are not valid</strong> + * Spaces are not allowed as part of a name. Use the underscore character (_) and period (.) as word separators, such as, Sales_Tax or First.Quarter. + * </li> + * <li><strong>Name length</strong> + * A name can contain up to 255 characters. + * </li> + * <li><strong>Case sensitivity</strong> + * Names can contain uppercase and lowercase letters. + * </li> + * </ul> + * @param name named range name to set + * @throws IllegalArgumentException if the name is invalid or the workbook already contains this name (case-insensitive) */ - void setNameName(String nameName); + void setNameName(String name); /** - * @deprecated (Nov 2008) Misleading name. Use {@link #getFormula()} instead. + * Returns the formula that the name is defined to refer to. The following are representative examples: + * + * @return the reference for this name + * @see #setRefersToFormula(String) */ - String getReference(); + String getRefersToFormula(); /** - * @deprecated (Nov 2008) Misleading name. Use {@link #setFormula(String)} instead. - */ - void setReference(String ref); - - /** - * @return the formula text defining this name + * Sets the formula that the name is defined to refer to. The following are representative examples: + * + * <ul> + * <li><code>'My Sheet'!$A$3</code></li> + * <li><code>8.3</code></li> + * <li><code>HR!$A$1:$Z$345</code></li> + * <li><code>SUM(Sheet1!A1,Sheet2!B2)</li> + * <li><code>-PMT(Interest_Rate/12,Number_of_Payments,Loan_Amount)</li> + * </ul> + * + * @param ref the reference for this name + * @throws IllegalArgumentException if the specified reference is unparsable */ - String getFormula(); - - /** - * Sets the formula text defining this name - */ - void setFormula(String formulaText); + void setRefersToFormula(String ref); + /** * Checks if this name is a function name * diff --git a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java index e280a35028..7e7645995b 100644 --- a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java +++ b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java @@ -233,7 +233,7 @@ public interface Sheet extends Iterable<Row> { * * @param value <code>true</code> if the sheet displays Automatic Page Breaks. */ - void setAutobreaks(boolean b); + void setAutobreaks(boolean value); /** * Set whether to display the guts or not |