PowerPoint プレゼンテーションを作成する際には、いかにスライドを読みやすくするかは非常に重要です。最も一般的な方法の1つは、テキストを番号付き、箇条書きリストとしてフォーマットすることです。この方法は、簡潔で明瞭な方法で情報を表現することができ、読者の注意を引くことができます。この記事では、Spire.Presentation for 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>8.1.2</version> </dependency> </dependencies> PowerPoint で番号付きリストを作成する Spire.Presentation では、番号付き、箇条書きリストを作成するために段落の前に数字や行頭記号を追加できます。ParagraphEx.setBulletType() メソッドを使用して、行頭文字のタイプを指定できます。以下は具体的な操作手順です。 Presentation オブジェクトを作成します。 Presentation.getSlides().get() メソッドを使用して最初のスライドを取得します。 ISlide.getShapes().appendShape() メソッドを使用してスライドに図形を追加します。 文字列リスト内のリストの内容を指定します。 リストの内容に基づいて段落を作成し、ParagraphEx.setBulletType() メソッドを使用して、これらの段落の行頭文字のタイプを NUMBERED に設定します。 ParagraphEx.setBulletStyle() メソッドを使用して、番号付き行頭文字のスタイルを設定します。 Presentation.saveToFile() メソッドを使用して、ドキュメントを PowerPoint に保存します。 Java import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import java.awt.*; import java.awt.geom.Rectangle2D; public class CreateNumberedList { public static void main(String[] args) throws Exception { //Presentationオブジェクトを作成する Presentation presentation = new Presentation(); presentation.getSlideSize().setType(SlideSizeType.SCREEN_16_X_9); //最初のスライドを取得する ISlide slide = presentation.getSlides().get(0); //スライドに図形を追加し、図形のスタイルを設定する Rectangle2D rect = new Rectangle2D.Double(50, 50, 300, 200); IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, rect); shape.getLine().setFillType(FillFormatType.NONE); shape.getFill().setFillType(FillFormatType.NONE); //デフォルト段落にテキストを追加する ParagraphEx titleParagraph = shape.getTextFrame().getParagraphs().get(0); titleParagraph.setText("スキル:"); titleParagraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); titleParagraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); titleParagraph.setAlignment(TextAlignmentType.LEFT); //リスト内容を指定する String[] listContent = new String[] { " Command-line Unix", " Vim", " HTML", " CSS", " Python", " JavaScript", " SQL" }; //番号付きリストを作成する for(int i = 0; i < listContent.length; i ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(listContent[i]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.NUMBERED); paragraph.setBulletStyle(NumberedBulletStyle.BULLET_ARABIC_PERIOD); } //ドキュメントをPowerPointに保存する presentation.saveToFile("NumberedList.pptx", FileFormat.PPTX_2013); } } PowerPoint で記号の箇条書きリストを作成する 記号の箇条書きリストを作成する方法は、番号付きリストを作成する方法とよく似ています。行頭文字のタイプを SYMBOL に設定するだけです。以下に詳細な操作手順を示します。 Presentation オブジェクトを作成します。 Presentation.getSlides().get() メソッドを使用して最初のスライドを取得します。 ISlide.getShapes().appendShape() メソッドを使用してスライドに図形を追加します。 文字列リストのリスト内容を指定します。 リストの内容に基づいて段落を作成し、ParagraphEx.setBulletType() メソッドを使用して、段落の行頭文字タイプを SYMBOL に設定します。 Presentation.saveToFile() メソッドを使用して、ドキュメントを PowerPoint に保存します。 Java import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import java.awt.*; import java.awt.geom.Rectangle2D; public class CreateBulletedListWithSymbol { public static void main(String[] args) throws Exception { //Presentationオブジェクトを作成する Presentation presentation = new Presentation(); presentation.getSlideSize().setType(SlideSizeType.SCREEN_16_X_9); //最初のスライドを取得する ISlide slide = presentation.getSlides().get(0); //スライドに図形を追加し、図形のスタイルを設定する Rectangle2D rect = new Rectangle2D.Double(50, 50, 350, 200); IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, rect); shape.getLine().setFillType(FillFormatType.NONE); shape.getFill().setFillType(FillFormatType.NONE); //デフォルト段落にテキストを追加する ParagraphEx titleParagraph = shape.getTextFrame().getParagraphs().get(0); titleParagraph.setText("スキル:"); titleParagraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); titleParagraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); titleParagraph.setAlignment(TextAlignmentType.LEFT); //リスト内容を指定する String[] listContent = new String[] { " Command-line Unix", " Vim", " HTML", " CSS", " Python", " JavaScript", " SQL" }; //記号の箇条書きリストを作成する for(int i = 0; i < listContent.length; i ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(listContent[i]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.SYMBOL); } //ドキュメントをPowerPointに保存する presentation.saveToFile("SymbolBullets.pptx", FileFormat.PPTX_2013); } } PowerPoint で画像の箇条書きリストを作成する 画像を行頭文字として使用するには、行頭文字のタイプを PICTURE に設定し、画像を BulletPicture オブジェクトに指定します。以下に詳細な操作手順を示します。 Presentation オブジェクトを作成します。 Presentation.getSlides().get() メソッドを使用して最初のスライドを取得します。 ISlide.getShapes().appendShape() メソッドを使用してスライドに図形を追加します。 文字列リストのリスト内容を指定します。 リストの内容に基づいて段落を作成し、ParagraphEx.setBulletType() メソッドを使用して、段落の行頭文字のタイプを PICTURE に設定します。 Paragraph.getBulletPicture().setEmbedImage() メソッドを使用して、行頭文字に画像を設定します。 Presentation.saveToFile() メソッドを使用して、ドキュメントを PowerPoint に保存します。 Java import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; public class CreateBulletedListWithImage { public static void main(String[] args) throws Exception { //Presentationオブジェクトを作成する Presentation presentation = new Presentation(); presentation.getSlideSize().setType(SlideSizeType.SCREEN_16_X_9); //最初のスライドを取得する ISlide slide = presentation.getSlides().get(0); //スライドに図形を追加し、図形のスタイルを設定する Rectangle2D rect = new Rectangle2D.Double(50, 50, 400, 180); IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, rect); shape.getLine().setFillType(FillFormatType.NONE); shape.getFill().setFillType(FillFormatType.NONE); //デフォルト段落にテキストを追加する ParagraphEx titleParagraph = shape.getTextFrame().getParagraphs().get(0); titleParagraph.setText("To-Do List:"); titleParagraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); titleParagraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); titleParagraph.setAlignment(TextAlignmentType.LEFT); //リスト内容を指定する String[] listContent = new String[] { " プロジェクトとタスクの定義", " タスクに人を割り当てる", " タスクの優先度の定義", " タスクの進捗状況の追跡", " 仕事のまとめ" }; //画像の箇条書きリストを作成する BufferedImage image = ImageIO.read(new File("image.jpg")); for(int i = 0; i < listContent.length; i ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(listContent[i]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.PICTURE); paragraph.getBulletPicture().setEmbedImage(presentation.getImages().append(image)); } //ドキュメントをPowerPointに保存する presentation.saveToFile("ImageBullets.pptx", FileFormat.PPTX_2013); } } 一時ライセンスを申請する 結果ドキュメントから評価メッセージを削除したい場合、または機能制限を取り除く場合は、についてこのメールアドレスはスパムボットから保護されています。閲覧するにはJavaScriptを有効にする必要があります。 にお問い合わせ、30 日間有効な一時ライセンスを取得してください。