From: Nick Burch Date: Sun, 19 Apr 2020 15:23:32 +0000 (+0000) Subject: Inspired by Stackoverflow #61292598 - Expose if a Named Range is hidden or not X-Git-Tag: before_ooxml_3rd_edition~311 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=248e85dbba6891f6355dd8d6ebd4d90ab29b135b;p=poi.git Inspired by Stackoverflow #61292598 - Expose if a Named Range is hidden or not git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876722 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java index d2f8b857f4..c805c573e9 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java @@ -264,6 +264,16 @@ public final class HSSFName implements Name { return _definedNameRec.isFunctionName(); } + /** + * Checks if this name is hidden, eg one of the built-in Excel + * internal names + * + * @return true if this name is a hidden one + */ + public boolean isHidden() { + return _definedNameRec.isHiddenName(); + } + public String toString() { return getClass().getName() + " [" + _definedNameRec.getNameText() + diff --git a/src/java/org/apache/poi/ss/usermodel/Name.java b/src/java/org/apache/poi/ss/usermodel/Name.java index 67bc245d0c..03e13a83d9 100644 --- a/src/java/org/apache/poi/ss/usermodel/Name.java +++ b/src/java/org/apache/poi/ss/usermodel/Name.java @@ -158,6 +158,14 @@ public interface Name { */ boolean isDeleted(); + /** + * Checks if this name is hidden, eg one of the built-in Excel + * internal names + * + * @return true if the name is a hidden name, false otherwise + */ + boolean isHidden(); + /** * Tell Excel that this name applies to the worksheet with the specified index instead of the entire workbook. * diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java index e56af69d9a..21300d47e3 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java @@ -305,6 +305,16 @@ public final class XSSFName implements Name { return getFunction(); } + /** + * Checks if this name is hidden, eg one of the built-in Excel + * internal names + * + * @return true if this name is a hidden one + */ + public boolean isHidden() { + return _ctName.getHidden(); + } + /** * Returns the comment the user provided when the name was created. *