Package org.apache.poi.hssf.record
Class NameRecord
- java.lang.Object
-
- org.apache.poi.hssf.record.RecordBase
-
- org.apache.poi.hssf.record.Record
-
- org.apache.poi.hssf.record.cont.ContinuableRecord
-
- org.apache.poi.hssf.record.NameRecord
-
- All Implemented Interfaces:
Duplicatable,GenericRecord
public final class NameRecord extends ContinuableRecord
Defines a named range within a workbook.
-
-
Field Summary
Fields Modifier and Type Field Description static byteBUILTIN_AUTO_ACTIVATEIncluded for completeness sake, not implementedstatic byteBUILTIN_AUTO_CLOSEIncluded for completeness sake, not implementedstatic byteBUILTIN_AUTO_DEACTIVATEIncluded for completeness sake, not implementedstatic byteBUILTIN_AUTO_OPENIncluded for completeness sake, not implementedstatic byteBUILTIN_CONSOLIDATE_AREAIncluded for completeness sake, not implementedstatic byteBUILTIN_CRITERIAIncluded for completeness sake, not implementedstatic byteBUILTIN_DATA_FORMIncluded for completeness sake, not implementedstatic byteBUILTIN_DATABASEIncluded for completeness sake, not implementedstatic byteBUILTIN_FILTER_DBstatic byteBUILTIN_PRINT_AREAstatic byteBUILTIN_PRINT_TITLEstatic byteBUILTIN_RECORDERIncluded for completeness sake, not implementedstatic byteBUILTIN_SHEET_TITLEIncluded for completeness sake, not implementedstatic shortsid
-
Constructor Summary
Constructors Constructor Description NameRecord()Creates new NameRecordNameRecord(byte builtin, int sheetNumber)Constructor to create a built-in named regionNameRecord(NameRecord other)NameRecord(RecordInputStream ris)called by the constructor, should set class level fields.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NameRecordcopy()bytegetBuiltInName()Gets the Built In NameStringgetCustomMenuText()get the custom menu textStringgetDescriptionText()gets the description textintgetExternSheetNumber()gets the extern sheet numberbytegetFnGroup()Map<String,Supplier<?>>getGenericProperties()HSSFRecordTypesgetGenericRecordType()StringgetHelpTopicText()get the help topic textbytegetKeyboardShortcut()returns the keyboard shortcutPtg[]getNameDefinition()gets the definition, reference (Formula)StringgetNameText()gets the nameshortgetOptionFlag()gets the option flagintgetSheetNumber()For named ranges, and built-in namesshortgetSid()return the non static version of the id for this record.StringgetStatusBarText()gets the status bar textbooleanhasFormula()booleanisBuiltInName()Convenience Function to determine if the name is a built-in namebooleanisCommandName()booleanisComplexFunction()booleanisFunctionName()booleanisHiddenName()booleanisMacro()voidserialize(ContinuableRecordOutput out)NameRecord can span intovoidsetCustomMenuText(String text)sets the custom menu textvoidsetDescriptionText(String text)sets the description textvoidsetFunction(boolean function)Indicates that the defined name refers to a user-defined function.voidsetHelpTopicText(String text)sets the help topic textvoidsetHidden(boolean b)voidsetKeyboardShortcut(byte shortcut)sets the keyboard shortcutvoidsetNameDefinition(Ptg[] ptgs)voidsetNameText(String name)sets the name of the named rangevoidsetOptionFlag(short flag)sets the option flag for the named rangevoidsetSheetNumber(int value)voidsetStatusBarText(String text)sets the status bar text-
Methods inherited from class org.apache.poi.hssf.record.cont.ContinuableRecord
getRecordSize, serialize
-
Methods inherited from class org.apache.poi.hssf.record.Record
cloneViaReserialise, serialize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren
-
-
-
-
Field Detail
-
sid
public static final short sid
- See Also:
- Constant Field Values
-
BUILTIN_CONSOLIDATE_AREA
public static final byte BUILTIN_CONSOLIDATE_AREA
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_AUTO_OPEN
public static final byte BUILTIN_AUTO_OPEN
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_AUTO_CLOSE
public static final byte BUILTIN_AUTO_CLOSE
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_DATABASE
public static final byte BUILTIN_DATABASE
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_CRITERIA
public static final byte BUILTIN_CRITERIA
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_PRINT_AREA
public static final byte BUILTIN_PRINT_AREA
- See Also:
- Constant Field Values
-
BUILTIN_PRINT_TITLE
public static final byte BUILTIN_PRINT_TITLE
- See Also:
- Constant Field Values
-
BUILTIN_RECORDER
public static final byte BUILTIN_RECORDER
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_DATA_FORM
public static final byte BUILTIN_DATA_FORM
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_AUTO_ACTIVATE
public static final byte BUILTIN_AUTO_ACTIVATE
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_AUTO_DEACTIVATE
public static final byte BUILTIN_AUTO_DEACTIVATE
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_SHEET_TITLE
public static final byte BUILTIN_SHEET_TITLE
Included for completeness sake, not implemented- See Also:
- Constant Field Values
-
BUILTIN_FILTER_DB
public static final byte BUILTIN_FILTER_DB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NameRecord
public NameRecord()
Creates new NameRecord
-
NameRecord
public NameRecord(NameRecord other)
-
NameRecord
public NameRecord(byte builtin, int sheetNumber)Constructor to create a built-in named region- Parameters:
builtin- Built-in byte representation for the name record, use the public constantssheetNumber- the sheet which the name applies to
-
NameRecord
public NameRecord(RecordInputStream ris)
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.- Parameters:
ris- the RecordInputstream to read the record from
-
-
Method Detail
-
setOptionFlag
public void setOptionFlag(short flag)
sets the option flag for the named range- Parameters:
flag- option flag
-
setKeyboardShortcut
public void setKeyboardShortcut(byte shortcut)
sets the keyboard shortcut- Parameters:
shortcut- keyboard shortcut
-
getSheetNumber
public int getSheetNumber()
For named ranges, and built-in names- Returns:
- the 1-based sheet number.
-
getFnGroup
public byte getFnGroup()
- Returns:
- function group
- See Also:
FnGroupCountRecord
-
setSheetNumber
public void setSheetNumber(int value)
-
setNameText
public void setNameText(String name)
sets the name of the named range- Parameters:
name- named range name
-
setCustomMenuText
public void setCustomMenuText(String text)
sets the custom menu text- Parameters:
text- custom menu text
-
setDescriptionText
public void setDescriptionText(String text)
sets the description text- Parameters:
text- the description text
-
setHelpTopicText
public void setHelpTopicText(String text)
sets the help topic text- Parameters:
text- help topix text
-
setStatusBarText
public void setStatusBarText(String text)
sets the status bar text- Parameters:
text- status bar text
-
getOptionFlag
public short getOptionFlag()
gets the option flag- Returns:
- option flag
-
getKeyboardShortcut
public byte getKeyboardShortcut()
returns the keyboard shortcut- Returns:
- keyboard shortcut
-
isHiddenName
public boolean isHiddenName()
- Returns:
- true if name is hidden
-
setHidden
public void setHidden(boolean b)
-
isFunctionName
public boolean isFunctionName()
- Returns:
trueif name is a function
-
setFunction
public void setFunction(boolean function)
Indicates that the defined name refers to a user-defined function. This attribute is used when there is an add-in or other code project associated with the file.- Parameters:
function-trueindicates the name refers to a function.
-
hasFormula
public boolean hasFormula()
- Returns:
trueif name has a formula (named range or defined value)
-
isCommandName
public boolean isCommandName()
- Returns:
- true if name is a command
-
isMacro
public boolean isMacro()
- Returns:
- true if function macro or command macro
-
isComplexFunction
public boolean isComplexFunction()
- Returns:
- true if array formula or user defined
-
isBuiltInName
public boolean isBuiltInName()
Convenience Function to determine if the name is a built-in name- Returns:
- true, if the name is a built-in name
-
getNameText
public String getNameText()
gets the name- Returns:
- name
-
getBuiltInName
public byte getBuiltInName()
Gets the Built In Name- Returns:
- the built in Name
-
getNameDefinition
public Ptg[] getNameDefinition()
gets the definition, reference (Formula)- Returns:
- the name formula. never
null
-
setNameDefinition
public void setNameDefinition(Ptg[] ptgs)
-
getCustomMenuText
public String getCustomMenuText()
get the custom menu text- Returns:
- custom menu text
-
getDescriptionText
public String getDescriptionText()
gets the description text- Returns:
- description text
-
getHelpTopicText
public String getHelpTopicText()
get the help topic text- Returns:
- gelp topic text
-
getStatusBarText
public String getStatusBarText()
gets the status bar text- Returns:
- status bar text
-
serialize
public void serialize(ContinuableRecordOutput out)
NameRecord can span into- Specified by:
serializein classContinuableRecord- Parameters:
out- a data output stream
-
getExternSheetNumber
public int getExternSheetNumber()
gets the extern sheet number- Returns:
- extern sheet index
-
getSid
public short getSid()
return the non static version of the id for this record.
-
copy
public NameRecord copy()
- Specified by:
copyin interfaceDuplicatable- Specified by:
copyin classRecord- Returns:
- a deep copy of the implementing class / instance
-
getGenericRecordType
public HSSFRecordTypes getGenericRecordType()
- Specified by:
getGenericRecordTypein interfaceGenericRecord- Specified by:
getGenericRecordTypein classRecord
-
-