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()
{
    GlowEffect = new Glow()
    {
        GlowColor = IronWord.Models.Color.Aqua,
        GlowRadius = 10,
    },
};

// 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("glowEffect.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 {
    .GlowEffect = New Glow() With {
        .GlowColor = IronWord.Models.Color.Aqua,
        .GlowRadius = 10
    }
}

' 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("glowEffect.docx")
NuGet Download
PM > Install-Package IronWord
添加辉光效果

添加辉光效果

为文本添加发光效果

在IronWord中应用发光效果是通过配置TextStyle属性来完成的。 发光效果会在文本周围创建发光边框,可通过自定义颜色和半径属性来控制视觉外观。

要创建一个发光效果,实例化一个TextEffect对象。 GlowRadius来控制效果的扩展。 半径值越高,产生的光晕越分散;半径值越低,产生的光晕越集中。

在配置文本样式后,创建一个包含所需Run。 使用AddChild将样式化的文本添加到段落中,然后将段落添加到文档中。 这遵循文档层次结构:文档 → 段落 → 运行 → 文本内容。

代码解释

上面的代码片段演示了如何创建一个新的 Word 文档并应用带有发光效果的文本样式。 首先,一个新的Word文档被实例化并存储在变量doc中。 然后,创建一个名为TextStyle对象。 此文本样式通过初始化一个特定设置的TextEffect对象配置为包括发光效果。

为了添加带有发光效果的样式文本,首先创建一个Paragraph,然后创建一个包含"Hello World"的TextContentRun,应用发光效果。 Paragraph添加到文档中。 这种多步骤方法遵循文档层次结构:文档 → 段落 → 运行 → 文本内容。 最后,Word 文档被导出为一个新文件。

更多示例和演示,请参阅以下文章:如何为文本添加发光效果

了解更多关于 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 天试用密钥
无需信用卡或创建账户