テキストにアウトライン効果を追加する方法
テキストのアウトラインエフェクトは、テキストの文字の周りに目に見える境界線を追加し、読みやすさや視覚的なインパクトを高める定義されたアウトラインを作成します。 この効果は、デザインの好みに合わせて色、厚み、スタイルをカスタマイズできる。 グラフィック、タイポグラフィ、デジタルデザインでよく使われ、背景に対してテキストを目立たせたり、スタイル化された外観を作り出したりする。
IronWordの使用を開始する
今日から無料トライアルでIronWordをあなたのプロジェクトで使い始めましょう。
テキストにアウトライン効果を追加する方法
- テキストにアウトラインを追加するC#(シーシャープ)ライブラリのダウンロード
- 新規作成または既存のテキストにテキスト効果を適用します。
- の静的な名前付きインスタンスを使って、プリセットのテキスト・アウトライン効果を適用する。 テキストアウトラインエフェクト クラス
- 構成する テキストアウトラインエフェクト カスタマイズされたテキストアウトラインを実現するプロパティ
- 編集したWord文書を新規ファイルとして書き出す
テキスト・アウトライン効果の追加
テキストのアウトライン効果を指定するには、TextStyleオブジェクトを作成し、TextOutlineEffectプロパティにTextOutlineEffectオブジェクトを設定します。 最後に、TextEffectプロパティにTextStyleオブジェクトを代入して、スタイルを持つ新しいテキストを追加します。
:path=/static-assets/word/content-code-examples/how-to/text-effect-text-outline-effect.cs
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()
{
TextOutlineEffect = TextOutlineEffect.DefaultEffect,
};
// Add text with style
doc.AddText("Hello World").Style = textStyle;
// Export new Word document
doc.SaveAs("textOutlineEffect.docx");
Imports IronWord
Imports IronWord.Models
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {.TextOutlineEffect = TextOutlineEffect.DefaultEffect}
' Add text with style
doc.AddText("Hello World").Style = textStyle
' Export new Word document
doc.SaveAs("textOutlineEffect.docx")
テキストアウトライン効果のプロパティ
テキスト・アウトライン・エフェクトは、あらゆるデザインのニーズに合わせてカスタマイズ可能なさまざまなプロパティを提供します。 以下に物件とその説明を掲載する:
- PenAlignment:アウトライン効果に使用されるペンの配置を取得または設定します。
- LineCapType:アウトライン効果に使用されるラインキャップのタイプを取得または設定します。
- LineWidth:アウトライン効果線の幅を取得または設定します。(備考幅はポイントで指定(1/72インチ).)
- CompoundLineType:アウトライン効果に使用される複合線のタイプを取得または設定します。
- LineJoin:アウトライン効果に使用されるストローク結合スタイルを取得または設定します。
- Color:アウトライン効果の塗りつぶし色を取得または設定します。
- presetLineDash:アウトライン効果のプリセットラインダッシュスタイルを取得または設定します。
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-text-outline-effect.cs
using IronWord;
using IronWord.Models;
using IronWord.Models.Enums;
// Create new Word document
WordDocument doc = new WordDocument();
// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
TextOutlineEffect = new TextOutlineEffect()
{
Color = IronWord.Models.Color.Red,
CompoundLineType = CompoundLineValues.Double,
LineCapType = LineCapValues.Round,
LineJoin = StrokeJoinStyleValues.Bevel,
LineWidth = 0.3,
PenAlignment = PenAlignmentValues.Center,
presetLineDash = PresetLineDashValues.Solid
},
};
// Add text with style
doc.AddText("Customized text outline").Style = textStyle;
// Export new Word document
doc.SaveAs("customizedTextOutlineEffect.docx");
Imports IronWord
Imports IronWord.Models
Imports IronWord.Models.Enums
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
.TextOutlineEffect = New TextOutlineEffect() With {
.Color = IronWord.Models.Color.Red,
.CompoundLineType = CompoundLineValues.Double,
.LineCapType = LineCapValues.Round,
.LineJoin = StrokeJoinStyleValues.Bevel,
.LineWidth = 0.3,
.PenAlignment = PenAlignmentValues.Center,
.presetLineDash = PresetLineDashValues.Solid
}
}
' Add text with style
doc.AddText("Customized text outline").Style = textStyle
' Export new Word document
doc.SaveAs("customizedTextOutlineEffect.docx")