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将运行添加到段落中,保持Document → Paragraph → Run → TextContent的正确文档层次结构。 最后,将该段落添加到文档中以应用反射效果。

代码解释

让我们创建一个新的 Word 文档,并向其中添加带有反射效果的文本。 最初,创建一个名为WordDocument对象。 然后实例化一个Reflection对象来配置其包含反射效果。

要添加具有反射效果的样式文本,创建一个TextContent和"Hello World"的Run对象。 Run,应用反射效果。 Paragraph被添加到文档中。 这遵循文档层次结构:文档 → 段落 → 运行 → 文本内容。 最后,文档保存完毕。

在 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 天试用密钥
无需信用卡或创建账户