แยกวิเคราะห์รูปแบบ PPTX ใน Java
การแยกวิเคราะห์เอกสาร PPTX ดั้งเดิมและประสิทธิภาพสูงโดยใช้ Aspose.Slides ฝั่งเซิร์ฟเวอร์สำหรับ Java API โดยไม่ต้องใช้ซอฟต์แวร์ใดๆ เช่น Microsoft หรือ Adobe PDF
วิธีแยกไฟล์ PPTX โดยใช้ Java
ในการแยกวิเคราะห์ไฟล์ PPTX เราจะใช้
API ซึ่งเป็น API การแยกวิเคราะห์ที่มีคุณลักษณะหลากหลาย มีประสิทธิภาพ และใช้งานง่ายสำหรับแพลตฟอร์ม Java คุณสามารถดาวน์โหลดเวอร์ชันล่าสุดได้โดยตรงจาก
และติดตั้งภายในโปรเจ็กต์ที่ใช้ Maven โดยเพิ่มการกำหนดค่าต่อไปนี้ใน pom.xml
ที่เก็บ
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://releases.aspose.com/java/repo/</url>
</repository>
การพึ่งพา
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>version of aspose-slides API</version>
<classifier>jdk17</classifier>
</dependency>
ขั้นตอนในการแยกวิเคราะห์ไฟล์ PPTX ใน Java
การแยกวิเคราะห์เอกสารพื้นฐานด้วย API ของ Aspose.Slides for Java สามารถทำได้โดยใช้โค้ดเพียงไม่กี่บรรทัด
โหลดไฟล์ PPTX โดยสร้างคลาสการนำเสนอ
รับกรอบข้อความสไลด์แรก
วนซ้ำแต่ละส่วนย่อหน้า
รับผลลัพธ์ที่ต้องการ เช่น ข้อความ แบบอักษร ฯลฯ
ความต้องการของระบบ
Aspose.Slides สำหรับ Java รองรับบนแพลตฟอร์มหลักและระบบปฏิบัติการทั้งหมด โปรดตรวจสอบให้แน่ใจว่าคุณมีข้อกำหนดเบื้องต้นดังต่อไปนี้
- Microsoft Windows หรือ OS ที่เข้ากันได้กับ Java Runtime Environment สำหรับแอปพลิเคชัน JSP/JSF และแอปพลิเคชันเดสก์ท็อป
- รับเวอร์ชันล่าสุดของ Aspose.Slides สำหรับ Java โดยตรงจาก Maven
แยกไฟล์ PPTX - Java
//Load PPTX file
Presentation pptxPresentation = new Presentation("demo.pptx");
try{
//Get an Array of TextFrameEx objects from the first slide
ITextFrame[] textFramesSlideOne = SlideUtil.getAllTextBoxes(pptxPresentation.getSlides().get_Item(0));
//Loop through the Array of TextFrames
for (int i = 0; i < textFramesSlideOne.length; i++){
//Loop through paragraphs in current TextFrame
for (IParagraph para : textFramesSlideOne[0].getParagraphs()){
//Loop through portions in the current Paragraph
for (IPortion port : para.getPortions()){
//Display text in the current portion
System.out.print(port.getText());
//Display font height of the text
System.out.print(port.getPortionFormat().getFontHeight());
//Display font name of the text
System.out.print(port.getPortionFormat().getLatinFont().getFontName());
}
}
}
} finally {
if (pptxPresentation != null) pptxPresentation.dispose();
}
//Similarly extarcting text from the Whole Presentation
//Use getAllTextFrames(pptxPresentation, true) method and Iterate through Array
เกี่ยวกับ Aspose.Slides สำหรับ Java API
Aspose.Slides API สามารถใช้อ่าน เขียน จัดการ และแปลงเอกสาร Microsoft PowerPoint เป็น PDF, XPS, HTML, TIFF, ODP และรูปแบบอื่นๆ ได้ หนึ่งสามารถสร้างไฟล์ใหม่ตั้งแต่เริ่มต้นและบันทึกในรูปแบบที่รองรับที่เกี่ยวข้อง Aspose.Slides เป็น API แบบสแตนด์อโลนสำหรับการสร้าง แยกวิเคราะห์ หรือจัดการการนำเสนอ สไลด์ และองค์ประกอบ และไม่ขึ้นกับซอฟต์แวร์ใดๆ เช่น Microsoft หรือ OpenOfficeOnline PPTX Parser Live Demos
Extract text and images from PPTX documents right now by visiting our Live Demos website . The live demo has the following benefits
PPTX PPTX รูปแบบไฟล์คืออะไร
Files with PPTX extension are presentation files created with popular Microsoft PowerPoint application. Unlike the previous version of presentation file format PPT which was binary, the PPTX format is based on the Microsoft PowerPoint open XML presentation file format. A presentation file is a collection of slides where each slide can comprise of text, images, formatting, animations, and other media. These slides are presented to audience in the form of slideshows with custom presentation settings.
อ่านเพิ่มเติม