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

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

Introduction

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

Prototype

ClassID WORD95

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

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;//w ww .  ja  v  a 2 s  .  com

        // 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;
}