影エフェクトを追加
using IronWord;
using IronWord.Models;

// Create new Word document
WordDocument doc = new WordDocument();

// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
    ShadowEffect = Shadow.OuterShadow1,
};

// Create paragraph
Paragraph paragraph = new Paragraph();

// Create run with text and style
Run textRun = new Run(new TextContent("Hello World"));
textRun.Style = textStyle;

// Add run to paragraph
paragraph.AddChild(textRun);

// Add paragraph to document
doc.AddParagraph(paragraph);

// Export new Word document
doc.SaveAs("shadowEffect.docx");
Imports IronWord
Imports IronWord.Models

' Create new Word document
Dim doc As New WordDocument()

' Create and configure text style
Dim textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
    .ShadowEffect = Shadow.OuterShadow1
}

' Create paragraph
Dim paragraph As New Paragraph()

' Create run with text and style
Dim textRun As New Run(New TextContent("Hello World"))
textRun.Style = textStyle

' Add run to paragraph
paragraph.AddChild(textRun)

' Add paragraph to document
doc.AddParagraph(paragraph)

' Export new Word document
doc.SaveAs("shadowEffect.docx")
NuGet Download
PM > Install-Package IronWord
影エフェクトを追加

影エフェクトを追加

テキストに影の効果を実装する

影効果は、文字の後ろに影のオフセットを作成して、テキストに深みと立体感を加えます。 IronWordはShadowクラスを通して定義済みのシャドウプリセットを提供し、手動での設定なしで迅速に適用できるさまざまなシャドウスタイルを提供します。

シャドウ効果を追加するには、TextEffectプロパティを設定します。 Shadowクラスからのこれらの静的名インスタンスは、適切なぼかし、距離、角度設定でプロフェッショナルに設計されたシャドウ構成を提供します。 外側の影のバリエーションは、テキストから影を遠ざけ、浮き上がったような外観を作り出します。

テキストスタイルを希望のシャドウ効果で設定したら、runに割り当てます。 スタイルされたdocumentに含めます。 このアプローチはIronWordのdocument階層に従い、シャドウ効果が出力ファイルに正しく適用されることを保証します。

コードの説明

Wordドキュメント内のテキストに影効果を追加するには、ほんの数行のコードで済みます。 完全性のために、まず新しいdocと呼んで初期化しましょう。 次に、TextEffectプロパティに割り当てることでシャドウ効果を組み込むように設定されます。

スタイルされたテキストをシャドウ効果と共に追加するために、TextContentに"Hello World"を含むRunオブジェクトが作成されます。 設定されたRunに割り当てられ、シャドウ効果が適用されます。 Paragraphがドキュメントに追加されます。 これはドキュメント階層に従います: Document → Paragraph → Run → TextContent. 最後に、Wordドキュメントをエクスポートします。

さらなる例やデモンストレーションについては、次の記事をご覧ください: テキストに影効果を追加する方法

IronWord チュートリアルでドキュメント要素を調べます。
GitHubで見る

準備はできましたか?

Nuget Downloads 58,016バージョン:2026.10リリースされたばかり