SoftEdgeEffect.cs
//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//
using System.Drawing;using GrapeCity.Documents.Word;
namespace DsWordWeb.Demos{ // This example shows how to add blur effect to shapes in a DOCX. public class SoftEdgeEffect { public GcWordDocument CreateDocx() { var doc = new GcWordDocument();
// Shape Soft Edge - direct: Paragraph p = doc.Body.Paragraphs.Add(); Run run = p.GetRange().Runs.Add(); Shape shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star7); shape.Fill.Type = FillType.Solid; shape.Fill.SolidFill.RGB = Color.Yellow; shape.Line.Width = 8; shape.Line.Fill.SolidFill.RGB = Color.Red; // apply 5 point soft edge effect to the shape shape.Effects.SoftEdge.Radius = 5f; p.GetRange().Runs.Add("Shape Soft Edge - direct.", doc.Styles[BuiltInStyleId.Strong]);
// Shape Soft Edge - shapes style: p = doc.Body.Paragraphs.Add(); p.Style.ParagraphFormat.Spacing.SpaceBefore = 30; run = p.GetRange().Runs.Add(); shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star7); shape.Fill.Type = FillType.Solid; shape.Fill.SolidFill.RGB = Color.Yellow; shape.Line.Width = 8; shape.Line.Fill.SolidFill.RGB = Color.Red; // apply 5 point soft edge effect to the style var fmtEffect = doc.Theme.FormatScheme.Effects.Add(); fmtEffect.SoftEdge.Radius = 5f; // shape.Style.Effects.ThemeEffects = fmtEffect; p.GetRange().Runs.Add("Shape Soft Edge - shapes style.", doc.Styles[BuiltInStyleId.Strong]);
// Done: return doc; } }}