Java의 PowerPoint에서 슬라이드 레이아웃 적용
7747 단어 freeslidelayoutjava
설치
방법 1: Free Spire.Presentation for Java을 다운로드하고 압축을 풉니다. 그런 다음 Spire.Presentation.jar 파일을 종속성으로 프로젝트에 추가합니다.
방법 2: pom.xml에 다음 구성을 추가하여 maven 프로젝트에 jar 종속성을 추가할 수도 있습니다.
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.presentation.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>
1# 제목 슬라이드 레이아웃 적용:
import com.spire.presentation.*;
public class SlideLayout {
public static void main(String[] args) throws Exception{
//Create an instance of presentation document
Presentation ppt = new Presentation();
//Remove the default slide
ppt.getSlides().removeAt(0);
//Append a slide and set its layout
ISlide slide = ppt.getSlides().append(SlideLayoutType.TITLE);
//Add content for Title and Text
IAutoShape shape = (IAutoShape)slide.getShapes().get(0);
shape.getTextFrame().setText("The Scarlet Letter");
shape = (IAutoShape)slide.getShapes().get(1);
shape.getTextFrame().setText("A Dark Romanticism Fiction");
//Save the document
ppt.saveToFile("SlideLayout.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}
2# 11가지 다양한 슬라이드 레이아웃 적용:
import com.spire.presentation.*;
public class DifferentSlideLayout {
public static void main(String[] args) throws Exception{
//Create a PPT document
Presentation presentation = new Presentation();
//Remove the default slide
presentation.getSlides().removeAt(0);
//Loop through slide layouts
for (SlideLayoutType type : SlideLayoutType.values())
{
//Append slide by specified slide layout
presentation.getSlides().append(type);
}
//Save the document
presentation.saveToFile("Result.pptx", FileFormat.PPTX_2013);
presentation.dispose();
}
}
Reference
이 문제에 관하여(Java의 PowerPoint에서 슬라이드 레이아웃 적용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/codesharing/apply-slide-layouts-in-powerpoint-in-java-29bj텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)