Class CharacterRun

java.lang.Object
org.apache.poi.hwpf.usermodel.Range
org.apache.poi.hwpf.usermodel.CharacterRun
All Implemented Interfaces:
Cloneable, CharacterRun

public final class CharacterRun extends Range implements Cloneable, CharacterRun
This class represents a run of text that share common properties.
  • Field Details

  • Method Details

    • 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 interface CharacterRun
    • setBold

      public void setBold(boolean bold)
      Specified by:
      setBold in interface CharacterRun
    • isItalic

      public boolean isItalic()
      Specified by:
      isItalic in interface CharacterRun
    • setItalic

      public void setItalic(boolean italic)
      Specified by:
      setItalic in interface CharacterRun
    • 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 interface CharacterRun
    • setSmallCaps

      public void setSmallCaps(boolean smallCaps)
      Specified by:
      setSmallCaps in interface CharacterRun
    • isCapitalized

      public boolean isCapitalized()
      Specified by:
      isCapitalized in interface CharacterRun
    • setCapitalized

      public void setCapitalized(boolean caps)
      Specified by:
      setCapitalized in interface CharacterRun
    • 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 interface CharacterRun
    • setStrikeThrough

      public void setStrikeThrough(boolean strike)
      Specified by:
      setStrikeThrough in interface CharacterRun
    • strikeThrough

      public void strikeThrough(boolean strike)
    • isShadowed

      public boolean isShadowed()
      Specified by:
      isShadowed in interface CharacterRun
    • setShadow

      public void setShadow(boolean shadow)
      Specified by:
      setShadow in interface CharacterRun
    • isEmbossed

      public boolean isEmbossed()
      Specified by:
      isEmbossed in interface CharacterRun
    • setEmbossed

      public void setEmbossed(boolean emboss)
      Specified by:
      setEmbossed in interface CharacterRun
    • isImprinted

      public boolean isImprinted()
      Specified by:
      isImprinted in interface CharacterRun
    • setImprinted

      public void setImprinted(boolean imprint)
      Specified by:
      setImprinted in interface CharacterRun
    • isDoubleStrikeThrough

      public boolean isDoubleStrikeThrough()
      Specified by:
      isDoubleStrikeThrough in interface CharacterRun
    • setDoubleStrikethrough

      public void setDoubleStrikethrough(boolean dstrike)
      Specified by:
      setDoubleStrikethrough in interface CharacterRun
    • 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 interface CharacterRun
    • setFontSize

      public void setFontSize(int halfPoints)
      Specified by:
      setFontSize in interface CharacterRun
    • getCharacterSpacing

      public int getCharacterSpacing()
      Specified by:
      getCharacterSpacing in interface CharacterRun
    • setCharacterSpacing

      public void setCharacterSpacing(int twips)
      Specified by:
      setCharacterSpacing in interface CharacterRun
    • 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 interface CharacterRun
    • setKerning

      public void setKerning(int kern)
      Specified by:
      setKerning in interface CharacterRun
    • isHighlighted

      public boolean isHighlighted()
      Specified by:
      isHighlighted in interface CharacterRun
    • getHighlightedColor

      public byte getHighlightedColor()
    • setHighlighted

      public void setHighlighted(byte color)
    • getFontName

      public 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 interface CharacterRun
      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 Object clone() throws CloneNotSupportedException
      Used to create a deep copy of this object.
      Overrides:
      clone in class Object
      Returns:
      A deep copy.
      Throws:
      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. Use getSymbolCharacter() to get that character and getSymbolFont() to determine its font.

    • getSymbolCharacter

      public char getSymbolCharacter()
      Returns the symbol character, if this is a symbol character run.
      Throws:
      IllegalStateException - If this is not a symbol character run: call isSymbol() first.
      See Also:
    • 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:
      IllegalStateException - If this is not a symbol character run: call isSymbol() first.
      See Also:
    • 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, via StyleSheet.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.

    • toString

      public String toString()
      Overrides:
      toString in class Range
    • getDropDownListValues

      public String[] getDropDownListValues()
    • getDropDownListDefaultItemIndex

      public Integer getDropDownListDefaultItemIndex()