Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
What Is poi-examples-5.2.3.jar?
What Is poi-examples-5.2.3.jar?
✍: FYIcenter.com
poi-examples-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-examples-5.2.3.jar provides examples for both poi.jar and poi-ooxml.jar components.
poi-examples-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-examples-5.2.3.jar Target JDK version: 1.6 Dependency: poi.jar poi-ooxml.jar File name: poi-examples-5.2.3.jar File size: 388829 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-examples-5.2.3.jar:
⏎ org/apache/poi/examples/xslf/SmartArtConversionDemo.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.examples.xslf; import org.apache.poi.ooxml.POIXMLDocumentPart; import org.apache.poi.util.LocaleUtil; import org.apache.poi.xslf.usermodel.*; import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; /** * Converts SmartArt to openxml shapes and saves the result to the specified output path. */ public class SmartArtConversionDemo { private final XMLSlideShow inputPptx; private final XMLSlideShow outputPptx; SmartArtConversionDemo(XMLSlideShow inputPptx, XMLSlideShow outputPptx) { this.inputPptx = inputPptx; this.outputPptx = outputPptx; } public static void main(String[] args) throws IOException { if (args.length != 2) { System.out.println("Expected arguments: <inputPath> <outputPath>"); System.exit(1); } File inputFile = new File(args[0]); if (!inputFile.exists()) { System.out.printf(LocaleUtil.getUserLocale(), "Unable to find input file at path: %s", args[0]); System.exit(1); } try ( FileInputStream inputPptxStream = new FileInputStream(inputFile); FileOutputStream outputPptxStream = new FileOutputStream(args[1]) ) { XMLSlideShow inputPptx = new XMLSlideShow(inputPptxStream); XMLSlideShow outputPptx = new XMLSlideShow(); SmartArtConversionDemo demo = new SmartArtConversionDemo(inputPptx, outputPptx); demo.convertSmartArt(); outputPptx.write(outputPptxStream); } } private static void copyAndUpdateImageRelations(XSLFDiagram diagram, XSLFSlide outputSlide) throws IOException { XSLFGroupShape inputGroupShape = diagram.getGroupShape(); for (XSLFShape shape : inputGroupShape.getShapes()) { org.openxmlformats.schemas.presentationml.x2006.main.CTShape ctShape = (org.openxmlformats.schemas.presentationml.x2006.main.CTShape) shape.getXmlObject(); if (ctShape.getSpPr().getBlipFill() == null) { continue; } CTBlipFillProperties blipFillProps = ctShape.getSpPr().getBlipFill(); CTBlip blip = blipFillProps.getBlip(); // Relationships for SmartArt diagrams are stored in `drawing#.xml.rels`, not `slide#.xml.rels`. POIXMLDocumentPart inputPicturePart = diagram.getDiagramDrawing().getRelationById(blip.getEmbed()); if (inputPicturePart == null || inputPicturePart.getPackagePart() == null) { continue; } XSLFPictureData inputPictureData = new XSLFPictureData(inputPicturePart.getPackagePart()); // Copy the input image to the output slides and update the shape to reference the copied image XMLSlideShow outputPptx = outputSlide.getSlideShow(); XSLFPictureData outputPictureData = outputPptx.addPicture( inputPicturePart.getPackagePart().getInputStream(), inputPictureData.getType()); POIXMLDocumentPart.RelationPart outputRelation = outputSlide.addRelation(null, XSLFRelation.IMAGES, outputPictureData); ctShape.getSpPr().getBlipFill().getBlip().setEmbed(outputRelation.getRelationship().getId()); } } private static XSLFTheme extractTheme(XMLSlideShow slideShow) { if (!slideShow.getSlideMasters().isEmpty()) { return slideShow.getSlideMasters().get(0).getTheme(); } return null; } private void convertSmartArt() throws IOException { // Copy page size and theme outputPptx.setPageSize(inputPptx.getPageSize()); XSLFTheme theme = extractTheme(inputPptx); if (theme != null) { outputPptx.getSlideMasters().get(0).getTheme().getXmlObject().set(theme.getXmlObject()); } for (XSLFSlide inputSlide : inputPptx.getSlides()) { XSLFSlide outputSlide = outputPptx.createSlide(); List<XSLFShape> inputShapes = inputSlide.getShapes(); for (XSLFShape shape : inputShapes) { if (shape instanceof XSLFDiagram) { copyDiagramToOutput((XSLFDiagram) shape, outputSlide); } else { XSLFAutoShape autoShape = outputSlide.createAutoShape(); // Hacky hack. Reassign xml to copy the content over. autoShape.getXmlObject().set(shape.getXmlObject()); } } } } private void copyDiagramToOutput(XSLFDiagram inputDiagram, XSLFSlide outputSlide) throws IOException { // This method modifies the underlying xml of the input shapes. We modify the xml structure first, then // assign that to our output shape. copyAndUpdateImageRelations(inputDiagram, outputSlide); XSLFGroupShape inputGroupShape = inputDiagram.getGroupShape(); XSLFGroupShape outputGroupShape = outputSlide.createGroup(); outputGroupShape.getXmlObject().set(inputGroupShape.getXmlObject()); } }
⏎ org/apache/poi/examples/xslf/SmartArtConversionDemo.java
Or download all of them as a single archive file:
File name: poi-examples-5.2.3-src.zip File size: 396538 bytes Release date: 2022-09-09 Download
⇒ Download and Install poi-bin-3.15-20160924.zip
⇐ What Is poi-scratchpad-5.2.3.jar?
2017-03-22, 11203👍, 0💬
Popular Posts:
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Jav...
layout.jar is a component in iText Java library to provide layout functionalities. iText Java librar...
What Is mail.jar of JavaMail 1.3? I got the JAR file from javamail-1_3.zip. mail.jar in javamail-1_3...
What Is wstx-asl-3.2.8.jar? wstx-asl-3.2.8.jar is JAR file for the ASL component of Woodstox 3.2.8. ...