聴衆にプレゼンテーションを行う場合、おそらくスライドに表示されている以上のことを説明したいと思うでしょう。発表資料に発表者のメモを追加することは、プレゼンテーション中に言うべきことを思い出すのに役立つ方法です。この記事では、Spire.Presentation for Java を使用して、Java で PowerPoint の発表者のメモを追加、読み取り、または削除する方法を紹介します。 PowerPoint で発表者のメモを追加する PowerPoint で発表者のメモを読み取る PowerPoint で発表者のメモを削除する Spire.Presentation for Java をインストールします まず、Spire.Presentation for Java を Java プロジェクトに追加する必要があります。JAR ファイルは、このリンクからダウンロードできます。Maven を使用する場合は、次のコードをプロジェクトの pom.xml ファイルに追加する必要があります。 <repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.presentation</artifactId> <version>7.10.1</version> </dependency> </dependencies> PowerPoint で発表者のメモを追加する PowerPoint 文書に発表者のメモを追加する主な手順は、次のとおりです。 Presentation クラスのインスタンスを作成し、Presentation.loadFromFile() メソッドを使用して PowerPoint ドキュメントを読み込みます。 Presentation.getSlides().get(slideIndex) メソッドを使用して、発表者のメモを追加したいスライドを取得します。 ISlide.addNotesSlides() メソッドを使用して、メモスライドをスライドに追加します。 ParagraphEx クラスのインスタンスを作成します。 ParagraphEx.setText() メソッドを使用して、段落のテキストを設定し、NotesSlide.getNotesTextFrame().getParagraphs().append() メソッドを使用して、メモスライドに段落を追加しています。 Presentation.saveToFile() メソッドを使用して、結果ドキュメントを保存します。 Java import com.spire.presentation.*; public class addSpeakerNotes { public static void main(String []args) throws Exception { //Presentationクラスのインスタンスを作成し、PowerPointドキュメントを読み込む Presentation ppt = new Presentation(); ppt.loadFromFile("庭園に影響を与える要因.pptx"); //最初のスライドを取得する ISlide slide = ppt.getSlides().get(0); //ノートスライドを追加する NotesSlide notesSlide = slide.addNotesSlide(); //ノートスライドに段落を追加する ParagraphEx paragraph = new ParagraphEx(); paragraph.setText("効果的なプレゼンテーションを行うためのヒント。"); notesSlide.getNotesTextFrame().getParagraphs().append(paragraph); //ノートスライドに段落を追加する paragraph = new ParagraphEx(); paragraph.setText("スライドマスター機能を使って、一貫性のある簡潔なテンプレートを作成します。"); notesSlide.getNotesTextFrame().getParagraphs().append(paragraph); //ノートスライドに段落を追加する paragraph = new ParagraphEx(); paragraph.setText("各画面の文字数を簡略化し、制限する。"); notesSlide.getNotesTextFrame().getParagraphs().append(paragraph); //ノートスライドに段落を追加する paragraph = new ParagraphEx(); paragraph.setText("文字と背景は対照的な色を使用する。"); notesSlide.getNotesTextFrame().getParagraphs().append(paragraph); //ノートスライドの特定の段落に、箇条書きの種類とスタイルを設定する for (int i = 1; i < notesSlide.getNotesTextFrame().getParagraphs().getCount();i++) { notesSlide.getNotesTextFrame().getParagraphs().get(i).setBulletType(TextBulletType.NUMBERED); notesSlide.getNotesTextFrame().getParagraphs().get(i).setBulletStyle(NumberedBulletStyle.BULLET_ARABIC_PERIOD); } //結果ドキュメントを保存する ppt.saveToFile("発表者のメモの追加.pptx", FileFormat.PPTX_2013); } } PowerPoint で発表者のメモを読み取る PowerPoint のスライドに発表者のメモを読み取る手順は次のとおりです。 Presentation クラスのインスタンスを作成し、Presentation.loadFromFile() メソッドを使用して PowerPoint ドキュメントを読み込みます。 Presentation.getSlides().get(slideIndex) メソッドを使用して、発表者のメモを読み取りたいスライドを取得します。 ISlide.getNotesSlide() メソッドを使用して、スライドからノートスライドを取得します。 NotesSlide.getNotesTextFrame().getText() メソッドを使用して、ノートスライドから発表者のメモを取得します。 StringBuilder クラスのインスタンスを作成します。 発表者のメモを StringBuilder に追加し、.txtファイルに書き出します。 Java import com.spire.presentation.ISlide; import com.spire.presentation.NotesSlide; import com.spire.presentation.Presentation; import java.io.FileWriter; public class readSpeakerNotes { public static void main(String []args) throws Exception { //Presentationクラスのインスタンスを作成し、PowerPointドキュメントを読み込む Presentation ppt = new Presentation(); ppt.loadFromFile("発表者のメモの追加.pptx"); //最初のスライドを取得する ISlide slide = ppt.getSlides().get(0); //最初のスライドからノートスライドを取得する NotesSlide notesSlide = slide.getNotesSlide(); //ノートスライドから発表者のメモを取得する String notes = notesSlide.getNotesTextFrame().getText(); //StringBuilderクラスのインスタンスを作成する StringBuilder sb = new StringBuilder(); //発表者のメモをStringbuilderに追加する sb.append(notes + "n"); //発表者のメモを.txtファイルに保存する FileWriter writer = new FileWriter("発表者のメモ.txt"); writer.write(sb.toString()); writer.flush(); writer.close(); } } PowerPoint で発表者のメモを削除する PowerPoint のスライドから発表者のメモを削除する手順は次のとおりです。 Presentation クラスのインスタンスを作成し、Presentation.loadFromFile() メソッドを使用して PowerPoint ドキュメントを読み込みます。 Presentation.getSlides().get(slideIndex) メソッドを使用して、発表者のメモを削除したいスライドを取得します。 ISlide.getNotesSlide() メソッドを使用して、スライドからノートスライドを取得します。 NotesSlide.getNotesTextFrame().getParagraphs().removeAt(paragraphIndex) メソッドを使用してノートスライドから特定の発表者のメモを削除するか、NotesSlide.getNotesTextFrame().getParagraphs().clear() メソッドを使用してノートスライドからすべての発表者のメモを削除してください。 Presentation.saveToFile() メソッドを使用して、結果ドキュメントを保存します。 Java import com.spire.presentation.FileFormat; import com.spire.presentation.ISlide; import com.spire.presentation.NotesSlide; import com.spire.presentation.Presentation; public class deleteSpeakerNotes { public static void main(String []args) throws Exception { //Presentationクラスのインスタンスを作成し、PowerPointドキュメントを読み込む Presentation ppt = new Presentation(); ppt.loadFromFile("発表者のメモの追加.pptx"); //最初のスライドを取得する ISlide slide = ppt.getSlides().get(0); //スライドからノートスライドを取得する NotesSlide notesSlide = slide.getNotesSlide(); //ノートスライドから特定の発表者のメモを削除する notesSlide.getNotesTextFrame().getParagraphs().removeAt(1); //ノートスライドから発表者のメモをすべて削除する notesSlide.getNotesTextFrame().getParagraphs().clear(); //結果ドキュメントを保存する ppt.saveToFile("発表者のメモの削除.pptx", FileFormat.PPTX_2013); } } 一時ライセンスを申請する 結果ドキュメントから評価メッセージを削除したい場合、または機能制限を取り除く場合は、についてこのメールアドレスはスパムボットから保護されています。閲覧するにはJavaScriptを有効にする必要があります。 にお問い合わせ、30 日間有効な一時ライセンスを取得してください。