Adicionar efeito de sombra

Implementando efeitos de sombra em texto

Os efeitos de sombra adicionam profundidade e dimensão ao texto, criando uma sombra deslocada atrás dos caracteres. 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. As variantes de sombra externa projetam a sombra para longe do texto, criando uma aparência elevada.

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. Essa abordagem segue a hierarquia de documentos do IronWord e garante que o efeito de sombra seja aplicado corretamente ao arquivo de saída.

Explicação do código

É possível adicionar um efeito de sombra ao texto em um documento do Word com apenas algumas linhas de código. 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. Isso segue a hierarquia do documento: Documento → Parágrafo → Execução → Conteúdo do Texto. Por fim, exporte o documento do Word.

Para mais exemplos e demonstrações, consulte o seguinte artigo: Como adicionar efeito de sombra ao texto

Explore os elementos do documento com os tutoriais do IronWord .

Pronto para começar?
Nuget Downloads 35,581 | Versão: 2026.3 acaba de ser lançado
Still Scrolling Icon

Ainda está rolando a tela?

Quer provas rápidas? PM > Install-Package IronWord
executar um exemplo Veja seus dados se transformarem em um documento do Word.