Example usage for org.apache.poi.hpsf ClassID WORD97

List of usage examples for org.apache.poi.hpsf ClassID WORD97

Introduction

In this page you can find the example usage for org.apache.poi.hpsf ClassID WORD97.

Prototype

ClassID WORD97

To view the source code for org.apache.poi.hpsf ClassID WORD97.

Click Source Link

Usage

From source file:com.pnf.plugin.ole.parser.streams.ContainerStream.java

License:Apache License

public OleType getType() {
    if (type == null) {
        type = OleType.UNKNOWN;//from  w ww.  j av a  2s. co m

        // First try to use ClassID to identify the type of container
        if (storageId != null) {
            if (ClassID.WORD_OXML.equals(storageId))
                type = OleType.DOCX;
            else if (ClassID.WORD97.equals(storageId) || ClassID.WORD95.equals(storageId))
                type = OleType.DOC;
            else if (ClassID.POWERPOINT97.equals(storageId) || ClassID.POWERPOINT95.equals(storageId))
                type = OleType.PPT;
            else if (ClassID.EXCEL97.equals(storageId) || ClassID.EXCEL95.equals(storageId))
                type = OleType.XLS;
        }

        if (type == OleType.UNKNOWN) {
            // Read document streams to check the type of this container
            for (Stream s : documentStreams) {
                if (hasMatch(s, XLS_STREAMS))
                    type = OleType.XLS;
                else if (hasMatch(s, DOC_STREAMS))
                    type = OleType.DOC;
                else if (hasMatch(s, PPT_STREAMS))
                    type = OleType.PPT;
            }
        }
    }

    return type;
}