Package org.apache.poi.hwpf.usermodel
Class CharacterRun
- java.lang.Object
-
- org.apache.poi.hwpf.usermodel.Range
-
- org.apache.poi.hwpf.usermodel.CharacterRun
-
- All Implemented Interfaces:
java.lang.Cloneable
,CharacterRun
public final class CharacterRun extends Range implements java.lang.Cloneable, CharacterRun
This class represents a run of text that share common properties.
-
-
Field Summary
Fields Modifier and Type Field Description static short
SPRM_BRC
static short
SPRM_CHARSCALE
static short
SPRM_CPG
static short
SPRM_DISPFLDRMARK
static short
SPRM_DTTMRMARK
static short
SPRM_DTTMRMARKDEL
static short
SPRM_DXASPACE
static short
SPRM_FBOLD
static short
SPRM_FCAPS
static short
SPRM_FDATA
static short
SPRM_FDSTRIKE
static short
SPRM_FELID
static short
SPRM_FEMBOSS
static short
SPRM_FFLDVANISH
static short
SPRM_FIMPRINT
static short
SPRM_FITALIC
static short
SPRM_FOBJ
static short
SPRM_FOLE2
static short
SPRM_FOUTLINE
static short
SPRM_FRMARK
static short
SPRM_FRMARKDEL
static short
SPRM_FSHADOW
static short
SPRM_FSMALLCAPS
static short
SPRM_FSPEC
static short
SPRM_FSTRIKE
static short
SPRM_FVANISH
static short
SPRM_HIGHLIGHT
static short
SPRM_HPS
static short
SPRM_HPSKERN
static short
SPRM_HPSPOS
static short
SPRM_IBSTRMARK
static short
SPRM_IBSTRMARKDEL
static short
SPRM_ICO
static short
SPRM_IDCTHINT
static short
SPRM_IDSIRMARKDEL
static short
SPRM_ISS
static short
SPRM_ISTD
static short
SPRM_KUL
static short
SPRM_LID
static short
SPRM_NONFELID
static short
SPRM_OBJLOCATION
static short
SPRM_PICLOCATION
static short
SPRM_PROPRMARK
static short
SPRM_RGFTCASCII
static short
SPRM_RGFTCFAREAST
static short
SPRM_RGFTCNOTFAREAST
static short
SPRM_SFXTEXT
static short
SPRM_SHD
static short
SPRM_SYMBOL
static short
SPRM_YSRI
-
Fields inherited from class org.apache.poi.hwpf.usermodel.Range
TYPE_CHARACTER, TYPE_LISTENTRY, TYPE_PARAGRAPH, TYPE_SECTION, TYPE_TABLE, TYPE_TEXT, TYPE_UNDEFINED
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Used to create a deep copy of this object.BorderCode
getBorder()
int
getCharacterSpacing()
int
getColor()
java.lang.Integer
getDropDownListDefaultItemIndex()
java.lang.String[]
getDropDownListValues()
java.lang.String
getFontName()
Gets the fonts which shall be used to display the text contents of this run.int
getFontSize()
byte
getHighlightedColor()
int
getIco24()
Get the ico24 field for the CHP record.int
getKerning()
int
getLanguageCode()
int
getObjOffset()
int
getPicOffset()
short
getStyleIndex()
Returns the index of the base style which applies to this Run.short
getSubSuperScriptIndex()
char
getSymbolCharacter()
Returns the symbol character, if this is a symbol character run.Ffn
getSymbolFont()
Returns the symbol font, if this is a symbol character run.int
getUnderlineCode()
int
getVerticalOffset()
boolean
isBold()
boolean
isCapitalized()
boolean
isData()
Does the picture offset represent picture or binary data? If it's set, then the picture offset refers to a NilPICFAndBinData structure, otherwise to a PICFAndOfficeArtDataboolean
isDoubleStrikeThrough()
boolean
isEmbossed()
boolean
isFldVanished()
boolean
isHighlighted()
boolean
isImprinted()
boolean
isItalic()
boolean
isMarkedDeleted()
boolean
isMarkedInserted()
boolean
isObj()
boolean
isOle2()
boolean
isOutlined()
boolean
isShadowed()
boolean
isSmallCaps()
boolean
isSpecialCharacter()
boolean
isStrikeThrough()
boolean
isSymbol()
Returns true, if the CharacterRun is a special character run containing a symbol, otherwise false.boolean
isVanished()
void
markDeleted(boolean mark)
void
markInserted(boolean mark)
void
setBold(boolean bold)
void
setCapitalized(boolean caps)
void
setCharacterSpacing(int twips)
void
setColor(int color)
void
setData(boolean data)
void
setDoubleStrikethrough(boolean dstrike)
void
setEmbossed(boolean emboss)
void
setFldVanish(boolean fldVanish)
void
setFontSize(int halfPoints)
void
setFtcAscii(int ftcAscii)
void
setFtcFE(int ftcFE)
void
setFtcOther(int ftcOther)
void
setHighlighted(byte color)
void
setIco24(int colour24)
Set the ico24 field for the CHP record.void
setImprinted(boolean imprint)
void
setItalic(boolean italic)
void
setKerning(int kern)
void
setObj(boolean obj)
void
setObjOffset(int obj)
void
setOle2(boolean ole)
void
setOutline(boolean outlined)
void
setPicOffset(int offset)
void
setShadow(boolean shadow)
void
setSmallCaps(boolean smallCaps)
void
setSpecialCharacter(boolean spec)
void
setStrikeThrough(boolean strike)
void
setSubSuperScriptIndex(short iss)
void
setUnderlineCode(int kul)
void
setVanished(boolean vanish)
void
setVerticalOffset(int hpsPos)
void
strikeThrough(boolean strike)
java.lang.String
toString()
int
type()
Here for runtime type determination using a switch statement convenient.-
Methods inherited from class org.apache.poi.hwpf.usermodel.Range
delete, getCharacterRun, getEndOffset, getParagraph, getSection, getStartOffset, getTable, insertAfter, insertBefore, insertTableBefore, numCharacterRuns, numParagraphs, numSections, replaceText, replaceText, replaceText, sanityCheck, stripFields, text
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.wp.usermodel.CharacterRun
text
-
-
-
-
Field Detail
-
SPRM_FRMARKDEL
public static final short SPRM_FRMARKDEL
- See Also:
- Constant Field Values
-
SPRM_FRMARK
public static final short SPRM_FRMARK
- See Also:
- Constant Field Values
-
SPRM_FFLDVANISH
public static final short SPRM_FFLDVANISH
- See Also:
- Constant Field Values
-
SPRM_PICLOCATION
public static final short SPRM_PICLOCATION
- See Also:
- Constant Field Values
-
SPRM_IBSTRMARK
public static final short SPRM_IBSTRMARK
- See Also:
- Constant Field Values
-
SPRM_DTTMRMARK
public static final short SPRM_DTTMRMARK
- See Also:
- Constant Field Values
-
SPRM_FDATA
public static final short SPRM_FDATA
- See Also:
- Constant Field Values
-
SPRM_SYMBOL
public static final short SPRM_SYMBOL
- See Also:
- Constant Field Values
-
SPRM_FOLE2
public static final short SPRM_FOLE2
- See Also:
- Constant Field Values
-
SPRM_HIGHLIGHT
public static final short SPRM_HIGHLIGHT
- See Also:
- Constant Field Values
-
SPRM_OBJLOCATION
public static final short SPRM_OBJLOCATION
- See Also:
- Constant Field Values
-
SPRM_ISTD
public static final short SPRM_ISTD
- See Also:
- Constant Field Values
-
SPRM_FBOLD
public static final short SPRM_FBOLD
- See Also:
- Constant Field Values
-
SPRM_FITALIC
public static final short SPRM_FITALIC
- See Also:
- Constant Field Values
-
SPRM_FSTRIKE
public static final short SPRM_FSTRIKE
- See Also:
- Constant Field Values
-
SPRM_FOUTLINE
public static final short SPRM_FOUTLINE
- See Also:
- Constant Field Values
-
SPRM_FSHADOW
public static final short SPRM_FSHADOW
- See Also:
- Constant Field Values
-
SPRM_FSMALLCAPS
public static final short SPRM_FSMALLCAPS
- See Also:
- Constant Field Values
-
SPRM_FCAPS
public static final short SPRM_FCAPS
- See Also:
- Constant Field Values
-
SPRM_FVANISH
public static final short SPRM_FVANISH
- See Also:
- Constant Field Values
-
SPRM_KUL
public static final short SPRM_KUL
- See Also:
- Constant Field Values
-
SPRM_DXASPACE
public static final short SPRM_DXASPACE
- See Also:
- Constant Field Values
-
SPRM_LID
public static final short SPRM_LID
- See Also:
- Constant Field Values
-
SPRM_ICO
public static final short SPRM_ICO
- See Also:
- Constant Field Values
-
SPRM_HPS
public static final short SPRM_HPS
- See Also:
- Constant Field Values
-
SPRM_HPSPOS
public static final short SPRM_HPSPOS
- See Also:
- Constant Field Values
-
SPRM_ISS
public static final short SPRM_ISS
- See Also:
- Constant Field Values
-
SPRM_HPSKERN
public static final short SPRM_HPSKERN
- See Also:
- Constant Field Values
-
SPRM_YSRI
public static final short SPRM_YSRI
- See Also:
- Constant Field Values
-
SPRM_RGFTCASCII
public static final short SPRM_RGFTCASCII
- See Also:
- Constant Field Values
-
SPRM_RGFTCFAREAST
public static final short SPRM_RGFTCFAREAST
- See Also:
- Constant Field Values
-
SPRM_RGFTCNOTFAREAST
public static final short SPRM_RGFTCNOTFAREAST
- See Also:
- Constant Field Values
-
SPRM_CHARSCALE
public static final short SPRM_CHARSCALE
- See Also:
- Constant Field Values
-
SPRM_FDSTRIKE
public static final short SPRM_FDSTRIKE
- See Also:
- Constant Field Values
-
SPRM_FIMPRINT
public static final short SPRM_FIMPRINT
- See Also:
- Constant Field Values
-
SPRM_FSPEC
public static final short SPRM_FSPEC
- See Also:
- Constant Field Values
-
SPRM_FOBJ
public static final short SPRM_FOBJ
- See Also:
- Constant Field Values
-
SPRM_PROPRMARK
public static final short SPRM_PROPRMARK
- See Also:
- Constant Field Values
-
SPRM_FEMBOSS
public static final short SPRM_FEMBOSS
- See Also:
- Constant Field Values
-
SPRM_SFXTEXT
public static final short SPRM_SFXTEXT
- See Also:
- Constant Field Values
-
SPRM_DISPFLDRMARK
public static final short SPRM_DISPFLDRMARK
- See Also:
- Constant Field Values
-
SPRM_IBSTRMARKDEL
public static final short SPRM_IBSTRMARKDEL
- See Also:
- Constant Field Values
-
SPRM_DTTMRMARKDEL
public static final short SPRM_DTTMRMARKDEL
- See Also:
- Constant Field Values
-
SPRM_BRC
public static final short SPRM_BRC
- See Also:
- Constant Field Values
-
SPRM_SHD
public static final short SPRM_SHD
- See Also:
- Constant Field Values
-
SPRM_IDSIRMARKDEL
public static final short SPRM_IDSIRMARKDEL
- See Also:
- Constant Field Values
-
SPRM_CPG
public static final short SPRM_CPG
- See Also:
- Constant Field Values
-
SPRM_NONFELID
public static final short SPRM_NONFELID
- See Also:
- Constant Field Values
-
SPRM_FELID
public static final short SPRM_FELID
- See Also:
- Constant Field Values
-
SPRM_IDCTHINT
public static final short SPRM_IDCTHINT
- See Also:
- Constant Field Values
-
-
Method Detail
-
type
public int type()
Here for runtime type determination using a switch statement convenient.- Returns:
- TYPE_CHARACTER
-
isMarkedDeleted
public boolean isMarkedDeleted()
-
markDeleted
public void markDeleted(boolean mark)
-
isBold
public boolean isBold()
- Specified by:
isBold
in interfaceCharacterRun
-
setBold
public void setBold(boolean bold)
- Specified by:
setBold
in interfaceCharacterRun
-
isItalic
public boolean isItalic()
- Specified by:
isItalic
in interfaceCharacterRun
-
setItalic
public void setItalic(boolean italic)
- Specified by:
setItalic
in interfaceCharacterRun
-
isOutlined
public boolean isOutlined()
-
setOutline
public void setOutline(boolean outlined)
-
isFldVanished
public boolean isFldVanished()
-
setFldVanish
public void setFldVanish(boolean fldVanish)
-
isSmallCaps
public boolean isSmallCaps()
- Specified by:
isSmallCaps
in interfaceCharacterRun
-
setSmallCaps
public void setSmallCaps(boolean smallCaps)
- Specified by:
setSmallCaps
in interfaceCharacterRun
-
isCapitalized
public boolean isCapitalized()
- Specified by:
isCapitalized
in interfaceCharacterRun
-
setCapitalized
public void setCapitalized(boolean caps)
- Specified by:
setCapitalized
in interfaceCharacterRun
-
isVanished
public boolean isVanished()
-
setVanished
public void setVanished(boolean vanish)
-
isMarkedInserted
public boolean isMarkedInserted()
-
markInserted
public void markInserted(boolean mark)
-
isStrikeThrough
public boolean isStrikeThrough()
- Specified by:
isStrikeThrough
in interfaceCharacterRun
-
setStrikeThrough
public void setStrikeThrough(boolean strike)
- Specified by:
setStrikeThrough
in interfaceCharacterRun
-
strikeThrough
public void strikeThrough(boolean strike)
-
isShadowed
public boolean isShadowed()
- Specified by:
isShadowed
in interfaceCharacterRun
-
setShadow
public void setShadow(boolean shadow)
- Specified by:
setShadow
in interfaceCharacterRun
-
isEmbossed
public boolean isEmbossed()
- Specified by:
isEmbossed
in interfaceCharacterRun
-
setEmbossed
public void setEmbossed(boolean emboss)
- Specified by:
setEmbossed
in interfaceCharacterRun
-
isImprinted
public boolean isImprinted()
- Specified by:
isImprinted
in interfaceCharacterRun
-
setImprinted
public void setImprinted(boolean imprint)
- Specified by:
setImprinted
in interfaceCharacterRun
-
isDoubleStrikeThrough
public boolean isDoubleStrikeThrough()
- Specified by:
isDoubleStrikeThrough
in interfaceCharacterRun
-
setDoubleStrikethrough
public void setDoubleStrikethrough(boolean dstrike)
- Specified by:
setDoubleStrikethrough
in interfaceCharacterRun
-
setFtcAscii
public void setFtcAscii(int ftcAscii)
-
setFtcFE
public void setFtcFE(int ftcFE)
-
setFtcOther
public void setFtcOther(int ftcOther)
-
getFontSize
public int getFontSize()
- Specified by:
getFontSize
in interfaceCharacterRun
-
setFontSize
public void setFontSize(int halfPoints)
- Specified by:
setFontSize
in interfaceCharacterRun
-
getCharacterSpacing
public int getCharacterSpacing()
- Specified by:
getCharacterSpacing
in interfaceCharacterRun
-
setCharacterSpacing
public void setCharacterSpacing(int twips)
- Specified by:
setCharacterSpacing
in interfaceCharacterRun
-
getSubSuperScriptIndex
public short getSubSuperScriptIndex()
-
setSubSuperScriptIndex
public void setSubSuperScriptIndex(short iss)
-
getUnderlineCode
public int getUnderlineCode()
-
setUnderlineCode
public void setUnderlineCode(int kul)
-
getColor
public int getColor()
-
setColor
public void setColor(int color)
-
getVerticalOffset
public int getVerticalOffset()
-
setVerticalOffset
public void setVerticalOffset(int hpsPos)
-
getKerning
public int getKerning()
- Specified by:
getKerning
in interfaceCharacterRun
-
setKerning
public void setKerning(int kern)
- Specified by:
setKerning
in interfaceCharacterRun
-
isHighlighted
public boolean isHighlighted()
- Specified by:
isHighlighted
in interfaceCharacterRun
-
getHighlightedColor
public byte getHighlightedColor()
-
setHighlighted
public void setHighlighted(byte color)
-
getFontName
public java.lang.String getFontName()
Description copied from interface:CharacterRun
Gets the fonts which shall be used to display the text contents of this run. Specifies a font which shall be used to format all "normal" characters in the run- Specified by:
getFontName
in interfaceCharacterRun
- Returns:
- a string representing the font
-
isSpecialCharacter
public boolean isSpecialCharacter()
-
setSpecialCharacter
public void setSpecialCharacter(boolean spec)
-
isObj
public boolean isObj()
-
setObj
public void setObj(boolean obj)
-
getPicOffset
public int getPicOffset()
-
setPicOffset
public void setPicOffset(int offset)
-
isData
public boolean isData()
Does the picture offset represent picture or binary data? If it's set, then the picture offset refers to a NilPICFAndBinData structure, otherwise to a PICFAndOfficeArtData
-
setData
public void setData(boolean data)
-
isOle2
public boolean isOle2()
-
setOle2
public void setOle2(boolean ole)
-
getObjOffset
public int getObjOffset()
-
setObjOffset
public void setObjOffset(int obj)
-
getIco24
public int getIco24()
Get the ico24 field for the CHP record.
-
setIco24
public void setIco24(int colour24)
Set the ico24 field for the CHP record.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Used to create a deep copy of this object.- Returns:
- A deep copy.
- Throws:
java.lang.CloneNotSupportedException
- never
-
isSymbol
public boolean isSymbol()
Returns true, if the CharacterRun is a special character run containing a symbol, otherwise false.In case of a symbol, the
Range.text()
method always returns a single character 0x0028, but word actually stores the character in a different field. UsegetSymbolCharacter()
to get that character andgetSymbolFont()
to determine its font.
-
getSymbolCharacter
public char getSymbolCharacter()
Returns the symbol character, if this is a symbol character run.- Throws:
java.lang.IllegalStateException
- If this is not a symbol character run: callisSymbol()
first.- See Also:
isSymbol()
-
getSymbolFont
public Ffn getSymbolFont()
Returns the symbol font, if this is a symbol character run. Might return null, if the font index is not found in the font table.- Throws:
java.lang.IllegalStateException
- If this is not a symbol character run: callisSymbol()
first.- See Also:
isSymbol()
-
getBorder
public BorderCode getBorder()
-
getLanguageCode
public int getLanguageCode()
-
getStyleIndex
public short getStyleIndex()
Returns the index of the base style which applies to this Run. Details of the style can be looked up from the
StyleSheet
, viaStyleSheet.getStyleDescription(int)
.Note that runs typically override some of the style properties from the base, so normally style information should be fetched directly from the
CharacterRun
itself.
-
getDropDownListValues
public java.lang.String[] getDropDownListValues()
-
getDropDownListDefaultItemIndex
public java.lang.Integer getDropDownListDefaultItemIndex()
-
-