แยกวิเคราะห์รูปแบบ ODP ใน Java
การแยกวิเคราะห์เอกสาร ODP ดั้งเดิมและประสิทธิภาพสูงโดยใช้ Aspose.Slides ฝั่งเซิร์ฟเวอร์สำหรับ Java API โดยไม่ต้องใช้ซอฟต์แวร์ใดๆ เช่น Microsoft หรือ Adobe PDF
วิธีแยกไฟล์ ODP โดยใช้ Java
ในการแยกวิเคราะห์ไฟล์ ODP เราจะใช้
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>
ขั้นตอนในการแยกวิเคราะห์ไฟล์ ODP ใน Java
การแยกวิเคราะห์เอกสารพื้นฐานด้วย API ของ Aspose.Slides for Java สามารถทำได้โดยใช้โค้ดเพียงไม่กี่บรรทัด
โหลดไฟล์ ODP โดยสร้างคลาสการนำเสนอ
รับกรอบข้อความสไลด์แรก
วนซ้ำแต่ละส่วนย่อหน้า
รับผลลัพธ์ที่ต้องการ เช่น ข้อความ แบบอักษร ฯลฯ
ความต้องการของระบบ
Aspose.Slides สำหรับ Java รองรับบนแพลตฟอร์มหลักและระบบปฏิบัติการทั้งหมด โปรดตรวจสอบให้แน่ใจว่าคุณมีข้อกำหนดเบื้องต้นดังต่อไปนี้
- Microsoft Windows หรือ OS ที่เข้ากันได้กับ Java Runtime Environment สำหรับแอปพลิเคชัน JSP/JSF และแอปพลิเคชันเดสก์ท็อป
- รับเวอร์ชันล่าสุดของ Aspose.Slides สำหรับ Java โดยตรงจาก Maven
แยกไฟล์ ODP - Java
//Load ODP file
Presentation odpPresentation = new Presentation("demo.odp");
try{
//Get an Array of TextFrameEx objects from the first slide
ITextFrame[] textFramesSlideOne = SlideUtil.getAllTextBoxes(odpPresentation.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 (odpPresentation != null) odpPresentation.dispose();
}
//Similarly extarcting text from the Whole Presentation
//Use getAllTextFrames(odpPresentation, 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 ODP Parser Live Demos
Extract text and images from ODP documents right now by visiting our Live Demos website . The live demo has the following benefits
ODP ODP รูปแบบไฟล์คืออะไร
Files with ODP extension represent presentation file format used by OpenOffice.org in the OASISOpen standard. 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. ODP files can be opened by applications that conform to the OpenDocument format (such as OpenOffice or StarOffice).
อ่านเพิ่มเติม