• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PackageRelationship类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.poi.openxml4j.opc.PackageRelationship的典型用法代码示例。如果您正苦于以下问题:Java PackageRelationship类的具体用法?Java PackageRelationship怎么用?Java PackageRelationship使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PackageRelationship类属于org.apache.poi.openxml4j.opc包,在下文中一共展示了PackageRelationship类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: transformInternal

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
@Override
protected void transformInternal(ContentReader reader,
                                 ContentWriter writer,
                                 TransformationOptions options) throws Exception
{
    final String sourceMimetype = reader.getMimetype();
    final String sourceExtension = getMimetypeService().getExtension(sourceMimetype);
    final String targetMimetype = writer.getMimetype();
    
    
    if (log.isDebugEnabled())
    {
        StringBuilder msg = new StringBuilder();
        msg.append("Transforming from ").append(sourceMimetype)
           .append(" to ").append(targetMimetype);
        log.debug(msg.toString());
    }
    
    
    OPCPackage pkg = null;
    try 
    {
        File ooxmlTempFile = TempFileProvider.createTempFile(this.getClass().getSimpleName() + "_ooxml", sourceExtension);
        reader.getContent(ooxmlTempFile);
        
        // Load the file
        pkg = OPCPackage.open(ooxmlTempFile.getPath());
        
        // Does it have a thumbnail?
        PackageRelationshipCollection rels = 
            pkg.getRelationshipsByType(PackageRelationshipTypes.THUMBNAIL);
        if (rels.size() > 0)
        {
            // Get the thumbnail part
            PackageRelationship tRel = rels.getRelationship(0);
            PackagePart tPart = pkg.getPart(tRel);
            
            // Write it to the target
            InputStream tStream = tPart.getInputStream();
            writer.putContent( tStream );
            tStream.close();
        }
        else
        {
            log.debug("No thumbnail present in " + reader.toString());
            throw new UnimportantTransformException(NO_THUMBNAIL_PRESENT_IN_FILE + targetMimetype);
        }
    } 
    catch (IOException e) 
    {
       throw new AlfrescoRuntimeException("Unable to transform " + sourceExtension + " file.", e);
    }
    finally
    {
        if (pkg != null)
        {
            pkg.close();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:61,代码来源:OOXMLThumbnailContentTransformer.java


示例2: sanitize

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
private void sanitize(BleachSession session, RelationshipSource pkg, Iterable<PackageRelationship> relationships) {
    relationships.iterator().forEachRemaining(packageRelationship -> sanitize(session, pkg, packageRelationship));
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:4,代码来源:OOXMLBleach.java


示例3: ExcelReadOnlySharedStringsTable

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public ExcelReadOnlySharedStringsTable(PackagePart part,
		PackageRelationship rel_ignored) throws IOException, SAXException {
	super(part, rel_ignored);

}
 
开发者ID:bingyulei007,项目名称:bingexcel,代码行数:6,代码来源:ExcelReadOnlySharedStringsTable.java


示例4: XDGFMasters

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFMasters(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel, document);
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:4,代码来源:XDGFMasters.java


示例5: XDGFBaseContents

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFBaseContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel, document);
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:4,代码来源:XDGFBaseContents.java


示例6: XDGFPages

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFPages(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel, document);
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:4,代码来源:XDGFPages.java


示例7: XDGFMasterContents

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFMasterContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel, document);
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:4,代码来源:XDGFMasterContents.java


示例8: XDGFPageContents

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFPageContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel, document);
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:4,代码来源:XDGFPageContents.java


示例9: XDGFXMLDocumentPart

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
public XDGFXMLDocumentPart(PackagePart part, PackageRelationship rel, XDGFDocument document) {
	super(part, rel);
	_document = document;
}
 
开发者ID:BBN-D,项目名称:poi-visio,代码行数:5,代码来源:XDGFXMLDocumentPart.java


示例10: handleEmbeddedParts

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
private void handleEmbeddedParts(ContentHandler handler)
        throws TikaException, IOException, SAXException {
    try {
        for (PackagePart source : getMainDocumentParts()) {
            for (PackageRelationship rel : source.getRelationships()) {

                URI sourceURI = rel.getSourceURI();
                String sourceDesc;
                if (sourceURI != null) {
                    sourceDesc = getJustFileName(sourceURI.getPath());
                    if (sourceDesc.startsWith("slide")) {
                      sourceDesc += "_";
                    } else {
                      sourceDesc = "";
                    }
                } else {
                    sourceDesc = "";
                }
                if (rel.getTargetMode() == TargetMode.INTERNAL) {
                    PackagePart target;

                    try {
                        target = source.getRelatedPart(rel);
                    } catch (IllegalArgumentException ex) {
                        continue;
                    }

                    String type = rel.getRelationshipType();
                    if (RELATION_OLE_OBJECT.equals(type)
                            && TYPE_OLE_OBJECT.equals(target.getContentType())) {
                        handleEmbeddedOLE(target, handler, sourceDesc + rel.getId());
                    } else if (RELATION_AUDIO.equals(type)
                            || RELATION_IMAGE.equals(type)
                            || RELATION_PACKAGE.equals(type)
                            || RELATION_OLE_OBJECT.equals(type)) {
                        handleEmbeddedFile(target, handler, sourceDesc + rel.getId());
                    }
                }
            }
        }
    } catch (InvalidFormatException e) {
        throw new TikaException("Broken OOXML file", e);
    }
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:45,代码来源:AbstractOOXMLExtractor.java


示例11: replaceRelationship

import org.apache.poi.openxml4j.opc.PackageRelationship; //导入依赖的package包/类
/**
    * Replace a relationship by a fake on using the {@link #pushDummyFile(OPCPackage) dummy file} so MS Office does not crash
    * because the relationship does not exist.
    * @param pkg Where the relationship must be removed from
    * @param relationship The relationship to replace
    * @see #pushDummyFile
    */
   private void replaceRelationship(RelationshipSource pkg, PackageRelationship relationship) {
   	String rId = relationship.getId();
   	
   	pkg.removeRelationship(rId);
   	pkg.addRelationship(DUMMY_PACKAGE_PART_NAME, TargetMode.INTERNAL, Relations.OPENXML_OLE_OBJECT, rId);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:14,代码来源:OOXMLBleach.java



注:本文中的org.apache.poi.openxml4j.opc.PackageRelationship类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Call类代码示例发布时间:2022-05-23
下一篇:
Java FlowId类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap