mirror of https://github.com/apache/poi.git
:poi - fix javadocs - link to dependent/external project javadocs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
41b9bb011f
commit
382714eccd
|
@ -31,6 +31,7 @@ final String VERSIONS9 = 'META-INF/versions/9'
|
|||
|
||||
configurations {
|
||||
tests
|
||||
javadocs
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
@ -59,6 +60,9 @@ dependencies {
|
|||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
||||
|
||||
javadocs project(':poi-ooxml')
|
||||
javadocs project(':poi-scratchpad')
|
||||
}
|
||||
|
||||
final String MODULE_NAME = 'org.apache.poi.poi'
|
||||
|
@ -201,11 +205,20 @@ test {
|
|||
}
|
||||
|
||||
javadoc {
|
||||
// fails currently, need to fix the sources
|
||||
failOnError = false
|
||||
// if(JavaVersion.current().isJava9Compatible()) {
|
||||
// options.addBooleanOption('html5', true)
|
||||
// }
|
||||
failOnError = true
|
||||
doFirst {
|
||||
options {
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
addBooleanOption('html5', true)
|
||||
}
|
||||
links 'https://poi.apache.org/apidocs/dev/'
|
||||
links 'https://docs.oracle.com/javase/8/docs/api/'
|
||||
use = true
|
||||
splitIndex = true
|
||||
source = "1.8"
|
||||
classpath += configurations.javadocs.files
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
|
|
|
@ -34,10 +34,8 @@ import org.apache.poi.ss.usermodel.DataFormat;
|
|||
* <b>International Formats</b><br>
|
||||
* Since version 2003 Excel has supported international formats. These are denoted
|
||||
* with a prefix "[$-xxx]" (where xxx is a 1-7 digit hexadecimal number).
|
||||
* See the Microsoft article
|
||||
* <a href="http://office.microsoft.com/assistance/hfws.aspx?AssetID=HA010346351033&CTT=6&Origin=EC010272491033">
|
||||
* Creating international number formats
|
||||
* </a> for more details on these codes.
|
||||
*
|
||||
* @see <a href="https://support.microsoft.com/en-us/office/review-guidelines-for-customizing-a-number-format-c0a1d1fa-d3f4-4018-96b7-9c9354dd99f5">Review guidelines for customizing a number format</a>
|
||||
*/
|
||||
public final class HSSFDataFormat implements DataFormat {
|
||||
private static final String[] _builtinFormats = BuiltinFormats.getAll();
|
||||
|
@ -107,7 +105,7 @@ public final class HSSFDataFormat implements DataFormat {
|
|||
}
|
||||
_movedBuiltins = true;
|
||||
}
|
||||
|
||||
|
||||
// See if we can find it
|
||||
for(int i=0; i<_formats.size(); i++) {
|
||||
if(format.equals(_formats.get(i))) {
|
||||
|
@ -168,7 +166,7 @@ public final class HSSFDataFormat implements DataFormat {
|
|||
public static int getNumberOfBuiltinBuiltinFormats() {
|
||||
return _builtinFormats.length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensures that the formats list can hold entries
|
||||
* up to and including the entry with this index
|
||||
|
|
|
@ -106,7 +106,7 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
|||
* @param column - the column number this cell represents
|
||||
*
|
||||
* @return HSSFCell a high level representation of the created cell.
|
||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than 255,
|
||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than 255,
|
||||
* the maximum number of columns supported by the Excel binary format (.xls)
|
||||
*/
|
||||
@Override
|
||||
|
@ -126,7 +126,7 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
|||
* @param columnIndex - the column number this cell represents
|
||||
*
|
||||
* @return HSSFCell a high level representation of the created cell.
|
||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than 255,
|
||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than 255,
|
||||
* the maximum number of columns supported by the Excel binary format (.xls)
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -1748,7 +1748,7 @@ public final class HSSFSheet implements Sheet {
|
|||
|
||||
/**
|
||||
* Shifts columns in range [startColumn, endColumn] for n places to the right.
|
||||
* For n < 0, it will shift columns left.
|
||||
* For n < 0, it will shift columns left.
|
||||
* Additionally adjusts formulas.
|
||||
* Probably should also process other features (hyperlinks, comments...) in the way analog to shiftRows method
|
||||
* @param startColumn the column to start shifting
|
||||
|
|
|
@ -54,9 +54,10 @@ public class POIFSDocumentPath {
|
|||
* @param components the Strings making up the path to a document.
|
||||
* The Strings must be ordered as they appear in the directory hierarchy of the the document.
|
||||
* The first string must be the name of a directory in the root of the POIFSFileSystem, and
|
||||
* every Nth (for N > 1) string thereafter must be the name of a directory in the directory
|
||||
* identified by the (N-1)th string. <p> If the components parameter is null or has zero length,
|
||||
* the POIFSDocumentPath is appropriate for a document that is in the root of a POIFSFileSystem
|
||||
* every Nth (for N > 1) string thereafter must be the name of a directory in the directory
|
||||
* identified by the (N-1)th string.<p>
|
||||
* If the components parameter is null or has zero length, the POIFSDocumentPath is appropriate
|
||||
* for a document that is in the root of a POIFSFileSystem
|
||||
*
|
||||
* @exception IllegalArgumentException
|
||||
* if any of the elements in the components parameter are null or have zero length
|
||||
|
@ -133,7 +134,7 @@ public class POIFSDocumentPath {
|
|||
*
|
||||
* @return the nth component;
|
||||
*
|
||||
* @exception ArrayIndexOutOfBoundsException if n < 0 or n >= length()
|
||||
* @exception ArrayIndexOutOfBoundsException if n < 0 or n >= length()
|
||||
*/
|
||||
public String getComponent(int n) throws ArrayIndexOutOfBoundsException {
|
||||
return components[ n ];
|
||||
|
|
|
@ -33,10 +33,10 @@ import java.util.Set;
|
|||
public class DirectoryProperty extends Property implements Parent, Iterable<Property> {
|
||||
|
||||
/** List of Property instances */
|
||||
private List<Property> _children;
|
||||
private final List<Property> _children = new ArrayList<>();
|
||||
|
||||
/** set of children's names */
|
||||
private Set<String> _children_names;
|
||||
private final Set<String> _children_names = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
|
@ -46,8 +46,6 @@ public class DirectoryProperty extends Property implements Parent, Iterable<Prop
|
|||
public DirectoryProperty(String name)
|
||||
{
|
||||
super();
|
||||
_children = new ArrayList<>();
|
||||
_children_names = new HashSet<>();
|
||||
setName(name);
|
||||
setSize(0);
|
||||
setPropertyType(PropertyConstants.DIRECTORY_TYPE);
|
||||
|
@ -66,8 +64,6 @@ public class DirectoryProperty extends Property implements Parent, Iterable<Prop
|
|||
final int offset)
|
||||
{
|
||||
super(index, array, offset);
|
||||
_children = new ArrayList<>();
|
||||
_children_names = new HashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +117,7 @@ public class DirectoryProperty extends Property implements Parent, Iterable<Prop
|
|||
}
|
||||
|
||||
public static class PropertyComparator implements Comparator<Property>, Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* compare method. Assumes both parameters are non-null
|
||||
* instances of Property. One property is less than another if
|
||||
|
@ -133,9 +129,9 @@ public class DirectoryProperty extends Property implements Parent, Iterable<Prop
|
|||
* @param o1 first object to compare, better be a Property
|
||||
* @param o2 second object to compare, better be a Property
|
||||
*
|
||||
* @return negative value if o1 < o2,
|
||||
* @return negative value if o1 < o2,
|
||||
* zero if o1 == o2,
|
||||
* positive value if o1 > o2.
|
||||
* positive value if o1 > o2.
|
||||
*/
|
||||
public int compare(Property o1, Property o2)
|
||||
{
|
||||
|
|
|
@ -26,11 +26,11 @@ import java.awt.geom.Path2D;
|
|||
*
|
||||
*<ul>
|
||||
* <li>arcTo</li>
|
||||
* <li>moveTo/li>
|
||||
* <li>lineTo/li>
|
||||
* <li>cubicBezTo/li>
|
||||
* <li>quadBezTo/li>
|
||||
* <li>close/li>
|
||||
* <li>moveTo</li>
|
||||
* <li>lineTo</li>
|
||||
* <li>cubicBezTo</li>
|
||||
* <li>quadBezTo</li>
|
||||
* <li>close</li>
|
||||
* </ul>
|
||||
*/
|
||||
public interface PathCommand {
|
||||
|
|
|
@ -67,11 +67,6 @@ public final class XYAdjustHandle implements AdjustHandle {
|
|||
|
||||
/**
|
||||
* Gets the value of the pos property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CTAdjPoint2D }
|
||||
*
|
||||
*/
|
||||
public AdjustPoint getPos() {
|
||||
return pos;
|
||||
|
@ -79,11 +74,6 @@ public final class XYAdjustHandle implements AdjustHandle {
|
|||
|
||||
/**
|
||||
* Sets the value of the pos property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link CTAdjPoint2D }
|
||||
*
|
||||
*/
|
||||
public void setPos(AdjustPoint value) {
|
||||
this.pos = value;
|
||||
|
|
|
@ -151,7 +151,7 @@ public final class SlideShowFactory {
|
|||
* @return The created SlideShow
|
||||
*
|
||||
* @throws IOException if an error occurs while reading the data
|
||||
* @throws EncryptedDocumentException If the SlideShow<?,?> given is password protected
|
||||
* @throws EncryptedDocumentException If the SlideShow given is password protected
|
||||
*/
|
||||
public static SlideShow<?,?> create(InputStream inp) throws IOException, EncryptedDocumentException {
|
||||
return create(inp, null);
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface TextParagraph<
|
|||
/**
|
||||
* Specifies a list of text alignment types
|
||||
*/
|
||||
public enum TextAlign {
|
||||
enum TextAlign {
|
||||
/**
|
||||
* For horizontal text, left aligned.
|
||||
* For vertical text, top aligned.
|
||||
|
@ -54,22 +54,22 @@ public interface TextParagraph<
|
|||
* Align text so that it is justified across the whole line. It
|
||||
* is smart in the sense that it will not justify sentences
|
||||
* which are short
|
||||
*
|
||||
*
|
||||
* For horizontal text, flush left and right.
|
||||
* For vertical text, flush top and bottom.
|
||||
*/
|
||||
JUSTIFY,
|
||||
|
||||
|
||||
/**
|
||||
* Kashida justify low.
|
||||
*/
|
||||
*/
|
||||
JUSTIFY_LOW,
|
||||
|
||||
/**
|
||||
* Distribute space between characters.
|
||||
*/
|
||||
DIST,
|
||||
|
||||
|
||||
/**
|
||||
* Thai distribution justification.
|
||||
*/
|
||||
|
@ -77,28 +77,28 @@ public interface TextParagraph<
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum FontAlign {
|
||||
enum FontAlign {
|
||||
AUTO,
|
||||
|
||||
|
||||
/**
|
||||
* Characters hang from top of line height.
|
||||
* Also known as "Hanging"
|
||||
*/
|
||||
TOP,
|
||||
|
||||
|
||||
/**
|
||||
* Characters centered within line height.
|
||||
*/
|
||||
CENTER,
|
||||
|
||||
|
||||
/**
|
||||
* Place characters on font baseline.
|
||||
* Also known as "Roman"
|
||||
* Also known as "Roman"
|
||||
*/
|
||||
BASELINE,
|
||||
|
||||
|
||||
/**
|
||||
* Characters are anchored to the very bottom of a single line.
|
||||
* This is different than BASELINE because of letters such as "g", "q", and "y".
|
||||
|
@ -106,15 +106,15 @@ public interface TextParagraph<
|
|||
*/
|
||||
BOTTOM
|
||||
}
|
||||
|
||||
public interface BulletStyle {
|
||||
|
||||
interface BulletStyle {
|
||||
String getBulletCharacter();
|
||||
String getBulletFont();
|
||||
|
||||
|
||||
/**
|
||||
* The bullet point font size
|
||||
* If bulletFontSize >= 0, then space is a percentage of normal line height.
|
||||
* If bulletFontSize < 0, the absolute value in points
|
||||
* If bulletFontSize >= 0, then space is a percentage of normal line height.
|
||||
* If bulletFontSize < 0, the absolute value in points
|
||||
*
|
||||
* @return the bullet point font size
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@ public interface TextParagraph<
|
|||
* Convenience function to set a solid color
|
||||
*/
|
||||
void setBulletFontColor(Color color);
|
||||
|
||||
|
||||
void setBulletFontColor(PaintStyle color);
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,7 @@ public interface TextParagraph<
|
|||
* A {@code null} value means to use the text font color.
|
||||
*/
|
||||
PaintStyle getBulletFontColor();
|
||||
|
||||
|
||||
AutoNumberingScheme getAutoNumberingScheme();
|
||||
/**
|
||||
* Index (1-based) of the first auto number value, or null if auto numbering scheme
|
||||
|
@ -173,8 +173,8 @@ public interface TextParagraph<
|
|||
*
|
||||
* @param spaceBefore the vertical white space before the paragraph, null to unset
|
||||
*/
|
||||
void setSpaceBefore(Double spaceBefore);
|
||||
|
||||
void setSpaceBefore(Double spaceBefore);
|
||||
|
||||
/**
|
||||
* The amount of vertical white space after the paragraph
|
||||
* This may be specified in two different ways, percentage spacing and font point spacing:
|
||||
|
@ -185,7 +185,7 @@ public interface TextParagraph<
|
|||
*
|
||||
* @return the vertical white space after the paragraph or null, if unset
|
||||
*/
|
||||
Double getSpaceAfter();
|
||||
Double getSpaceAfter();
|
||||
|
||||
/**
|
||||
* Set the amount of vertical white space that will be present after the paragraph.
|
||||
|
@ -206,8 +206,8 @@ public interface TextParagraph<
|
|||
*
|
||||
* @param spaceAfter the vertical white space after the paragraph, null to unset
|
||||
*/
|
||||
public void setSpaceAfter(Double spaceAfter);
|
||||
|
||||
void setSpaceAfter(Double spaceAfter);
|
||||
|
||||
/**
|
||||
* @return the left margin (in points) of the paragraph or null, if unset
|
||||
*/
|
||||
|
@ -217,19 +217,19 @@ public interface TextParagraph<
|
|||
* Specifies the left margin of the paragraph. This is specified in addition to the text body
|
||||
* inset and applies only to this text paragraph. That is the text body Inset and the LeftMargin
|
||||
* attributes are additive with respect to the text position.
|
||||
*
|
||||
*
|
||||
* @param leftMargin the left margin (in points) or null to unset
|
||||
*/
|
||||
void setLeftMargin(Double leftMargin);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the right margin of the paragraph. This is specified in addition to the text body
|
||||
* inset and applies only to this text paragraph. That is the text body Inset and the RightMargin
|
||||
* attributes are additive with respect to the text position.
|
||||
*
|
||||
*
|
||||
* The right margin is not support and therefore ignored by the HSLF implementation.
|
||||
*
|
||||
*
|
||||
* @return the right margin (in points) of the paragraph or null, if unset
|
||||
*/
|
||||
Double getRightMargin();
|
||||
|
@ -238,16 +238,16 @@ public interface TextParagraph<
|
|||
* @param rightMargin the right margin (in points) of the paragraph
|
||||
*/
|
||||
void setRightMargin(Double rightMargin);
|
||||
|
||||
|
||||
/**
|
||||
* @return the indent (in points) applied to the first line of text in the paragraph.
|
||||
* or null, if unset
|
||||
*/
|
||||
Double getIndent();
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the indent size that will be applied to the first line of text in the paragraph.
|
||||
*
|
||||
* Specifies the indent size that will be applied to the first line of text in the paragraph.
|
||||
*
|
||||
* @param indent the indent (in points) applied to the first line of text in the paragraph
|
||||
*/
|
||||
void setIndent(Double indent);
|
||||
|
@ -255,7 +255,7 @@ public interface TextParagraph<
|
|||
|
||||
/**
|
||||
* @return the text level of this paragraph (0-based). Default is 0.
|
||||
*/
|
||||
*/
|
||||
int getIndentLevel();
|
||||
|
||||
/**
|
||||
|
@ -266,19 +266,19 @@ public interface TextParagraph<
|
|||
* @param level the level (0 ... 4)
|
||||
*/
|
||||
void setIndentLevel(int level);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the vertical line spacing that is to be used within a paragraph.
|
||||
* This may be specified in two different ways, percentage spacing and font point spacing:
|
||||
* <p>
|
||||
* If linespacing >= 0, then linespacing is a percentage of normal line height.
|
||||
* If linespacing < 0, the absolute value of linespacing is the spacing in points
|
||||
* If linespacing >= 0, then linespacing is a percentage of normal line height.
|
||||
* If linespacing < 0, the absolute value of linespacing is the spacing in points
|
||||
* </p>
|
||||
*
|
||||
* @return the vertical line spacing or null, if unset
|
||||
*/
|
||||
Double getLineSpacing();
|
||||
|
||||
|
||||
/**
|
||||
* This element specifies the vertical line spacing that is to be used within a paragraph.
|
||||
* This may be specified in two different ways, percentage spacing and font point spacing:
|
||||
|
@ -297,18 +297,18 @@ public interface TextParagraph<
|
|||
* // spacing will be 48 points
|
||||
* paragraph.setLineSpacing(-48.0);
|
||||
* </code></pre>
|
||||
*
|
||||
*
|
||||
* @param lineSpacing the vertical line spacing
|
||||
*/
|
||||
void setLineSpacing(Double lineSpacing);
|
||||
|
||||
String getDefaultFontFamily();
|
||||
|
||||
|
||||
/**
|
||||
* @return the default font size, in case its not set in the textrun or null, if unset
|
||||
*/
|
||||
Double getDefaultFontSize();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the alignment that is applied to the paragraph.
|
||||
*
|
||||
|
@ -325,21 +325,21 @@ public interface TextParagraph<
|
|||
* see {@link org.apache.poi.sl.usermodel.TextParagraph.TextAlign}.
|
||||
*
|
||||
* @param align text align
|
||||
*/
|
||||
*/
|
||||
void setTextAlign(TextAlign align);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the font alignment that is applied to the paragraph.
|
||||
*
|
||||
* If this attribute is omitted, then null is return,
|
||||
* user code can imply the a value of {@link FontAlign#AUTO}
|
||||
*
|
||||
*
|
||||
* @return alignment that is applied to the paragraph
|
||||
*/
|
||||
FontAlign getFontAlign();
|
||||
|
||||
|
||||
/**
|
||||
* @return the bullet style of the paragraph, if {@code null} then no bullets are used
|
||||
* @return the bullet style of the paragraph, if {@code null} then no bullets are used
|
||||
*/
|
||||
BulletStyle getBulletStyle();
|
||||
|
||||
|
@ -347,19 +347,17 @@ public interface TextParagraph<
|
|||
* Sets the bullet styles. If no styles are given, the bullets are omitted.
|
||||
* Possible attributes are integer/double (bullet size), Color (bullet color),
|
||||
* character (bullet character), string (bullet font), AutoNumberingScheme
|
||||
*
|
||||
* @param styles
|
||||
*/
|
||||
void setBulletStyle(Object... styles);
|
||||
|
||||
|
||||
/**
|
||||
* @return the default size for a tab character within this paragraph in points, null if unset
|
||||
*/
|
||||
Double getDefaultTabSize();
|
||||
|
||||
|
||||
|
||||
TextShape<S,P> getParentShape();
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the text runs that are contained within this block of text
|
||||
*/
|
||||
|
@ -368,14 +366,14 @@ public interface TextParagraph<
|
|||
/**
|
||||
* Convenience method to determine if this text paragraph is part of
|
||||
* the slide header or footer
|
||||
*
|
||||
*
|
||||
* @return true if this paragraph is part of a header or footer placeholder
|
||||
*
|
||||
*
|
||||
* @since POI 3.15-beta2
|
||||
*/
|
||||
boolean isHeaderOrFooter();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the {@link TabStop TabStops} - the list can't be and it's entries shouldn't be modified.
|
||||
* Opposed to other properties, this method is not cascading to the master sheet,
|
||||
|
@ -383,7 +381,7 @@ public interface TextParagraph<
|
|||
* different levels aren't merged.
|
||||
*
|
||||
* @return the tabstop collection or {@code null} if no tabstops are defined
|
||||
*
|
||||
*
|
||||
* @since POI 4.0.0
|
||||
*/
|
||||
List<? extends TabStop> getTabStops();
|
||||
|
@ -391,8 +389,6 @@ public interface TextParagraph<
|
|||
/**
|
||||
* Set the {@link TabStop} collection
|
||||
*
|
||||
* @param tabStops the {@link TabStop} collection
|
||||
*
|
||||
* @since POI 4.0.0
|
||||
*/
|
||||
void addTabStops(double positionInPoints, TabStop.TabStopType tabStopType);
|
||||
|
@ -400,7 +396,7 @@ public interface TextParagraph<
|
|||
/**
|
||||
* Removes the tabstops of this paragraphs.
|
||||
* This doesn't affect inherited tabstops, e.g. inherited by the slide master
|
||||
*
|
||||
*
|
||||
* @since POI 4.0.0
|
||||
*/
|
||||
void clearTabStops();
|
||||
|
|
|
@ -49,11 +49,11 @@ public abstract class CellFormatCondition {
|
|||
/**
|
||||
* Returns an instance of a condition object.
|
||||
*
|
||||
* @param opString The operator as a string. One of <tt>"<"</tt>,
|
||||
* <tt>"<="</tt>, <tt>">"</tt>, <tt>">="</tt>,
|
||||
* <tt>"="</tt>, <tt>"=="</tt>, <tt>"!="</tt>, or
|
||||
* <tt>"<>"</tt>.
|
||||
* @param constStr The constant (such as <tt>"12"</tt>).
|
||||
* @param opString The operator as a string. One of {@code <},
|
||||
* {@code <=}, {@code >}, {@code >=},
|
||||
* {@code =}, {@code ==}, {@code !=} or
|
||||
* {@code <>}.
|
||||
* @param constStr The constant (such as {@code 12}).
|
||||
*
|
||||
* @return A condition object for the given condition.
|
||||
*/
|
||||
|
|
|
@ -38,15 +38,13 @@ import static org.apache.poi.ss.format.CellFormatter.quote;
|
|||
* values.
|
||||
* <p>
|
||||
* Each format part can contain a color, a condition, and will always contain a
|
||||
* format specification. For example <tt>"[Red][>=10]#"</tt> has a color
|
||||
* (<tt>[Red]</tt>), a condition (<tt>>=10</tt>) and a format specification
|
||||
* (<tt>#</tt>).
|
||||
* format specification. For example {@code "[Red][>=10]#"} has a color
|
||||
* ({@code [Red]}), a condition ({@code >=10}) and a format specification
|
||||
* ({@code #}).
|
||||
* <p>
|
||||
* This class also contains patterns for matching the subparts of format
|
||||
* specification. These are used internally, but are made public in case other
|
||||
* code has use for them.
|
||||
*
|
||||
* @author Ken Arnold, Industrious Media LLC
|
||||
*/
|
||||
public class CellFormatPart {
|
||||
private static final Logger LOG = Logger.getLogger(CellFormat.class.getName());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class SimpleFraction {
|
|||
private final int numerator;
|
||||
/**
|
||||
* Create a fraction given a double value and a denominator.
|
||||
*
|
||||
*
|
||||
* @param val double value of fraction
|
||||
* @param exactDenom the exact denominator
|
||||
* @return a SimpleFraction with the given values set.
|
||||
|
@ -35,17 +35,17 @@ public class SimpleFraction {
|
|||
int num = (int)Math.round(val*exactDenom);
|
||||
return new SimpleFraction(num,exactDenom);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a fraction given the double value and either the maximum error
|
||||
* allowed or the maximum number of denominator digits.
|
||||
*
|
||||
* @param value the double value to convert to a fraction.
|
||||
* @param maxDenominator maximum denominator value allowed.
|
||||
*
|
||||
*
|
||||
* @throws RuntimeException if the continued fraction failed to
|
||||
* converge.
|
||||
* @throws IllegalArgumentException if value > Integer.MAX_VALUE
|
||||
* @throws IllegalArgumentException if value > Integer.MAX_VALUE
|
||||
*/
|
||||
public static SimpleFraction buildFractionMaxDenominator(double value, int maxDenominator){
|
||||
return buildFractionMaxDenominator(value, 0, maxDenominator, 100);
|
||||
|
|
|
@ -21,9 +21,9 @@ package org.apache.poi.ss.formula.eval;
|
|||
* This class is used to simplify error handling logic <i>within</i> operator and function
|
||||
* implementations. Note - <tt>OperationEval.evaluate()</tt> and <tt>Function.evaluate()</tt>
|
||||
* method signatures do not throw this exception so it cannot propagate outside.<p>
|
||||
*
|
||||
*
|
||||
* Here is an example coded without <tt>EvaluationException</tt>, to show how it can help:
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* public Eval evaluate(Eval[] args, int srcRow, short srcCol) {
|
||||
* // ...
|
||||
* Eval arg0 = args[0];
|
||||
|
@ -47,14 +47,14 @@ package org.apache.poi.ss.formula.eval;
|
|||
* temp += ((NumericValueEval)ve).getNumberValue();
|
||||
* }
|
||||
* // ...
|
||||
* }
|
||||
* </pre>
|
||||
* In this example, if any error is encountered while processing the arguments, an error is
|
||||
* }
|
||||
* }</pre>
|
||||
* In this example, if any error is encountered while processing the arguments, an error is
|
||||
* returned immediately. This code is difficult to refactor due to all the points where errors
|
||||
* are returned.<br>
|
||||
* Using <tt>EvaluationException</tt> allows the error returning code to be consolidated to one
|
||||
* place.<p>
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* public Eval evaluate(Eval[] args, int srcRow, short srcCol) {
|
||||
* try {
|
||||
* // ...
|
||||
|
@ -90,21 +90,21 @@ package org.apache.poi.ss.formula.eval;
|
|||
* }
|
||||
* return temp;
|
||||
*}
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* It is not mandatory to use EvaluationException, doing so might give the following advantages:<br>
|
||||
* - Methods can more easily be extracted, allowing for re-use.<br>
|
||||
* - Type management (typecasting etc) is simpler because error conditions have been separated from
|
||||
* intermediate calculation values.<br>
|
||||
* - Fewer local variables are required. Local variables can have stronger types.<br>
|
||||
* - It is easier to mimic common Excel error handling behaviour (exit upon encountering first
|
||||
* error), because exceptions conveniently propagate up the call stack regardless of execution
|
||||
* - It is easier to mimic common Excel error handling behaviour (exit upon encountering first
|
||||
* error), because exceptions conveniently propagate up the call stack regardless of execution
|
||||
* points or the number of levels of nested calls.<p>
|
||||
*
|
||||
*
|
||||
* <b>Note</b> - Only standard evaluation errors are represented by <tt>EvaluationException</tt> (
|
||||
* i.e. conditions expected to be encountered when evaluating arbitrary Excel formulas). Conditions
|
||||
* that could never occur in an Excel spreadsheet should result in runtime exceptions. Care should
|
||||
* be taken to not translate any POI internal error into an Excel evaluation error code.
|
||||
*
|
||||
* be taken to not translate any POI internal error into an Excel evaluation error code.
|
||||
*
|
||||
* @author Josh Micich
|
||||
*/
|
||||
public final class EvaluationException extends Exception {
|
||||
|
@ -127,7 +127,7 @@ public final class EvaluationException extends Exception {
|
|||
public static EvaluationException numberError() {
|
||||
return new EvaluationException(ErrorEval.NUM_ERROR);
|
||||
}
|
||||
|
||||
|
||||
public ErrorEval getErrorEval() {
|
||||
return _errorEval;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class RelationalOperationEval extends Fixed2ArgFunction implemen
|
|||
*
|
||||
* Blank > Negative numbers
|
||||
* Blank == 0
|
||||
* Blank < Positive numbers
|
||||
* Blank < Positive numbers
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
|
|
@ -32,10 +32,11 @@ public class Countifs extends Baseifs {
|
|||
public static final FreeRefFunction instance = new Countifs();
|
||||
|
||||
/**
|
||||
* https://support.office.com/en-us/article/COUNTIFS-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842?ui=en-US&rs=en-US&ad=US
|
||||
* COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]...)
|
||||
* need at least 2 arguments and need to have an even number of arguments (criteria_range1, criteria1 plus x*(criteria_range, criteria))
|
||||
*
|
||||
* @see org.apache.poi.ss.formula.functions.Baseifs#hasInitialRange()
|
||||
* @see <a href="https://support.microsoft.com/en-us/office/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842">COUNTIFS function</a>
|
||||
*/
|
||||
protected boolean hasInitialRange() {
|
||||
return false;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.poi.ss.formula.eval.StringEval;
|
|||
import org.apache.poi.ss.formula.eval.ValueEval;
|
||||
|
||||
/**
|
||||
* Implementation for Excel Bin2Dec() function.<p>
|
||||
* Implementation for Excel Bin2Dec() function.
|
||||
* <p>
|
||||
* <b>Syntax</b>:<br> <b>Bin2Dec </b>(<b>number</b>,<b>[places]</b> )<br>
|
||||
* <p>
|
||||
|
@ -38,7 +38,7 @@ import org.apache.poi.ss.formula.eval.ValueEval;
|
|||
* <p>
|
||||
* Remarks
|
||||
* <ul>
|
||||
* <li>If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value.</li>
|
||||
* <li>If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value.</li>
|
||||
* <li>If number is nonnumeric, DEC2BIN returns the #VALUE! error value.</li>
|
||||
* <li>If DEC2BIN requires more than places characters, it returns the #NUM! error value.</li>
|
||||
* <li>If places is not an integer, it is truncated.</li>
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.poi.ss.formula.OperationEvaluationContext;
|
|||
import org.apache.poi.ss.formula.eval.*;
|
||||
|
||||
/**
|
||||
* Implementation for Excel DELTA() function.<p>
|
||||
* Implementation for Excel DELTA() function.
|
||||
* <p>
|
||||
* <b>Syntax</b>:<br> <b>DEC2HEX </b>(<b>number</b>,<b>places</b> )<br>
|
||||
* <p>
|
||||
|
@ -35,11 +35,11 @@ import org.apache.poi.ss.formula.eval.*;
|
|||
* Negative numbers are represented using two's-complement notation.
|
||||
*
|
||||
* <ul>
|
||||
* <li>If number < -549,755,813,888 or if number > 549,755,813,887, this function returns the #NUM! error value.</li>
|
||||
* <li>If number < -549,755,813,888 or if number > 549,755,813,887, this function returns the #NUM! error value.</li>
|
||||
* <li>If number is nonnumeric, this function returns the #VALUE! error value.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h2>places</h2>
|
||||
* Places<P>
|
||||
*
|
||||
* The number of characters to use. The places argument is useful for padding the
|
||||
* return value with leading 0s (zeros).
|
||||
|
|
|
@ -33,13 +33,16 @@ package org.apache.poi.ss.formula.functions;
|
|||
* </ul>
|
||||
* For more info on the terms/abbreviations please use the references below
|
||||
* (hyperlinks are subject to change):
|
||||
* </br>Online References:
|
||||
* <p>
|
||||
* Online References:
|
||||
* <ol>
|
||||
* <li>GNU Emacs Calc 2.02 Manual: http://theory.uwinnipeg.ca/gnu/calc/calc_203.html</li>
|
||||
* <li>Yahoo Financial Glossary: http://biz.yahoo.com/f/g/nn.html#y</li>
|
||||
* <li>MS Excel function reference: http://office.microsoft.com/en-us/assistance/CH062528251033.aspx</li>
|
||||
* </ol>
|
||||
* <h3>Implementation Notes:</h3>
|
||||
*
|
||||
* Implementation Notes:<p>
|
||||
*
|
||||
* Symbols used in the formulae that follow:<br>
|
||||
* <ul>
|
||||
* <li>p: present value</li>
|
||||
|
@ -66,7 +69,7 @@ public final class FinanceLib {
|
|||
* Future value of an amount given the number of payments, rate, amount
|
||||
* of individual payment, present value and boolean value indicating whether
|
||||
* payments are due at the beginning of period
|
||||
* (false => payments are due at end of period)
|
||||
* (false => payments are due at end of period)
|
||||
* @param r rate
|
||||
* @param n num of periods
|
||||
* @param y pmt per period
|
||||
|
@ -88,7 +91,7 @@ public final class FinanceLib {
|
|||
* Present value of an amount given the number of future payments, rate, amount
|
||||
* of individual payment, future value and boolean value indicating whether
|
||||
* payments are due at the beginning of period
|
||||
* (false => payments are due at end of period)
|
||||
* (false => payments are due at end of period)
|
||||
* @param r rate
|
||||
* @param n num of periods
|
||||
* @param y pmt per period
|
||||
|
|
|
@ -18,12 +18,15 @@
|
|||
package org.apache.poi.ss.formula.functions;
|
||||
|
||||
import org.apache.poi.ss.formula.eval.ValueEval;
|
||||
import org.apache.poi.util.Removal;
|
||||
|
||||
/**
|
||||
* Implemented by all functions that can be called with zero arguments
|
||||
*
|
||||
* @author Josh Micich
|
||||
* @deprecated replaced by lambda expressions in 5.0.1
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "6.0.0")
|
||||
public interface Function0Arg extends Function {
|
||||
/**
|
||||
* see {@link Function#evaluate(ValueEval[], int, int)}
|
||||
|
|
|
@ -73,7 +73,7 @@ public final class Irr implements Function {
|
|||
* <p>
|
||||
* Starting with the guess, the method cycles through the calculation until the result
|
||||
* is accurate within 0.00001 percent. If IRR can't find a result that works
|
||||
* after 20 tries, the Double.NaN<> is returned.
|
||||
* after 20 tries, the {@code Double.NaN} is returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* The implementation is inspired by the NewtonSolver from the Apache Commons-Math library,
|
||||
|
@ -82,7 +82,7 @@ public final class Irr implements Function {
|
|||
*
|
||||
* @param values the income values.
|
||||
* @param guess the initial guess of irr.
|
||||
* @return the irr value. The method returns <code>Double.NaN</code>
|
||||
* @return the irr value. The method returns {@code Double.NaN}
|
||||
* if the maximum iteration count is exceeded
|
||||
*
|
||||
* @see <a href="http://en.wikipedia.org/wiki/Internal_rate_of_return#Numerical_solution">
|
||||
|
|
|
@ -32,17 +32,15 @@ import org.apache.poi.ss.formula.TwoDEval;
|
|||
* <b>VLOOKUP</b>(<b>lookup_value</b>, <b>lookup_vector</b>, result_vector)<p>
|
||||
*
|
||||
* <b>lookup_value</b> The value to be found in the lookup vector.<br>
|
||||
* <b>lookup_vector</> An area reference for the lookup data. <br>
|
||||
* <b>lookup_vector</b> An area reference for the lookup data. <br>
|
||||
* <b>result_vector</b> Single row or single column area reference from which the result value is chosen.<br>
|
||||
*
|
||||
* @author Josh Micich
|
||||
*/
|
||||
public final class Lookup extends Var2or3ArgFunction {
|
||||
|
||||
@Override
|
||||
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
|
||||
// complex rules to choose lookupVector and resultVector from the single area ref
|
||||
|
||||
|
||||
try {
|
||||
/*
|
||||
The array form of LOOKUP is very similar to the HLOOKUP and VLOOKUP functions. The difference is that HLOOKUP searches for the value of lookup_value in the first row, VLOOKUP searches in the first column, and LOOKUP searches according to the dimensions of array.
|
||||
|
@ -54,7 +52,7 @@ public final class Lookup extends Var2or3ArgFunction {
|
|||
TwoDEval lookupArray = LookupUtils.resolveTableArrayArg(arg1);
|
||||
ValueVector lookupVector;
|
||||
ValueVector resultVector;
|
||||
|
||||
|
||||
if (lookupArray.getWidth() > lookupArray.getHeight()) {
|
||||
// If array covers an area that is wider than it is tall (more columns than rows), LOOKUP searches for the value of lookup_value in the first row.
|
||||
lookupVector = createVector(lookupArray.getRow(0));
|
||||
|
@ -66,7 +64,7 @@ public final class Lookup extends Var2or3ArgFunction {
|
|||
}
|
||||
// if a rectangular area reference was passed in as arg1, lookupVector and resultVector should be the same size
|
||||
assert (lookupVector.getSize() == resultVector.getSize());
|
||||
|
||||
|
||||
int index = LookupUtils.lookupIndexOfValue(lookupValue, lookupVector, true);
|
||||
return resultVector.getItem(index);
|
||||
} catch (final EvaluationException e) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class NumericFunction implements Function {
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</> or <tt>Infinity</tt>
|
||||
* @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</tt> or <tt>Infinity</tt>
|
||||
*/
|
||||
public static void checkValue(double result) throws EvaluationException {
|
||||
if (Double.isNaN(result) || Double.isInfinite(result)) {
|
||||
|
@ -392,7 +392,7 @@ public abstract class NumericFunction implements Function {
|
|||
public static final Function POISSON = new Fixed3ArgFunction() {
|
||||
|
||||
private static final double DEFAULT_RETURN_RESULT =1;
|
||||
|
||||
|
||||
/**
|
||||
* This checks is x = 0 and the mean = 0.
|
||||
* Excel currently returns the value 1 where as the
|
||||
|
@ -417,7 +417,7 @@ public abstract class NumericFunction implements Function {
|
|||
if (aDouble < 0) {
|
||||
throw new EvaluationException(ErrorEval.NUM_ERROR);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ public abstract class NumericFunction implements Function {
|
|||
// check for default result : excel implementation for 0,0
|
||||
// is different to Math Common.
|
||||
if (isDefaultResult(x,mean)) {
|
||||
return new NumberEval(DEFAULT_RETURN_RESULT);
|
||||
return new NumberEval(DEFAULT_RETURN_RESULT);
|
||||
}
|
||||
// check the arguments : as per excel function def
|
||||
checkArgument(x);
|
||||
|
@ -485,7 +485,7 @@ public abstract class NumericFunction implements Function {
|
|||
} catch (EvaluationException e) {
|
||||
return e.getErrorEval();
|
||||
}
|
||||
|
||||
|
||||
return new NumberEval(result);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ package org.apache.poi.ss.formula.functions;
|
|||
/**
|
||||
* Implementation for the Excel function SUMIFS<p>
|
||||
*
|
||||
* Syntax : <br>
|
||||
* SUMIFS ( <b>sum_range</b>, <b>criteria_range1</b>, <b>criteria1</>,
|
||||
* [<b>criteria_range2</b>, <b>criteria2</b>], ...) <br>
|
||||
* Syntax : <p>
|
||||
* SUMIFS ( <b>sum_range</b>, <b>criteria_range1</b>, <b>criteria1</b>,
|
||||
* [<b>criteria_range2</b>, <b>criteria2</b>], ...)
|
||||
* <ul>
|
||||
* <li><b>sum_range</b> Required. One or more cells to sum, including numbers or names, ranges,
|
||||
* or cell references that contain numbers. Blank and text values are ignored.</li>
|
||||
|
@ -36,8 +36,6 @@ package org.apache.poi.ss.formula.functions;
|
|||
* <li><b> criteria_range2, criteria2, ...</b> Optional. Additional ranges and their associated criteria.
|
||||
* Up to 127 range/criteria pairs are allowed.
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final class Sumifs extends Baseifs {
|
||||
/**
|
||||
|
@ -49,7 +47,6 @@ public final class Sumifs extends Baseifs {
|
|||
* https://support.office.com/en-us/article/SUMIFS-function-c9e748f5-7ea7-455d-9406-611cebce642b
|
||||
* COUNTIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...
|
||||
* need at least 3 arguments and need to have an odd number of arguments (sum-range plus x*(criteria_range, criteria))
|
||||
* @see org.apache.poi.ss.formula.functions.Baseifs#hasInitialRange()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasInitialRange() {
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.poi.ss.formula.ptg;
|
|||
|
||||
|
||||
/**
|
||||
* Greater than operator PTG ">"
|
||||
* Greater than operator PTG ">"
|
||||
*/
|
||||
public final class GreaterThanPtg extends ValueOperatorPtg {
|
||||
public static final byte sid = 0x0D;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.apache.poi.ss.formula.ptg;
|
||||
|
||||
/**
|
||||
* Less than operator PTG "<". The SID is taken from the
|
||||
* Less than operator PTG "<". The SID is taken from the
|
||||
* Openoffice.orgs Documentation of the Excel File Format,
|
||||
* Table 3.5.7
|
||||
*/
|
||||
|
|
|
@ -20,18 +20,18 @@ package org.apache.poi.ss.usermodel;
|
|||
/**
|
||||
* Interface for classes providing differential style definitions, such as conditional format rules
|
||||
* and table/pivot table styles.
|
||||
*
|
||||
*
|
||||
* @since 3.17 beta 1
|
||||
*/
|
||||
public interface DifferentialStyleProvider {
|
||||
|
||||
/**
|
||||
* @return - border formatting object if defined, <code>null</code> otherwise
|
||||
* @return - border formatting object if defined, {@code null} otherwise
|
||||
*/
|
||||
BorderFormatting getBorderFormatting();
|
||||
|
||||
/**
|
||||
* @return - font formatting object if defined, <code>null</code> otherwise
|
||||
* @return - font formatting object if defined, {@code null} otherwise
|
||||
*/
|
||||
FontFormatting getFontFormatting();
|
||||
|
||||
|
@ -42,15 +42,15 @@ public interface DifferentialStyleProvider {
|
|||
ExcelNumberFormat getNumberFormat();
|
||||
|
||||
/**
|
||||
* @return - pattern formatting object if defined, <code>null</code> otherwise
|
||||
* @return - pattern formatting object if defined, {@code null} otherwise
|
||||
*/
|
||||
PatternFormatting getPatternFormatting();
|
||||
|
||||
/**
|
||||
* This is the number of rows or columns in a band or stripe.
|
||||
* For styles that represent stripes, it must be > 1, for all others it is 0.
|
||||
* For styles that represent stripes, it must be > 1, for all others it is 0.
|
||||
* Not the greatest overloading by the OOXML spec.
|
||||
* @return number of rows/columns in a stripe for stripe styles, 0 for all others
|
||||
* @return number of rows/columns in a stripe for stripe styles, 0 for all others
|
||||
*/
|
||||
int getStripeSize();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ package org.apache.poi.ss.usermodel;
|
|||
* When a font definition is part of a theme definition, then the font is categorized as either a major or minor font scheme component.
|
||||
* When a new theme is chosen, every font that is part of a theme definition is updated to use the new major or minor font definition for that
|
||||
* theme.
|
||||
* Usually major fonts are used for styles like headings, and minor fonts are used for body & paragraph text.
|
||||
* Usually major fonts are used for styles like headings, and minor fonts are used for body & paragraph text.
|
||||
*
|
||||
* @author Gisella Bronzetti
|
||||
*/
|
||||
|
@ -34,9 +34,9 @@ public enum FontScheme {
|
|||
MAJOR(2),
|
||||
MINOR(3);
|
||||
|
||||
private int value;
|
||||
private final int value;
|
||||
|
||||
private FontScheme(int val) {
|
||||
FontScheme(int val) {
|
||||
value = val;
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,9 @@ public enum FontScheme {
|
|||
return value;
|
||||
}
|
||||
|
||||
private static FontScheme[] _table = new FontScheme[4];
|
||||
static {
|
||||
for (FontScheme c : values()) {
|
||||
_table[c.getValue()] = c;
|
||||
}
|
||||
}
|
||||
private static final FontScheme[] _table = {
|
||||
null, NONE, MAJOR, MINOR
|
||||
};
|
||||
|
||||
public static FontScheme valueOf(int value){
|
||||
return _table[value];
|
||||
|
|
|
@ -24,13 +24,13 @@ import java.util.HashMap;
|
|||
|
||||
/**
|
||||
* Enumerates error values in SpreadsheetML formula calculations.
|
||||
*
|
||||
*
|
||||
* See also OOO's excelfileformat.pdf (2.5.6)
|
||||
*/
|
||||
public enum FormulaError {
|
||||
@Internal
|
||||
_NO_ERROR(-1, "(no error)"),
|
||||
|
||||
|
||||
/**
|
||||
* Intended to indicate when two areas are required to intersect, but do not.
|
||||
* <p>Example:
|
||||
|
@ -68,10 +68,12 @@ public enum FormulaError {
|
|||
/**
|
||||
* Intended to indicate when what looks like a name is used, but no such name has been defined.
|
||||
* <p>Example:
|
||||
* XYZ/3, where XYZ is not a defined name. Total is & A10,
|
||||
* where neither Total nor is is a defined name. Presumably, "Total is " & A10
|
||||
* was intended. SUM(A1C10), where the range A1:C10 was intended.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>XYZ/3, where XYZ is not a defined name.</li>
|
||||
* <li>{@code Total is & A10}, where neither {@code Total} nor {@code is} is a defined name.
|
||||
* Presumably, {@code "Total is " & A10} was intended.</li>
|
||||
* <li>SUM(A1C10), where the range A1:C10 was intended.</li>
|
||||
* </ul>
|
||||
*/
|
||||
NAME(0x1D, "#NAME?"),
|
||||
|
||||
|
@ -100,12 +102,12 @@ public enum FormulaError {
|
|||
* This error value can be produced by calling the function NA
|
||||
*/
|
||||
NA(0x2A, "#N/A"),
|
||||
|
||||
|
||||
// These are POI-specific error codes
|
||||
// It is desirable to make these (arbitrary) strings look clearly different from any other
|
||||
// value expression that might appear in a formula. In addition these error strings should
|
||||
// look unlike the standard Excel errors. Hence tilde ('~') was used.
|
||||
|
||||
|
||||
/**
|
||||
* POI specific code to indicate that there is a circular reference
|
||||
* in the formula
|
||||
|
@ -157,7 +159,7 @@ public enum FormulaError {
|
|||
smap.put(error.getString(), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValidCode(int errorCode) {
|
||||
for (FormulaError error : values()) {
|
||||
if (error.getCode() == errorCode) return true;
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.apache.poi.ss.usermodel;
|
|||
* cell reference, constant or a formula.
|
||||
* </p>
|
||||
* Examples:
|
||||
* <pre><blockquote>
|
||||
* <pre>{@code
|
||||
* Sheet sheet = workbook.createSheet("Loan Calculator");
|
||||
* Name name;
|
||||
*
|
||||
|
@ -46,9 +46,9 @@ package org.apache.poi.ss.usermodel;
|
|||
*
|
||||
* name = wb.createName();
|
||||
* name.setNameName("Values_Entered");
|
||||
* name.setRefersToFormula("IF(Loan_Amount*Interest_Rate>0,1,0)");
|
||||
* name.setRefersToFormula("IF(Loan_Amount*Interest_Rate > 0,1,0)");
|
||||
*
|
||||
* </blockquote></pre>
|
||||
* }</pre>
|
||||
*/
|
||||
public interface Name {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public interface Table {
|
|||
* </a>
|
||||
*/
|
||||
Pattern isStructuredReference = Pattern.compile("[a-zA-Z_\\\\][a-zA-Z0-9._]*\\[.*\\]");
|
||||
|
||||
|
||||
/**
|
||||
* Get the top-left column index relative to the sheet
|
||||
* @return table start column index on sheet
|
||||
|
@ -60,16 +60,16 @@ public interface Table {
|
|||
* @return table name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
|
||||
/**
|
||||
* @return name of the table style, if there is one. May be a built-in name or user-defined.
|
||||
* @since 3.17 beta 1
|
||||
*/
|
||||
String getStyleName();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the index of a given named column in the table (names are case insensitive in XSSF).
|
||||
* Note this list is lazily loaded and cached for performance.
|
||||
* Note this list is lazily loaded and cached for performance.
|
||||
* Changes to the underlying table structure are not reflected in later calls
|
||||
* unless <code>XSSFTable.updateHeaders()</code> is called to reset the cache.
|
||||
* @param columnHeader the column header name to get the table column index of
|
||||
|
@ -85,34 +85,34 @@ public interface Table {
|
|||
/**
|
||||
* Note: This is misleading. The OOXML spec indicates this is true if the totals row
|
||||
* has <b><i>ever</i></b> been shown, not whether or not it is currently displayed.
|
||||
* Use {@link #getTotalsRowCount()} > 0 to decide whether or not the totals row is visible.
|
||||
* Use {@link #getTotalsRowCount()} > 0 to decide whether or not the totals row is visible.
|
||||
* @return true if a totals row has ever been shown for this table
|
||||
* @since 3.15 beta 2
|
||||
* @see #getTotalsRowCount()
|
||||
*/
|
||||
boolean isHasTotalsRow();
|
||||
|
||||
|
||||
/**
|
||||
* @return 0 for no totals rows, 1 for totals row shown.
|
||||
* Values > 1 are not currently used by Excel up through 2016, and the OOXML spec
|
||||
* Values > 1 are not currently used by Excel up through 2016, and the OOXML spec
|
||||
* doesn't define how they would be implemented.
|
||||
* @since 3.17 beta 1
|
||||
*/
|
||||
int getTotalsRowCount();
|
||||
|
||||
|
||||
/**
|
||||
* @return 0 for no header rows, 1 for table headers shown.
|
||||
* Values > 1 might be used by Excel for pivot tables?
|
||||
* Values > 1 might be used by Excel for pivot tables?
|
||||
* @since 3.17 beta 1
|
||||
*/
|
||||
int getHeaderRowCount();
|
||||
|
||||
|
||||
/**
|
||||
* @return TableStyleInfo for this instance
|
||||
* @since 3.17 beta 1
|
||||
*/
|
||||
TableStyleInfo getStyle();
|
||||
|
||||
|
||||
/**
|
||||
* checks if the given cell is part of the table. Includes checking that they are on the same sheet.
|
||||
* @param cell
|
||||
|
@ -124,7 +124,7 @@ public interface Table {
|
|||
if (cell == null) return false;
|
||||
return contains(new CellReference(cell.getSheet().getSheetName(), cell.getRowIndex(), cell.getColumnIndex(), true, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checks if the given cell is part of the table. Includes checking that they are on the same sheet.
|
||||
* @param cell reference to a possibly undefined cell location
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Utility class that builds on {@link CellRangeAddress}
|
||||
*
|
||||
*
|
||||
* Portions of this class may be moved to {@link CellRangeAddressBase}
|
||||
*/
|
||||
public final class CellRangeUtil {
|
||||
|
@ -40,12 +40,12 @@ public final class CellRangeUtil {
|
|||
|
||||
/**
|
||||
* Get the type of intersection between two cell ranges
|
||||
*
|
||||
*
|
||||
* @param crB - the specified range
|
||||
* @return code which reflects how the specified range is related to this range.<br>
|
||||
* Possible return codes are:
|
||||
* <ul>
|
||||
* <li>{@link #NO_INTERSECTION} - the specified range is outside of this range;</li>
|
||||
* <li>{@link #NO_INTERSECTION} - the specified range is outside of this range;</li>
|
||||
* <li>{@link #OVERLAP} - both ranges partially overlap</li>
|
||||
* <li>{@link #INSIDE} - the specified range is inside of this one</li>
|
||||
* <li>{@link #ENCLOSES} - the specified range encloses (possibly exactly the same as) this range</li>
|
||||
|
@ -60,9 +60,9 @@ public final class CellRangeUtil {
|
|||
int firstCol = crB.getFirstColumn();
|
||||
int lastCol = crB.getLastColumn();
|
||||
|
||||
if (
|
||||
if (
|
||||
gt(crA.getFirstRow(), lastRow) || lt(crA.getLastRow(), firstRow) ||
|
||||
gt(crA.getFirstColumn(), lastCol) || lt(crA.getLastColumn(), firstCol)
|
||||
gt(crA.getFirstColumn(), lastCol) || lt(crA.getLastColumn(), firstCol)
|
||||
)
|
||||
{
|
||||
return NO_INTERSECTION;
|
||||
|
@ -145,12 +145,12 @@ public final class CellRangeUtil {
|
|||
int x = intersect(range1, range2);
|
||||
switch(x)
|
||||
{
|
||||
case CellRangeUtil.NO_INTERSECTION:
|
||||
// nothing in common: at most they could be adjacent to each other and thus form a single bigger area
|
||||
case CellRangeUtil.NO_INTERSECTION:
|
||||
// nothing in common: at most they could be adjacent to each other and thus form a single bigger area
|
||||
if(hasExactSharedBorder(range1, range2)) {
|
||||
return new CellRangeAddress[] { createEnclosingCellRange(range1, range2), };
|
||||
}
|
||||
// else - No intersection and no shared border: do nothing
|
||||
// else - No intersection and no shared border: do nothing
|
||||
return null;
|
||||
case CellRangeUtil.OVERLAP:
|
||||
// commented out the cells overlap implementation, it caused endless loops, see Bug 55380
|
||||
|
@ -179,10 +179,10 @@ public final class CellRangeUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if cell range A contains cell range B (B <= A)
|
||||
*
|
||||
* Check if cell range A contains cell range B (B <= A)
|
||||
*
|
||||
* TODO: move this into {@link CellRangeAddressBase}
|
||||
*
|
||||
*
|
||||
* @param crA cell range A
|
||||
* @param crB cell range B
|
||||
* @return true if cell range A contains cell range B
|
||||
|
@ -197,7 +197,7 @@ public final class CellRangeUtil {
|
|||
|
||||
/**
|
||||
* Check if the two cell ranges have a shared border.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if the ranges have a complete shared border (i.e.
|
||||
* the two ranges together make a simple rectangular region.
|
||||
*/
|
||||
|
@ -207,7 +207,7 @@ public final class CellRangeUtil {
|
|||
int oFirstCol = crB.getFirstColumn();
|
||||
int oLastCol = crB.getLastColumn();
|
||||
|
||||
if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow ||
|
||||
if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow ||
|
||||
oFirstRow > 0 && oFirstRow-1 == crA.getLastRow()) {
|
||||
// ranges have a horizontal border in common
|
||||
// make sure columns are identical:
|
||||
|
@ -225,14 +225,14 @@ public final class CellRangeUtil {
|
|||
|
||||
/**
|
||||
* Create an enclosing CellRange for the two cell ranges.
|
||||
*
|
||||
*
|
||||
* @return enclosing CellRange
|
||||
*/
|
||||
public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) {
|
||||
if( crB == null) {
|
||||
return crA.copy();
|
||||
}
|
||||
|
||||
|
||||
int minRow = lt(crB.getFirstRow(), crA.getFirstRow()) ?crB.getFirstRow() :crA.getFirstRow();
|
||||
int maxRow = gt(crB.getLastRow(), crA.getLastRow()) ?crB.getLastRow() :crA.getLastRow();
|
||||
int minCol = lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn();
|
||||
|
|
|
@ -58,7 +58,7 @@ public final class IOUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* If this value is set to > 0, {@link #safelyAllocate(long, int)} will ignore the
|
||||
* If this value is set to > 0, {@link #safelyAllocate(long, int)} will ignore the
|
||||
* maximum record length parameter.
|
||||
*
|
||||
* This is designed to allow users to bypass the hard-coded maximum record lengths
|
||||
|
|
|
@ -85,7 +85,7 @@ public class IntList
|
|||
* @param value the new value
|
||||
*
|
||||
* @exception IndexOutOfBoundsException if the index is out of
|
||||
* range (index < 0 || index > size()).
|
||||
* range (index < 0 || index > size()).
|
||||
*/
|
||||
|
||||
public void add(final int index, final int value)
|
||||
|
@ -179,7 +179,7 @@ public class IntList
|
|||
* @return true if this list changed as a result of the call.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException if the index is out of
|
||||
* range (index < 0 || index > size())
|
||||
* range (index < 0 || index > size())
|
||||
*/
|
||||
|
||||
public boolean addAll(final int index, final IntList c)
|
||||
|
@ -312,7 +312,7 @@ public class IntList
|
|||
* @return the element at the specified position in this list.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException if the index is out of
|
||||
* range (index < 0 || index >= size()).
|
||||
* range (index < 0 || index >= size()).
|
||||
*/
|
||||
|
||||
public int get(final int index)
|
||||
|
@ -425,7 +425,7 @@ public class IntList
|
|||
* @return the element previously at the specified position.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException if the index is out of
|
||||
* range (index < 0 || index >= size()).
|
||||
* range (index < 0 || index >= size()).
|
||||
*/
|
||||
|
||||
public int remove(final int index)
|
||||
|
@ -534,7 +534,7 @@ public class IntList
|
|||
* @return the element previously at the specified position.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException if the index is out of
|
||||
* range (index < 0 || index >= size()).
|
||||
* range (index < 0 || index >= size()).
|
||||
*/
|
||||
|
||||
public int set(final int index, final int element)
|
||||
|
|
Loading…
Reference in New Issue