段落を追加

IronWordの"add-paragraph"機能は、開発者が既存のWord文書に完全な段落を挿入できる機能を提供し、コンテンツを効率的に構造化および整理する方法を提供します。 段落を追加することで、開発者は異なるフォーマットを持つ複数のテキストをまとめ、まとまりのあるブロックにすることができます。 この機能は、テキストを一緒にグループ化してスタイルを整える必要がある、レポート、記事、手紙などの動的文書の構築に特に役立ちます。

テキストが表示される方法に柔軟性を持たせ、一つの段落内で太字、斜体、その他のスタイルなどのさまざまなフォーマットオプションを含めることができます。 段落を追加する能力は、文書構造をクリーンに保ち、読みやすさのためにコンテンツが適切に整理されることを保証します。

Adding Paragraphs in C

The Paragraph class in IronWord represents a block of text that can contain both unstyled text and styled content. When working with paragraphs, developers can combine plain TextContent with styled Run objects to create rich, formatted text blocks.

To add plain text directly to a paragraph, use the AddText method with a TextContent object. これは、特定の書式設定を必要としないスタイルなしのテキストに最適です。 For styled content, create a Run object containing TextContent, then assign a TextStyle to the Run. The TextStyle can specify formatting such as bold, italic, font family, font size, and color.

Once the Run is styled, use the AddChild method to add it to the paragraph. This method is specifically designed for adding Run objects with formatting. 1 つの段落に、異なるスタイルの複数の実行を含めることができるため、統一されたブロック内で柔軟なテキスト書式設定が可能になります。

After constructing the paragraph with all desired content, use AddParagraph on the WordDocument to insert it into the document. このアプローチは、WordDocument → DocumentSection → Paragraph → Run → TextContent というドキュメント階層に従い、ドキュメントを保存するときに適切な構造と書式設定が保持されるようにします。

IronWord のドキュメント要素についてさらに詳しく知る

準備はできましたか?
Nuget ダウンロード 35,581 | バージョン: 2026.3 リリース
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか? PM > Install-Package IronWord
サンプルを実行する あなたのデータが Word ドキュメントになるのを見る。