Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-ooxml-5.2.3.jar?
What Is poi-ooxml-5.2.3.jar?
✍: FYIcenter.com
poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-ooxml-5.2.3.jar supports Apache POI components that read and write Microsoft's Open Office XML document format, which is used in recent versions of Microsoft Office tools like Word 2007, Excel 2007, PowerPoint 2007, etc.
poi-ooxml-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-ooxml-5.2.3.jar Target JDK version: 9 Dependency: poi.jar xmlbeans.jar ooxml-schemas.jar commons-collections.jar junit.jar File name: poi-ooxml.jar, poi-ooxml-5.2.3.jar File size: 2010497 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-ooxml-5.2.3.jar:
⏎ org/apache/poi/ooxml/util/PackageHelper.java
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ooxml.util;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackagePartName;
import org.apache.poi.openxml4j.opc.PackageProperties;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Removal;
/**
* Provides handy methods to work with OOXML packages
*/
public final class PackageHelper {
public static OPCPackage open(InputStream is) throws IOException {
return open(is, false);
}
/**
* @param stream The InputStream to read from
* @param closeStream whether to close the stream (default is false)
* @since POI 5.2.0
* @return OPCPackage
* @throws IOException If reading data from the stream fails
*/
public static OPCPackage open(InputStream stream, boolean closeStream) throws IOException {
try {
return OPCPackage.open(stream);
} catch (InvalidFormatException e){
throw new POIXMLException(e);
} finally {
if (closeStream) {
stream.close();
}
}
}
/**
* Clone the specified package.
*
* @param pkg the package to clone
* @param file the destination file
* @return the cloned package
* @deprecated this method is not used internally and creates temp files that are not well handled
*/
@Deprecated
@Removal(version = "6.0.0")
public static OPCPackage clone(OPCPackage pkg, File file) throws OpenXML4JException, IOException {
String path = file.getAbsolutePath();
try (OPCPackage dest = OPCPackage.create(path)) {
PackageRelationshipCollection rels = pkg.getRelationships();
for (PackageRelationship rel : rels) {
PackagePart part = pkg.getPart(rel);
PackagePart part_tgt;
if (rel.getRelationshipType().equals(PackageRelationshipTypes.CORE_PROPERTIES)) {
copyProperties(pkg.getPackageProperties(), dest.getPackageProperties());
continue;
}
dest.addRelationship(part.getPartName(), rel.getTargetMode(), rel.getRelationshipType());
part_tgt = dest.createPart(part.getPartName(), part.getContentType());
try (
InputStream in = part.getInputStream();
OutputStream out = part_tgt.getOutputStream()
) {
IOUtils.copy(in, out);
}
if (part.hasRelationships()) {
copy(pkg, part, dest, part_tgt);
}
}
}
//the temp file will be deleted when JVM terminates
new File(path).deleteOnExit();
return OPCPackage.open(path);
}
/**
* Recursively copy package parts to the destination package
*/
private static void copy(OPCPackage pkg, PackagePart part, OPCPackage tgt, PackagePart part_tgt) throws OpenXML4JException, IOException {
PackageRelationshipCollection rels = part.getRelationships();
if(rels != null) for (PackageRelationship rel : rels) {
PackagePart p;
if(rel.getTargetMode() == TargetMode.EXTERNAL){
part_tgt.addExternalRelationship(rel.getTargetURI().toString(), rel.getRelationshipType(), rel.getId());
//external relations don't have associated package parts
continue;
}
URI uri = rel.getTargetURI();
if(uri.getRawFragment() != null) {
part_tgt.addRelationship(uri, rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
continue;
}
PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
p = pkg.getPart(relName);
part_tgt.addRelationship(p.getPartName(), rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
PackagePart dest;
if(!tgt.containPart(p.getPartName())){
dest = tgt.createPart(p.getPartName(), p.getContentType());
try (
InputStream in = p.getInputStream();
OutputStream out = dest.getOutputStream()
) {
IOUtils.copy(in, out);
}
copy(pkg, p, tgt, dest);
}
}
}
/**
* Copy core package properties
*
* @param src source properties
* @param tgt target properties
*/
private static void copyProperties(PackageProperties src, PackageProperties tgt) {
tgt.setCategoryProperty(src.getCategoryProperty());
tgt.setContentStatusProperty(src.getContentStatusProperty());
tgt.setContentTypeProperty(src.getContentTypeProperty());
tgt.setCreatorProperty(src.getCreatorProperty());
tgt.setDescriptionProperty(src.getDescriptionProperty());
tgt.setIdentifierProperty(src.getIdentifierProperty());
tgt.setKeywordsProperty(src.getKeywordsProperty());
tgt.setLanguageProperty(src.getLanguageProperty());
tgt.setRevisionProperty(src.getRevisionProperty());
tgt.setSubjectProperty(src.getSubjectProperty());
tgt.setTitleProperty(src.getTitleProperty());
tgt.setVersionProperty(src.getVersionProperty());
}
}
⏎ org/apache/poi/ooxml/util/PackageHelper.java
Or download all of them as a single archive file:
File name: poi-ooxml-5.2.3-src.zip File size: 1396572 bytes Release date: 2022-09-09 Download
⇒ What Is poi-excelant-5.2.3.jar?
2017-04-01, ≈124🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
JDK 11 java.rmi.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) module. JDK 11 RMI m...
What JAR files are required to run dom\Writer.java provided in the Apache Xerces package? 3 JAR file...
commons-collections4-4.2 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
How to read XML document from socket connections with the socket\DelayedInput.java provided in the A...