チュートリアル

簡単にライブラリーを使用するためのチュートリアルコレクション

チュートリアル».NET»Spire.Presentation for .NET»段落とテキスト»C#:PowerPoint で番号付きリストまたは箇条書きリストを作成する
2024-01-11

C#:PowerPoint で番号付きリストまたは箇条書きリストを作成する

リストは PowerPoint プレゼンテーションでの強力なツールであり、情報を明確かつ簡潔な形式で整理・提示することができます。重要なポイントを紹介したり、アイデアをまとめたり、重要な詳細を強調する場合でも、リストを活用することでスライドの視覚的魅力、読みやすさ、専門性を向上させることができます。この記事では、Spire.Presentation for .NET を使用して PowerPoint で番号付きリストまたは箇条書きリストを作成する方法について説明します。

Spire.Presentation for .NET をインストールします

まず、Spire.Presentation for .NET パッケージに含まれている DLL ファイルを .NET プロジェクトの参照として追加する必要があります。DLL ファイルは、このリンクからダウンロードするか、NuGet を介してインストールできます。

PM> Install-Package Spire.Presentation

PowerPoint で番号付きリストを作成する

PowerPoint の番号付きリストは、各アイテムの前に番号または一連の数字が付けられるアイテムのリストです。通常は1から始まり、順次進行します。番号付きリストは、ステップ、指示、ランキング、特定の順序を必要とする情報などを提示するためによく使用されます。

Spire.Presentation for .NET を使用して PowerPoint プレゼンテーションに番号付きリストを作成するには、次の手順を実行します。

  • Presentation オブジェクトを作成します。
  • Presentation.Slides[0] プロパティを使用して最初のスライドを取得します。
  • ISlide.Shapes.AppendShape() メソッドを使用してスライドに図形を追加し、図形のスタイルを設定します。
  • 文字列配列内のリストの項目を指定します。
  • リストの項目に基づいて段落を作成し、ParagraphProperties.BulletType プロパティを使用して、これらの段落の箇条書きの種類を「Numbered」に設定します。
  • ParagraphProperties.BulletStyle プロパティを使用して、これらの段落の番号付き箇条書きスタイルを設定します。
  • IAutoShape.TextFrame.Paragraphs.Append() メソッドを使用して、これらの段落を図形に追加します。
  • Presentation.SaveToFile() メソッドを使用して、ドキュメントを PowerPoint ファイルに保存します。
  • C#
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace CreateNumberedList
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Presentationオブジェクトを作成する
            Presentation presentation = new Presentation();

            //最初のスライドを取得する
            ISlide slide = presentation.Slides[0];

            //スライドに図形を追加し、図形のスタイルを設定する
            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 300, 200));
            shape.Fill.FillType = FillFormatType.None;
            shape.Line.FillType = FillFormatType.None;

            //デフォルト段落にテキストを追加する
            TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
            paragraph.Text = "スキル:";
            paragraph.Alignment = TextAlignmentType.Left;
            paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
            paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;

            //リスト内容を指定する
            string[] listItems = new string[] {
                " Command-line Unix",
                " Vim",
                " HTML",
                " CSS",
                " Python",
                " JavaScript",
                " SQL"
            };

            //番号付きリストを作成する
            foreach (string item in listItems)
            {
                TextParagraph textParagraph = new TextParagraph();
                textParagraph.Text = item;
                textParagraph.Alignment = TextAlignmentType.Left;
                textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
                textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
                textParagraph.BulletType = TextBulletType.Numbered;
                textParagraph.BulletStyle = NumberedBulletStyle.BulletArabicPeriod;
                shape.TextFrame.Paragraphs.Append(textParagraph);
            }

            //ドキュメントをPowerPointに保存する
            presentation.SaveToFile("NumberedList.pptx", FileFormat.Pptx2013);
        }
    }
}

C#:PowerPoint で番号付きリストまたは箇条書きリストを作成する

PowerPoint で記号の箇条書きリストを作成する

PowerPoint の記号の箇条書きリストでは、各アイテムを視覚的に表現するために数字の代わりに記号を使用します。このリストは、順序のない情報や特定の順序を持たないポイントの集まりを提示するのに便利です。 Spire.Presentation for .NET を使用して PowerPoint プレゼンテーションで記号の箇条書きリストを作成するには、以下の手順に従うことができます。

  • Presentation オブジェクトを作成します。
  • Presentation.Slides[0] プロパティを使用して最初のスライドを取得します。
  • ISlide.Shapes.AppendShape() メソッドを使用してスライドに図形を追加し、図形のスタイルを設定します。
  • 文字列配列内のリストの項目を指定します。
  • リスト項目に基づいて段落を作成し、ParagraphProperties.BulletType プロパティを使用して、これらの段落の箇条書きの種類を 「Symbol」 に設定します。
  • IAutoShape.TextFrame.Paragraphs.Append() メソッドを使用して、これらの段落を図形に追加します。
  • Presentation.SaveToFile() メソッドを使用して、ドキュメントを PowerPoint ファイルに保存します。
  • C#
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace CreateSymbolBulletedList
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Presentationオブジェクトを作成する
            Presentation presentation = new Presentation();

            //最初のスライドを取得する
            ISlide slide = presentation.Slides[0];

            //スライドに図形を追加し、図形のスタイルを設定する
            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 350, 200));
            shape.Fill.FillType = FillFormatType.None;
            shape.Line.FillType = FillFormatType.None;

            //デフォルト段落にテキストを追加する
            TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
            paragraph.Text = "スキル:";
            paragraph.Alignment = TextAlignmentType.Left;
            paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
            paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;

            //リスト内容を指定する
            string[] listItems = new string[] {
                " Command-line Unix",
                " Vim",
                " HTML",
                " CSS",
                " Python",
                " JavaScript",
                " SQL"
            };

            //記号の箇条書きリストを作成する
            foreach (string item in listItems)
            {
                TextParagraph textParagraph = new TextParagraph();
                textParagraph.Text = item;
                textParagraph.Alignment = TextAlignmentType.Left;
                textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
                textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
                textParagraph.BulletType = TextBulletType.Symbol;
                shape.TextFrame.Paragraphs.Append(textParagraph);
            }

            //ドキュメントをPowerPointに保存する
            presentation.SaveToFile("SymbolBulletedList.pptx", FileFormat.Pptx2013);
        }
    }
}

C#:PowerPoint で番号付きリストまたは箇条書きリストを作成する

PowerPoint で画像の箇条書きリストを作成する

PowerPoint の画像箇条書きリストは、従来の箇条書きを小さな画像またはアイコンに置き換えます。 数字や記号を使用する代わりに、各項目は画像で表され、リストに視覚的な要素が追加されます。このリストは、豊富なビジュアルが必要な場合や、項目を表すために関連するアイコンを使用する必要がある場合によく使用されます。Spire.Presentation for .NET を使用して、PowerPoint プレゼンテーションで画像付き箇条書きリストを作成するには、以下の手順に従うことができます。

  • Presentation オブジェクトを作成します。
  • Presentation.Slides[0] プロパティを使用して最初のスライドを取得します。
  • ISlide.Shapes.AppendShape() メソッドを使用してスライドに図形を追加し、図形のスタイルを設定します。
  • 文字列配列内のリストの項目を指定します。
  • リスト項目に基づいて段落を作成し、ParagraphProperties.BulletType プロパティを使用して、これらの段落の箇条書きの種類を「Picture」に設定します。
  • ParagraphProperties.BulletPicture.EmbedImage プロパティを使用して、箇条書きとして使用する画像を設定します。
  • IAutoShape.TextFrame.Paragraphs.Append() メソッドを使用して、これらの段落を図形に追加します。
  • Presentation.SaveToFile() メソッドを使用して、ドキュメントを PowerPoint ファイルに保存します。
  • C#
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace CreateImageBulletedList
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Presentationオブジェクトを作成する
            Presentation presentation = new Presentation();

            //最初のスライドを取得する
            ISlide slide = presentation.Slides[0];

            //スライドに図形を追加し、図形のスタイルを設定する
            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 180));
            shape.Fill.FillType = FillFormatType.None;
            shape.Line.FillType = FillFormatType.None;

            //デフォルト段落にテキストを追加する
            TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
            paragraph.Text = "To-Do List:";
            paragraph.Alignment = TextAlignmentType.Left;
            paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
            paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;

            //リスト内容を指定する
            string[] listItems = new string[] {
                " プロジェクトとタスクの定義",
                " タスクに人を割り当てる",
                " タスクの優先度の定義",
                " タスクの進捗状況の追跡",
                " 仕事のまとめ"
            };

            //画像の箇条書きリストを作成する
            foreach (string item in listItems)
            {
                TextParagraph textParagraph = new TextParagraph();
                textParagraph.Text = item;
                textParagraph.Alignment = TextAlignmentType.Left;
                textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
                textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
                textParagraph.BulletType = TextBulletType.Picture;
                IImageData image = presentation.Images.Append(Image.FromFile("image.png"));
                textParagraph.BulletPicture.EmbedImage = image;
                shape.TextFrame.Paragraphs.Append(textParagraph);
            }

            //ドキュメントをPowerPointに保存する
            presentation.SaveToFile("ImageBulletedList.pptx", FileFormat.Pptx2013);
        }
    }
}

C#:PowerPoint で番号付きリストまたは箇条書きリストを作成する

一時ライセンスを申請する

結果ドキュメントから評価メッセージを削除したい場合、または機能制限を取り除く場合は、についてこのメールアドレスはスパムボットから保護されています。閲覧するにはJavaScriptを有効にする必要があります。にお問い合わせ、30 日間有効な一時ライセンスを取得してください。

Read 164 times