Class UnicodeString
java.lang.Object
org.apache.poi.hssf.record.common.UnicodeString
- All Implemented Interfaces:
Comparable<UnicodeString>,Duplicatable,GenericRecord
public class UnicodeString
extends Object
implements Comparable<UnicodeString>, Duplicatable, GenericRecord
Unicode String - just standard fields that are in several records.
It is considered more desirable than repeating it in all of them.
This is often called a XLUnicodeRichExtendedString in MS documentation.
-
Constructor Summary
ConstructorsConstructorDescriptionUnicodeString(String str) construct a unicode string record and fill its fields, ID is ignored -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a font run to the formatted string.voidintcompareTo(UnicodeString str) copy()booleanOur handling of equals is inconsistent with compareTo.intget the number of characters in the string, as an un-wrapped intshortget the number of characters in the string, wrapped as needed to fit within a shortreturn a character representation of the fields of this recordgetFormatRun(int index) intbyteget the option flags which among other things return if this is a 16-bit or 8 bit stringinthashCode()voidvoidSerialises out the String.voidsetCharCount(short cc) set the number of characters in the stringvoidsetOptionFlags(byte of) set the option flags which among other things return if this is a 16-bit or 8 bit stringvoidset the actual string this containsvoidswapFontUse(short oldFontIndex, short newFontIndex) Swaps all use in the string of one font index for use of a different font index.toString()unlike the real records we return the same as "getString()" rather than debug infoMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren, getGenericRecordType
-
Constructor Details
-
UnicodeString
-
UnicodeString
construct a unicode string record and fill its fields, ID is ignored- Parameters:
in- the RecordInputStream to read the record from
-
-
Method Details
-
hashCode
public int hashCode() -
equals
Our handling of equals is inconsistent with compareTo. The trouble is because we don't truly understand rich text fields, yet it's difficult to make a sound comparison. -
getCharCount
public int getCharCount()get the number of characters in the string, as an un-wrapped int- Returns:
- number of characters
-
getCharCountShort
public short getCharCountShort()get the number of characters in the string, wrapped as needed to fit within a short- Returns:
- number of characters
-
setCharCount
public void setCharCount(short cc) set the number of characters in the string- Parameters:
cc- - number of characters
-
getOptionFlags
public byte getOptionFlags()get the option flags which among other things return if this is a 16-bit or 8 bit string- Returns:
- optionflags bitmask
-
setOptionFlags
public void setOptionFlags(byte of) set the option flags which among other things return if this is a 16-bit or 8 bit string- Parameters:
of- optionflags bitmask
-
getString
- Returns:
- the actual string this contains as a java String object
-
setString
set the actual string this contains- Parameters:
string- the text
-
getFormatRunCount
public int getFormatRunCount() -
getFormatRun
-
addFormatRun
Adds a font run to the formatted string. If a font run exists at the current charcter location, then it is replaced with the font run to be added. -
formatIterator
-
formatSpliterator
- Since:
- 5.2.0
-
removeFormatRun
-
clearFormatting
public void clearFormatting() -
getExtendedRst
-
swapFontUse
public void swapFontUse(short oldFontIndex, short newFontIndex) Swaps all use in the string of one font index for use of a different font index. Normally only called when fonts have been removed / re-ordered -
toString
unlike the real records we return the same as "getString()" rather than debug info -
getDebugInfo
return a character representation of the fields of this record- Returns:
- String of output for biffviewer etc.
-
serialize
Serialises out the String. There are special rules about where we can and can't split onto Continue records. -
compareTo
- Specified by:
compareToin interfaceComparable<UnicodeString>
-
copy
- Specified by:
copyin interfaceDuplicatable- Returns:
- a deep copy of the implementing class / instance
-
getGenericProperties
- Specified by:
getGenericPropertiesin interfaceGenericRecord
-