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

HWPFList

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.
author
Ryan Ackley

Fields Summary
private ListData
_listData
private ListFormatOverride
_override
private boolean
_registered
private StyleSheet
_styleSheet
Constructors Summary
public HWPFList(boolean numbered, StyleSheet styleSheet)

param
numbered true if the list should be numbered; false if it should be bulleted.
param
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.

param
level the level number that the properties should apply to.
param
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);
    listLevel.setNumberProperties(grpprl);
  
public voidsetLevelParagraphProperties(int level, org.apache.poi.hwpf.usermodel.ParagraphProperties pap)
Sets the paragraph properties for a particular level of the list.

param
level The level number.
param
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);
    listLevel.setLevelProperties(grpprl);
  
public voidsetLevelStyle(int level, int styleIndex)

    _listData.setLevelStyle(level, styleIndex);