資源簡介
Free Spire.Presentation for Java 是一個專業的PowerPoint API,開發人員可以在Java應用程序中創建、讀取、寫入、轉換和保存PowerPoint文檔。作為一款獨立的Java組件,Free Spire.Presentation for Java的運行環境無需安裝Microsoft PowerPoint。
它支持功能十分豐富,如添加/編輯/刪除幻燈片,創建圖表、表格,添加項目符號,加密和解密PPT,添加水印,插入超鏈接、音頻和視頻,段落設置,文檔屬性設置,插入/提取圖片,提取文本,設置動畫,添加頁眉頁腳,添加/刪除批注,創建SmartArt等。同時,也支持將PowerPoint文檔高質量地轉換為圖片、PDF、PPTX以及SVG等文件。
代碼片段和文件信息
import?com.spire.presentation.*;
import?com.spire.presentation.drawing.FillFormatType;
import?java.awt.Color;
import?java.awt.Rectangle;
public?class?helloWorld?{
????public?static?void?main(String[]?args)?throws?Exception?{
????????String?outputFile?=?“output/helloWorld_result.pptx“;
????????//Create?PPT?document
????????Presentation?presentation?=?new?Presentation();
????????//Add?new?shape?to?PPT?document
????????Rectangle?rec?=?new?Rectangle((int)presentation.getSlideSize().getSize().getWidth()?/?2?-?250?80?500?150);
????????IAutoShape?shape?=?presentation.getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE?rec);
????????shape.getShapestyle().getLineColor().setColor(Color.white);
????????shape.getFill().setFillType(FillFormatType.NONE);
????????//Add?text?to?shape
????????shape.appendTextframe(“Hello?World!“);
????????//Set?the?font?and?fill?style?of?text
????????PortionEx?textRange?=?shape.getTextframe().getTextRange();
????????textRange.getFill().setFillType(FillFormatType.SOLID);
????????textRange.getFill().getSolidColor().setColor(Color.blue);
????????textRange.setFontHeight(66);
????????textRange.setLatinFont(new?TextFont(“Lucida?Sans?Unicode“));
????????//Save?the?document
????????presentation.saveToFile(outputFile?FileFormat.PPTX_2010);
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-30?11:46??lib\
?????文件????14756111??2018-11-30?11:44??lib\Spire.Common.jar
?????文件????11535400??2018-11-30?11:44??lib\Spire.Pdf.jar
?????文件????10796004??2018-11-30?11:44??lib\Spire.Presentation.jar
?????目錄???????????0??2018-11-30?11:35??samples\
?????目錄???????????0??2018-11-30?11:35??samples\01_quickGuide\
?????文件????????1330??2018-11-30?11:35??samples\01_quickGuide\helloWorld.java
?????目錄???????????0??2018-11-30?11:35??samples\02_paragraphAndText\
?????文件????????1829??2018-11-30?11:35??samples\02_paragraphAndText\addWatermark.java
?????文件????????1113??2018-11-30?11:35??samples\02_paragraphAndText\alignment.java
?????文件????????2100??2018-11-30?11:35??samples\02_paragraphAndText\appendHTML.java
?????文件????????1592??2018-11-30?11:35??samples\02_paragraphAndText\bordersAndShading.java
?????文件?????????952??2018-11-30?11:35??samples\02_paragraphAndText\bullets.java
?????文件????????1985??2018-11-30?11:35??samples\02_paragraphAndText\changeTextst
?????文件????????1113??2018-11-30?11:35??samples\02_paragraphAndText\extractText.java
?????文件????????4308??2018-11-30?11:35??samples\02_paragraphAndText\hyperli
?????文件????????1245??2018-11-30?11:35??samples\02_paragraphAndText\indent.java
?????目錄???????????0??2018-11-30?11:35??samples\03_imagesAndShapes\
?????文件????????3401??2018-11-30?11:35??samples\03_imagesAndShapes\addShapes.java
?????文件????????2942??2018-11-30?11:35??samples\03_imagesAndShapes\background.java
?????文件????????1423??2018-11-30?11:35??samples\03_imagesAndShapes\em
?????文件?????????783??2018-11-30?11:35??samples\03_imagesAndShapes\extractImage.java
?????文件?????????950??2018-11-30?11:35??samples\03_imagesAndShapes\fillShapeWithGradient.java
?????文件????????1147??2018-11-30?11:35??samples\03_imagesAndShapes\fillShapeWithPicture.java
?????文件?????????990??2018-11-30?11:35??samples\03_imagesAndShapes\insertImage.java
?????文件?????????890??2018-11-30?11:35??samples\03_imagesAndShapes\rotateShape.java
?????文件?????????816??2018-11-30?11:35??samples\03_imagesAndShapes\shapeToImage.java
?????目錄???????????0??2018-11-30?11:35??samples\04_tableAndChart\
?????文件????????1312??2018-11-30?11:35??samples\04_tableAndChart\addImageInTableCell.java
?????文件????????2361??2018-11-30?11:35??samples\04_tableAndChart\changeTextFontInChart.java
?????文件????????2873??2018-11-30?11:35??samples\04_tableAndChart\chartAxis.java
............此處省略560個文件信息
- 上一篇:Java編寫類似Flash的播放器
- 下一篇:Maven中主要jar包集合
評論
共有 條評論