Browse Source

try to fix test compile

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879257 13f79535-47bb-0310-9956-ffa450edef68
tags/before_ooxml_3rd_edition
PJ Fanning 4 years ago
parent
commit
33261cd4d2
1 changed files with 37 additions and 3 deletions
  1. 37
    3
      src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java

+ 37
- 3
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java View File

@@ -1018,6 +1018,25 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
return Collections.unmodifiableList(namedRangesByName.get(name.toLowerCase(Locale.ENGLISH)));
}

/**
* Get the named range at the given index. No longer public and only used in tests.
*
* @param nameIndex the index of the named range
* @return the XSSFName at the given index
*/
@Deprecated
XSSFName getNameAt(int nameIndex) {
int nNames = namedRanges.size();
if (nNames < 1) {
throw new IllegalStateException("There are no defined names in this workbook");
}
if (nameIndex < 0 || nameIndex > nNames) {
throw new IllegalArgumentException("Specified name index " + nameIndex
+ " is outside the allowable range (0.." + (nNames-1) + ").");
}
return namedRanges.get(nameIndex);
}

/**
* Get a list of all the named ranges in the workbook.
*
@@ -1028,6 +1047,24 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
return Collections.unmodifiableList(namedRanges);
}

/**
* Gets the named range index by name. No longer public and only used in tests.
*
* @param name named range name
* @return named range index. <code>-1</code> is returned if no named ranges could be found.
*
* @deprecated 3.16. New projects should avoid accessing named ranges by index.
* Use {@link #getName(String)} instead.
*/
@Deprecated
int getNameIndex(String name) {
XSSFName nm = getName(name);
if (nm != null) {
return namedRanges.indexOf(nm);
}
return -1;
}

/**
* Get the number of styles the workbook contains
*
@@ -1225,9 +1262,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
}

/**
* As {@link #removeName(String)} is not necessarily unique
* (name + sheet index is unique), this method is more accurate.
*
* @param name the name to remove.
*
* @throws IllegalArgumentException if the named range is not a part of this XSSFWorkbook

Loading…
Cancel
Save