テキストの輪郭を追加

テキストアウトライン効果の追加

テキストアウトライン効果は、各文字の周囲に境界線を描画することで、テキストの視認性とスタイルを向上させます。 この効果は、太字で目を引くテキストを作成したり、画像や色付きの背景の上にテキストが表示される場合に読みやすさを確保したりするのに特に役立ちます。 IronWord provides the TextOutlineEffect class with preset configurations for quick implementation.

To apply a text outline, create a TextStyle object and configure its TextEffect property with TextOutlineEffect.DefaultEffect. このプリセットは、ほとんどのシナリオに適した標準的なアウトライン構成を提供します。 カスタム アウトラインの場合、開発者はアウトラインの幅、色、線のスタイルなどのプロパティを指定して、特定の視覚効果を実現できます。

After setting up the text style, create a Run containing the desired TextContent and assign the configured style to the run's Style property. Use AddChild to add the styled run to a paragraph, then add the paragraph to the document. この構造化されたアプローチにより、適切な書式設定が保証され、ドキュメントの整合性が維持されます。

コードの説明

IronWordを使えば、テキストにアウトラインを適用するのはとても簡単です。 そのシンプルさにもかかわらず、テキストアウトラインの各属性はあらゆるニーズに合わせて調整できます。 Once a Word document is imported, the textStyle is configured to include a text outline effect by assigning TextOutlineEffect.DefaultEffect to the TextOutlineEffect property of a new TextEffect instance.

To apply this effect to text, a Paragraph is created, then a Run object is created containing the desired TextContent. The configured textStyle is assigned to the Run, applying the text outline effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. これは、ドキュメント階層に従います: ドキュメント → 段落 → 実行 → TextContent。 最後に、ドキュメントがエクスポートされます。

IronWord のドキュメント要素について詳しく学びます。

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

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

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