ShadowEffect.vb
C# VB
'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.DrawingImports GrapeCity.Documents.Word
'' This example shows how to add shadow effect to text and shapes in a DOCX.Public Class ShadowEffect Function CreateDocx() As GcWordDocument Dim doc = New GcWordDocument()
'' Create paragraph styling: Dim style = doc.Styles.Add("My Style", StyleType.Paragraph) style.Font.Size = 48 style.Font.Name = "Lucida" style.Font.Bold = True style.ParagraphFormat.Alignment = ParagraphAlignment.Center
'' Create top right offset shadow effect for paragraph text: Dim shadow As OuterShadow = style.Font.Effects.Shadow shadow.Alignment = RectangleAlignment.BottomLeft shadow.Angle = 250F shadow.Blur = 3F shadow.Distance = 10F shadow.ScaleX = 100F shadow.ScaleY = 50F shadow.SkewX = -30F shadow.SkewY = 0F shadow.Color.RGB = Color.Gray shadow.Color.Transparency = 0.3F
'' Apply top right offset shadow effect to the text: doc.Body.Paragraphs.Add(vbLf & " TREADSTONE", style)
'' Add a shape to the document: Dim para = doc.Body.Paragraphs.Add(vbLf & " " & vbLf & " " & vbLf) para.Format.Alignment = ParagraphAlignment.Center Dim run = para.GetRange().Runs.Add() Dim shape = run.GetRange().Shapes.Add(450, 100, GeometryType.HorizontalScroll) shape.Fill.SolidFill.RGB = Color.SteelBlue
'' Append text to the shape: Dim txtstyle = doc.Styles.Add("Text Style", StyleType.Paragraph) txtstyle.Font.Size = 28 txtstyle.Font.Bold = True txtstyle.Font.Color.RGB = Color.White txtstyle.ParagraphFormat.Alignment = ParagraphAlignment.Center Dim frame As TextFrame = shape.AddTextFrame("FINANCIAL REPORT " & vbLf & " 2021-2022", txtstyle)
'' Apply built-in shadow effect to the shape: shape.Effects.ApplyBuiltInShadow(BuiltInShadowId.ProspectiveLowerLeft)
'' Done: Return doc End FunctionEnd Class