Example usage for org.apache.poi.hpsf SummaryInformation getCharCount

List of usage examples for org.apache.poi.hpsf SummaryInformation getCharCount

Introduction

In this page you can find the example usage for org.apache.poi.hpsf SummaryInformation getCharCount.

Prototype

public int getCharCount() 

Source Link

Document

Returns the character count or 0 if the SummaryInformation does not contain a char count.

Usage

From source file:com.flexive.extractor.FxSummaryInformation.java

License:Open Source License

/**
 * Constructor./*ww w.j a v  a  2s . co  m*/
 *
 * @param si the summary information
 */
public FxSummaryInformation(SummaryInformation si) {
    author = si.getAuthor();
    applicationName = si.getApplicationName();
    charCount = si.getCharCount();
    comments = si.getComments();
    createdAt = si.getCreateDateTime();
    editTime = new Date(si.getEditTime());
    keywords = si.getKeywords();
    lastModifiedBy = si.getLastAuthor();
    lastPrintedAt = si.getLastPrinted();
    title = si.getTitle();
    lastModifiedAt = si.getLastSaveDateTime();
    pageCount = si.getPageCount();
    revNumber = si.getRevNumber();
    wordCount = si.getWordCount();
    encrypted = false;
}

From source file:com.openkm.util.metadata.MetadataExtractor.java

License:Open Source License

/**
 * Extract metadata from Office Word/*from  w ww  .ja  v  a2 s . co m*/
 */
public static OfficeMetadata officeExtractor(InputStream is, String mimeType) throws IOException {
    POIFSFileSystem fs = new POIFSFileSystem(is);
    OfficeMetadata md = new OfficeMetadata();
    SummaryInformation si = null;

    if (MimeTypeConfig.MIME_MS_WORD.equals(mimeType)) {
        si = new WordExtractor(fs).getSummaryInformation();
    } else if (MimeTypeConfig.MIME_MS_EXCEL.equals(mimeType)) {
        si = new ExcelExtractor(fs).getSummaryInformation();
    } else if (MimeTypeConfig.MIME_MS_POWERPOINT.equals(mimeType)) {
        si = new PowerPointExtractor(fs).getSummaryInformation();
    }

    if (si != null) {
        md.setTitle(si.getTitle());
        md.setSubject(si.getSubject());
        md.setAuthor(si.getAuthor());
        md.setLastAuthor(si.getLastAuthor());
        md.setKeywords(si.getKeywords());
        md.setComments(si.getComments());
        md.setTemplate(si.getTemplate());
        md.setRevNumber(si.getRevNumber());
        md.setApplicationName(si.getApplicationName());
        md.setEditTime(si.getEditTime());
        md.setPageCount(si.getPageCount());
        md.setWordCount(si.getWordCount());
        md.setCharCount(si.getCharCount());
        md.setSecurity(si.getSecurity());

        Calendar createDateTime = Calendar.getInstance();
        createDateTime.setTime(si.getCreateDateTime());
        md.setCreateDateTime(createDateTime);

        Calendar lastSaveDateTime = Calendar.getInstance();
        lastSaveDateTime.setTime(si.getLastSaveDateTime());
        md.setLastSaveDateTime(lastSaveDateTime);

        Calendar lastPrinted = Calendar.getInstance();
        lastPrinted.setTime(si.getLastPrinted());
        md.setLastPrinted(lastPrinted);
    }

    log.info("officeExtractor: {}", md);
    return md;
}

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

License:Apache License

private void parse(SummaryInformation summary) {
    set(TikaCoreProperties.TITLE, summary.getTitle());
    set(TikaCoreProperties.CREATOR, summary.getAuthor());
    set(TikaCoreProperties.KEYWORDS, summary.getKeywords());
    // TODO Move to OO subject in Tika 2.0
    set(TikaCoreProperties.TRANSITION_SUBJECT_TO_OO_SUBJECT, summary.getSubject());
    set(TikaCoreProperties.MODIFIER, summary.getLastAuthor());
    set(TikaCoreProperties.COMMENTS, summary.getComments());
    set(OfficeOpenXMLExtended.TEMPLATE, summary.getTemplate());
    set(OfficeOpenXMLExtended.APPLICATION, summary.getApplicationName());
    set(OfficeOpenXMLCore.REVISION, summary.getRevNumber());
    set(TikaCoreProperties.CREATED, summary.getCreateDateTime());
    set(TikaCoreProperties.MODIFIED, summary.getLastSaveDateTime());
    set(TikaCoreProperties.PRINT_DATE, summary.getLastPrinted());
    set(Metadata.EDIT_TIME, summary.getEditTime());
    set(OfficeOpenXMLExtended.DOC_SECURITY, summary.getSecurity());

    // New style counts
    set(Office.WORD_COUNT, summary.getWordCount());
    set(Office.CHARACTER_COUNT, summary.getCharCount());
    set(Office.PAGE_COUNT, summary.getPageCount());
    if (summary.getPageCount() > 0) {
        metadata.set(PagedText.N_PAGES, summary.getPageCount());
    }//w ww  .  ja v  a2s.  c o  m

    // Old style, Tika 1.0 properties
    // TODO Remove these in Tika 2.0
    set(Metadata.TEMPLATE, summary.getTemplate());
    set(Metadata.APPLICATION_NAME, summary.getApplicationName());
    set(Metadata.REVISION_NUMBER, summary.getRevNumber());
    set(Metadata.SECURITY, summary.getSecurity());
    set(MSOffice.WORD_COUNT, summary.getWordCount());
    set(MSOffice.CHARACTER_COUNT, summary.getCharCount());
    set(MSOffice.PAGE_COUNT, summary.getPageCount());
}

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

License:Apache License

private void parse(SummaryInformation summary) {
    set(TikaCoreProperties.TITLE, summary.getTitle());
    addMulti(metadata, TikaCoreProperties.CREATOR, summary.getAuthor());
    set(TikaCoreProperties.KEYWORDS, summary.getKeywords());
    // TODO Move to OO subject in Tika 2.0
    set(TikaCoreProperties.TRANSITION_SUBJECT_TO_OO_SUBJECT, summary.getSubject());
    set(TikaCoreProperties.MODIFIER, summary.getLastAuthor());
    set(TikaCoreProperties.COMMENTS, summary.getComments());
    set(OfficeOpenXMLExtended.TEMPLATE, summary.getTemplate());
    set(OfficeOpenXMLExtended.APPLICATION, summary.getApplicationName());
    set(OfficeOpenXMLCore.REVISION, summary.getRevNumber());
    set(TikaCoreProperties.CREATED, summary.getCreateDateTime());
    set(TikaCoreProperties.MODIFIED, summary.getLastSaveDateTime());
    set(TikaCoreProperties.PRINT_DATE, summary.getLastPrinted());
    set(Metadata.EDIT_TIME, summary.getEditTime());
    set(OfficeOpenXMLExtended.DOC_SECURITY, summary.getSecurity());

    // New style counts
    set(Office.WORD_COUNT, summary.getWordCount());
    set(Office.CHARACTER_COUNT, summary.getCharCount());
    set(Office.PAGE_COUNT, summary.getPageCount());
    if (summary.getPageCount() > 0) {
        metadata.set(PagedText.N_PAGES, summary.getPageCount());
    }// w ww .  ja  v  a  2s . c  o m

    // Old style, Tika 1.0 properties
    // TODO Remove these in Tika 2.0
    set(Metadata.TEMPLATE, summary.getTemplate());
    set(Metadata.APPLICATION_NAME, summary.getApplicationName());
    set(Metadata.REVISION_NUMBER, summary.getRevNumber());
    set(Metadata.SECURITY, summary.getSecurity());
    set(MSOffice.WORD_COUNT, summary.getWordCount());
    set(MSOffice.CHARACTER_COUNT, summary.getCharCount());
    set(MSOffice.PAGE_COUNT, summary.getPageCount());
}

From source file:org.modeshape.sequencer.msoffice.MSOfficeMetadata.java

License:Apache License

public void setSummaryInformation(SummaryInformation si) {
    title = si.getTitle();// w  ww .j  av a2  s  .c om
    subject = si.getSubject();
    author = si.getAuthor();
    keywords = si.getKeywords();
    comment = si.getComments();
    template = si.getTemplate();
    lastSaved = si.getLastSaveDateTime();
    revision = si.getRevNumber();
    totalEditingTime = si.getEditTime();
    lastPrinted = si.getLastPrinted();
    created = si.getCreateDateTime();
    pages = si.getPageCount();
    words = si.getWordCount();
    characters = si.getCharCount();
    creatingApplication = si.getApplicationName();
    thumbnail = si.getThumbnail();
}

From source file:poi.poifs.poibrowser.PropertySetDescriptorRenderer.java

License:Apache License

public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean selected,
        final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
    final PropertySetDescriptor d = (PropertySetDescriptor) ((DefaultMutableTreeNode) value).getUserObject();
    final PropertySet ps = d.getPropertySet();
    final JPanel p = new JPanel();
    final JTextArea text = new JTextArea();
    text.setBackground(new Color(200, 255, 200));
    text.setFont(new Font("Monospaced", Font.PLAIN, 10));
    text.append(renderAsString(d));//w ww. j a  v a2s . c o  m
    text.append("\nByte order: " + Codec.hexEncode((short) ps.getByteOrder()));
    text.append("\nFormat: " + Codec.hexEncode((short) ps.getFormat()));
    text.append("\nOS version: " + Codec.hexEncode(ps.getOSVersion()));
    text.append("\nClass ID: " + Codec.hexEncode(ps.getClassID()));
    text.append("\nSection count: " + ps.getSectionCount());
    text.append(sectionsToString(ps.getSections()));
    p.add(text);

    if (ps instanceof SummaryInformation) {
        /* Use the convenience methods. */
        final SummaryInformation si = (SummaryInformation) ps;
        text.append("\n");
        text.append("\nTitle:               " + si.getTitle());
        text.append("\nSubject:             " + si.getSubject());
        text.append("\nAuthor:              " + si.getAuthor());
        text.append("\nKeywords:            " + si.getKeywords());
        text.append("\nComments:            " + si.getComments());
        text.append("\nTemplate:            " + si.getTemplate());
        text.append("\nLast Author:         " + si.getLastAuthor());
        text.append("\nRev. Number:         " + si.getRevNumber());
        text.append("\nEdit Time:           " + si.getEditTime());
        text.append("\nLast Printed:        " + si.getLastPrinted());
        text.append("\nCreate Date/Time:    " + si.getCreateDateTime());
        text.append("\nLast Save Date/Time: " + si.getLastSaveDateTime());
        text.append("\nPage Count:          " + si.getPageCount());
        text.append("\nWord Count:          " + si.getWordCount());
        text.append("\nChar Count:          " + si.getCharCount());
        // text.append("\nThumbnail:           " + si.getThumbnail());
        text.append("\nApplication Name:    " + si.getApplicationName());
        text.append("\nSecurity:            " + si.getSecurity());
    }

    if (selected)
        Util.invert(text);
    return p;
}