Example usage for org.apache.poi.hpsf DocumentSummaryInformation getSlideCount

List of usage examples for org.apache.poi.hpsf DocumentSummaryInformation getSlideCount

Introduction

In this page you can find the example usage for org.apache.poi.hpsf DocumentSummaryInformation getSlideCount.

Prototype

public int getSlideCount() 

Source Link

Document

Returns the slide count or 0 if the DocumentSummaryInformation does not contain a slide count.

Usage

From source file:RefDiviedMain.java

License:Creative Commons License

public static void readDocumentSummary(HWPFDocument doc) {

    DocumentSummaryInformation summaryInfo = doc.getDocumentSummaryInformation();

    String category = summaryInfo.getCategory();

    String company = summaryInfo.getCompany();

    int lineCount = summaryInfo.getLineCount();

    int sectionCount = summaryInfo.getSectionCount();

    int slideCount = summaryInfo.getSlideCount();

    ta.append("\n" + "---------------------------");

    ta.append("\n" + "Category: " + category);

    ta.append("\n" + "Company: " + company);

    ta.append("\n" + "Line Count: " + lineCount);

    ta.append("\n" + "Section Count: " + sectionCount);

    ta.append("\n" + "Slide Count: " + slideCount);

}

From source file:com.pnf.plugin.ole.parser.StreamReader.java

License:Apache License

private List<INode> readDocSummaryStream(ByteBuffer stream) {
    List<INode> roots = new LinkedList<>();
    String propType = "Property";

    try {/* w ww  .jav a2  s .com*/
        DocumentSummaryInformation info = (DocumentSummaryInformation) PropertySetFactory
                .create(new ByteArrayInputStream(stream.array()));

        propType = "int";
        StreamEntry counts = new StreamEntry("Counts");
        if (info.getLineCount() != 0)
            counts.addChild(new StreamEntry("Line count", propType, String.valueOf(info.getLineCount())));

        if (info.getByteCount() != 0)
            counts.addChild(new StreamEntry("Byte count", propType, String.valueOf(info.getByteCount())));

        if (info.getHiddenCount() != 0)
            counts.addChild(new StreamEntry("Hidden count", propType, String.valueOf(info.getHiddenCount())));

        if (info.getMMClipCount() != 0)
            counts.addChild(new StreamEntry("MMClip count", propType, String.valueOf(info.getMMClipCount())));

        if (info.getNoteCount() != 0)
            counts.addChild(new StreamEntry("Note count", propType, String.valueOf(info.getNoteCount())));

        if (info.getParCount() != 0)
            counts.addChild(new StreamEntry("Par count", propType, String.valueOf(info.getParCount())));

        if (info.getSlideCount() != 0)
            counts.addChild(new StreamEntry("Slide count", propType, String.valueOf(info.getSlideCount())));

        if (counts.size() > 0)
            roots.add(counts);

        propType = "String";
        StreamEntry strings = new StreamEntry("Strings");
        strings.addChild(new StreamEntry("Category", propType, info.getCategory()));
        strings.addChild(new StreamEntry("Company", propType, info.getCompany()));
        strings.addChild(new StreamEntry("Manager", propType, info.getManager()));
        strings.addChild(new StreamEntry("Presentation Format", propType, info.getPresentationFormat()));

        roots.add(strings);

        propType = "Custom";
        StreamEntry custom = new StreamEntry("User-defined properties");
        CustomProperties props = info.getCustomProperties();

        if (props != null) {
            Set<Entry<Object, CustomProperty>> entries = props.entrySet();

            for (Entry<Object, CustomProperty> e : entries) {
                try {
                    custom.addChild(new StreamEntry(e.getValue().getName(), propType,
                            e.getValue().getValue().toString()));
                } catch (NullPointerException ex) {
                    // ignore any errors
                }
            }
        }
    } catch (Throwable t) {
        addMessage("Attempted to read " + DOC_SUMM + " stream but no property sets were found.", null,
                Message.CORRUPT);
    }

    return roots;
}

From source file:intelligentWebAlgorithms.util.parsing.msword.MSWordDocumentParser.java

License:Apache License

public String[] readDocumentSummary(HWPFDocument doc) {

    String[] summary = new String[5];

    DocumentSummaryInformation summaryInfo = doc.getDocumentSummaryInformation();

    summary[0] = summaryInfo.getCategory();
    summary[1] = summaryInfo.getCompany();
    summary[2] = Integer.toString(summaryInfo.getLineCount());
    summary[3] = Integer.toString(summaryInfo.getSectionCount());
    summary[4] = Integer.toString(summaryInfo.getSlideCount());

    //        P.hline();
    //        P.println("Category: "+category);
    //        P.println("Company: "+company);
    //        P.println("Line Count: "+lineCount);
    //        P.println("Section Count: "+sectionCount);
    //        P.println("Slide Count: "+slideCount);
    return summary;
}

From source file:mj.ocraptor.extraction.tika.parser.microsoft.SummaryExtractor.java

License:Apache License

private void parse(DocumentSummaryInformation summary) {
    set(OfficeOpenXMLExtended.COMPANY, summary.getCompany());
    set(OfficeOpenXMLExtended.MANAGER, summary.getManager());
    set(TikaCoreProperties.LANGUAGE, getLanguage(summary));
    set(OfficeOpenXMLCore.CATEGORY, summary.getCategory());

    // New style counts
    set(Office.SLIDE_COUNT, summary.getSlideCount());
    if (summary.getSlideCount() > 0) {
        metadata.set(PagedText.N_PAGES, summary.getSlideCount());
    }//w  w  w.  j a  v  a2s  .com
    // Old style, Tika 1.0 counts
    // TODO Remove these in Tika 2.0
    set(Metadata.COMPANY, summary.getCompany());
    set(Metadata.MANAGER, summary.getManager());
    set(MSOffice.SLIDE_COUNT, summary.getSlideCount());
    set(Metadata.CATEGORY, summary.getCategory());

    parse(summary.getCustomProperties());
}

From source file:org.apache.tika.parser.microsoft.SummaryExtractor.java

License:Apache License

private void parse(DocumentSummaryInformation summary) {
    set(OfficeOpenXMLExtended.COMPANY, summary.getCompany());
    addMulti(metadata, OfficeOpenXMLExtended.MANAGER, summary.getManager());
    set(TikaCoreProperties.LANGUAGE, getLanguage(summary));
    set(OfficeOpenXMLCore.CATEGORY, summary.getCategory());

    // New style counts
    set(Office.SLIDE_COUNT, summary.getSlideCount());
    if (summary.getSlideCount() > 0) {
        metadata.set(PagedText.N_PAGES, summary.getSlideCount());
    }//from   ww  w  .j a v a  2  s  . c  o  m
    // Old style, Tika 1.0 counts
    // TODO Remove these in Tika 2.0
    set(Metadata.COMPANY, summary.getCompany());
    set(Metadata.MANAGER, summary.getManager());
    set(MSOffice.SLIDE_COUNT, summary.getSlideCount());
    set(Metadata.CATEGORY, summary.getCategory());

    parse(summary.getCustomProperties());
}