HWPFList.javaAPI DocApache Poi 3.0.14001Mon Jan 01 18:55:30 GMT 2007org.apache.poi.hwpf.usermodel


public class HWPFList extends Object
This class is used to create a list in a Word document. It is used in conjunction with {@link org.apache.poi.hwpf.HWPFDocument#registerList(HWPFList) registerList} in {@link org.apache.poi.hwpf.HWPFDocument HWPFDocument}. In Word, lists are not ranged entities, meaning you can't actually add one to the document. Lists only act as properties for list entries. Once you register a list, you can add list entries to a document that are a part of the list. The only benefit of this that I see, is that you can add a list entry anywhere in the document and continue numbering from the previous list.
Ryan Ackley

Fields Summary
private ListData
private ListFormatOverride
private boolean
private StyleSheet
Constructors Summary
public HWPFList(boolean numbered, StyleSheet styleSheet)

numbered true if the list should be numbered; false if it should be bulleted.
styleSheet The document's stylesheet.

    _listData = new ListData((int)(Math.random() * (double)System.currentTimeMillis()), numbered);
    _override = new ListFormatOverride(_listData.getLsid());
    _styleSheet = styleSheet;
Methods Summary
public org.apache.poi.hwpf.model.ListDatagetListData()

    return _listData;
public org.apache.poi.hwpf.model.ListFormatOverridegetOverride()

    return _override;
public voidsetLevelNumberProperties(int level, org.apache.poi.hwpf.usermodel.CharacterProperties chp)
Sets the character properties of the list numbers.

level the level number that the properties should apply to.
chp The character properties.

    ListLevel listLevel = _listData.getLevel(level);
    int styleIndex = _listData.getLevelStyle(level);
    CharacterProperties base = _styleSheet.getCharacterStyle(styleIndex);

    byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(chp, base);
public voidsetLevelParagraphProperties(int level, org.apache.poi.hwpf.usermodel.ParagraphProperties pap)
Sets the paragraph properties for a particular level of the list.

level The level number.
pap The paragraph properties

    ListLevel listLevel = _listData.getLevel(level);
    int styleIndex = _listData.getLevelStyle(level);
    ParagraphProperties base = _styleSheet.getParagraphStyle(styleIndex);

    byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(pap, base);
public voidsetLevelStyle(int level, int styleIndex)

    _listData.setLevelStyle(level, styleIndex);