IRONSOFTWAREHOME
新增反射效果
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()
{
    ReflectionEffect = new Reflection(),
};

// 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("reflectionEffect.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 {
    .ReflectionEffect = New Reflection()
}

' 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("reflectionEffect.docx")
NuGet Download
PM > Install-Package IronWord
新增反射效果

新增反射效果

建立帶有反射效果的文字

反射效果會在文字下方新增一個鏡面圖像,創造出精緻和現代的外觀。 在IronWord中,這個效果是通過TextEffect物件,可以定製或使用預設設置。

要實現反射效果,建立一個TextEffect屬性。 Reflection類支持預設初始化,適用於大多數使用情況標準反射參數。 對於自定義反射,可以調整距離、模糊和透明度等屬性以微調外觀。

在定義文字樣式後,建立一個包含您Run,並將配置的樣式賦予該運行。 使用AddChild將運行新增到段落中,保持文件的正確層次結構為文件 → 段落 → 運行 → 文字內容。 最後,將段落新增到文件中以應用反射效果。

程式碼解析

讓我們建立一個新的Word文件並新增帶有反射效果的文字。 最初建立了一個名為WordDocument物件。 然後實例化一個Reflection物件來配置以包含反射效果。

要新增帶有反射效果的樣式文字,先建立一個TextContent並附有"Hello World"的Run物件。 將Run,應用反射效果。 使用Paragraph新增到文件中。 這遵循文件層級結構:Document → Paragraph → Run → TextContent。 最後,保存文件。

在IronWord教程中探索文件元素。
在 GitHub 上查看

準備開始了嗎?

Nuget Downloads 56,401版本:2026.9剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
預約您的免費現場演示
Booking Badge

全球數百萬工程師信賴

Iron Software的客戶標誌
獲取您的無義務諮詢
完成以下表單或發郵件至sales@ironsoftware.com
您的詳細資訊將始終保持機密。
全球數百萬工程師信賴
Iron Software的客戶標誌
立即獲取您的30天試用金鑰
無需信用卡或帳戶建立