# Javaを介してPPTXドキュメントからテキストと画像を抽出します

> JSP/JSFアプリケーションおよびデスクトップアプリケーション用のJavaランタイム環境でPPTXファイルからテキストと画像を抽出するためのJavaサンプルコード。

Source: https://products.aspose.com/slides/ja/java/parser/pptx/
Updated: 2026-08-11



## Javaを使用してPPTXファイルを解析する方法

 PPTXファイルを解析するために、
 [Aspose.Slides for Java](https://products.aspose.com/slides/ja/java)
 機能豊富で強力で使いやすいJavaプラットフォーム用の解析APIであるAPI。最新バージョンはから直接ダウンロードできます
 [Maven](https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-slides)
 次の構成をpom.xmlに追加して、Mavenベースのプロジェクトにインストールします。

### リポジトリ

```xml

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://releases.aspose.com/java/repo/</url>
</repository>

```

### 依存

```xml

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>26.8</version>
    <classifier>jdk16</classifier>
</dependency>
```

## JavaでPPTXファイルを解析する手順

[Aspose.Slides for Java](https://products.aspose.com/slides/ja/java)APIを使用した基本的なドキュメントの解析は、わずか数行のコードで実行できます。

Presentationクラスを開始してPPTXファイルをロードします。

最初のスライドテキストフレームを取得します。

各段落部分をループします。

テキスト、フォントなどの必要な出力を取得します。

## システム要求

 Aspose.Slides for Javaは、すべての主要なプラットフォームとオペレーティングシステムでサポートされています。次の前提条件があることを確認してください。

-MicrosoftWindowsまたはJSP/JSFアプリケーションおよびデスクトップアプリケーション用のJavaランタイム環境と互換性のあるOS。
-最新バージョンのAspose.SlidesforJavaを直接入手する
 [Maven](https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-slides)。

### PPTXファイルの解析-Java

```cs
//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 forJavaAPIについて

 Aspose.Slides APIを使用して、Microsoft PowerPointドキュメントの読み取り、書き込み、操作、およびPDF、XPS、HTML、TIFF、ODP、その他のさまざまな形式への変換を行うことができます。新しいファイルを最初から作成し、サポートされている関連する形式で保存できます。 Aspose.Slidesは、プレゼンテーション、スライド、要素を作成、解析、または操作するためのスタンドアロンAPIであり、MicrosoftやOpenOfficeなどのソフトウェアに依存しません。

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.

## その他のサポートされている解析ドキュメント

- [ODP](https://products.aspose.com/slides/ja/java/parser/odp/) — OpenDocumentプレゼンテーション形式
- [PPT](https://products.aspose.com/slides/ja/java/parser/ppt/) — Microsoft PowerPoint 97-2003
