Package org.docx4j.openpackaging

Source Code of org.docx4j.openpackaging.PackageRelsUtil

package org.docx4j.openpackaging;

import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.parts.relationships.RelationshipsPart;
import org.docx4j.relationships.Relationship;

public class PackageRelsUtil
 
  public static String getNameOfMainPart(RelationshipsPart packageRels) throws Docx4JException  {
   
    // find rel of type officeDocument
    for (Relationship rel : packageRels.getRelationships().getRelationship() ) {
     
      if (rel.getType().equals(
          "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") ) {
        return rel.getTarget();
      }
    }
    throw new Docx4JException("No relationship of type officeDocument");
  }
 
}
TOP

Related Classes of org.docx4j.openpackaging.PackageRelsUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.