Example usage for org.apache.poi.hwpf.model CHPFormattedDiskPage CHPFormattedDiskPage

List of usage examples for org.apache.poi.hwpf.model CHPFormattedDiskPage CHPFormattedDiskPage

Introduction

In this page you can find the example usage for org.apache.poi.hwpf.model CHPFormattedDiskPage CHPFormattedDiskPage.

Prototype

public CHPFormattedDiskPage(byte[] documentStream, int offset, CharIndexTranslator translator) 

Source Link

Document

This constructs a CHPFormattedDiskPage from a raw fkp (512 byte array read from a Word file).

Usage

From source file:com.progdan.doc2txt.chp.Word6CHPBinTable.java

License:Apache License

/**
 * Constructor used to read a binTable in from a Word document.
 *
 * @param documentStream The POIFS "WordDocument" stream from a Word document
 * @param offset The offset of the Chp bin table in the main stream.
 * @param size The size of the Chp bin table in the main stream.
 * @param fcMin The start of text in the main stream.
 *//*  www .j  a  va  2s. com*/
public Word6CHPBinTable(byte[] documentStream, int offset, int size, int fcMin) {
    PlexOfCps binTable = new PlexOfCps(documentStream, offset, size, 2);

    int length = binTable.length();
    for (int x = 0; x < length; x++) {
        GenericPropertyNode node = binTable.getProperty(x);

        int pageNum = LittleEndian.getShort((byte[]) node.getBytes());
        int pageOffset = POIFSConstants.BIG_BLOCK_SIZE * pageNum;

        CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream, pageOffset, fcMin);

        int fkpSize = cfkp.size();

        for (int y = 0; y < fkpSize; y++) {
            _textRuns.add(cfkp.getCHPX(y));
        }
    }
}