添加阴影效果 为文本添加阴影效果 阴影效果通过在字符后方创建阴影偏移,为文本增加深度和立体感。 IronWord provides predefined shadow presets through the Shadow class, offering various shadow styles that can be applied quickly without manual configuration. To add a shadow effect, create a TextStyle and configure its TextEffect property with a shadow preset such as Shadow.OuterShadow1. These static named instances from the Shadow class provide professionally designed shadow configurations with appropriate blur, distance, and angle settings. 外阴影变体将阴影向外投射,使文本产生凸起的效果。 Once the text style is configured with the desired shadow effect, create a Run object containing TextContent and assign the style to the run. Add the styled run to a paragraph using AddChild, then include the paragraph in the document. 这种方法遵循 IronWord 的文档层次结构,并确保阴影效果正确应用于输出文件。 代码解释 只需几行代码,即可为 Word 文档中的文本添加阴影效果。 For completeness, let's first initialize a new WordDocument instance called doc. Then, a TextStyle object is created and configured to incorporate a shadow effect by assigning the Shadow.OuterShadow1 static named instance to the TextEffect property. To add the styled text with the shadow effect, a Paragraph is created, then a Run object is created containing TextContent with "Hello World". The configured textStyle is assigned to the Run, applying the shadow effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. 这遵循文档层次结构:文档 → 段落 → 运行 → 文本内容。 最后,导出 Word 文档。 更多示例和演示,请参阅以下文章:如何为文本添加阴影效果 通过 IronWord 教程探索文档元素。 相关文档链接 在GitHub上查看 相关教程 相关操作指南 类文档 下载IronWord DLL 报告此页面的问题 准备开始了吗? Nuget 下载 36,204 | 版本: 2026.3 刚刚发布 免费试用 免费 NuGet 下载 总下载量:36,204 查看许可证 还在滚动吗? 想快速获得证据? PM > Install-Package IronWord 运行示例 观看您的数据变成 Word 文档。 免费 NuGet 下载 总下载量:36,204 查看许可证