:How to Add Combined Graphics in PPT Slides with Java-PPT tutorial免费ppt模版下载-道格办公

How to Add Combined Graphics in PPT Slides with Java

It is a sample code for adding combined graphics to PPT slides in Java: ```javaimport java.awt.Color;import java.io.FileInputStream;import java.io.FileOutputStream;import org.apache.poi.sl.usermodel .PictureData;import org.apache.poi.sl.usermodel.PictureS

A variety of different types of shapes or graphics can be added to the PPT slide. When the single shape in the slide does not meet the graphics requirements, Individual shapes can be combined arbitrarily through shape combination to achieve the desired shape effect. Next, the Java program will be used to introduce the method of adding combined shapes (graphics) in the PPT slide.

    ppt template article recommendation:

    How to use ppt to make diagrams of basic soccer footwork

    How to use ppt to make diagrams of music conductor gestures

    How to extract high-definition pictures contained in PPT

Free Spire.Presentation for Java (Free Edition)

IntelliJ IDEA

jar file acquisition and import:

Method 1: You can download the jar file package from Eiceblue official website. After downloading, unzip the file, and import the Spire.Presentation.jar file under the lib folder into the java program. Refer to the following import effects:



Method 2: Install through the Maven repository.

ENDJava sample code

import com.spire.presentation.*;

import com.spire.presentation.drawing.FillFormatType;

import java.awt.geom.Rectangle2D;

import java.util.ArrayList;

public class CreateGroupShapes {

public static void main(String[] args) throws Exception{

//Create PPT document

Presentation ppt = new Presentation();

//Get the first slide

ISlide slide = ppt.getSlides().get(0);

//add ribbon shape

IShape ribbon = slide.getShapes().appendShape(ShapeType.RIBBON, new Rectangle2D.Double(250,100,250,40));

ribbon.getFill().setFillType(FillFormatType.SOLID);

ribbon.getFill().getSolidColor().setKnownColor(KnownColors.GOLD);

ribbon.getLine().setWidth(0.1f);

//Add a heart shape

IShape heart = slide. getShapes(). appendShape(ShapeType. HEART, new Rectangle2D. Double(335, 80, 80, 80));

heart.getFill().setFillType(FillFormatType.SOLID);

heart.getFill().getSolidColor().setKnownColor(KnownColors.RED);

heart.getLine().setWidth(0.1f);

//Add two shapes to the ArrayList array

ArrayList list = new ArrayList();

list.add((Shape)ribbon);

list.add((Shape)heart);

// Combine the shapes in the array

ppt.getSlides().get(0).groupShapes(list);

//Save the document

ppt.saveToFile("GroupShapes.pptx", FileFormat.PPTX_2013);

ppt.dispose();

}

}

Combined shapes to add effects:



Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/How%20to%20Add%20Combined%20Graphics%20in%20PPT%20Slides%20with%20Java.html

Like (810)
Reward 支付宝扫一扫 支付宝扫一扫
single-end

Related Suggestion