Example usage for org.apache.poi.xwpf.usermodel XWPFRelation STYLES

List of usage examples for org.apache.poi.xwpf.usermodel XWPFRelation STYLES

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFRelation STYLES.

Prototype

XWPFRelation STYLES

To view the source code for org.apache.poi.xwpf.usermodel XWPFRelation STYLES.

Click Source Link

Usage

From source file:org.apache.tika.parser.microsoft.ooxml.SXWPFWordExtractorDecorator.java

License:Apache License

private XWPFStylesShim loadStyles(PackagePart packagePart) {
    try {/*www.  j  a  v a 2 s .  co m*/
        PackageRelationshipCollection stylesParts = packagePart
                .getRelationshipsByType(XWPFRelation.STYLES.getRelation());
        if (stylesParts.size() > 0) {
            PackageRelationship stylesRelationShip = stylesParts.getRelationship(0);
            if (stylesRelationShip == null) {
                return null;
            }
            PackagePart stylesPart = packagePart.getRelatedPart(stylesRelationShip);
            if (stylesPart == null) {
                return null;
            }

            return new XWPFStylesShim(stylesPart, context);
        }
    } catch (OpenXML4JException e) {
        //swallow
    }
    return null;

}