//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using GrapeCity.Documents.Word;
namespace DsWordWeb.Demos
{
// This example shows how to add a 3D effect with placeholder colors to a shape.
public class Shape3DPlaceholderColorEffect
{
public GcWordDocument CreateDocx()
{
var doc = new GcWordDocument();
Paragraph p = doc.Body.Paragraphs.Add();
Run run = p.GetRange().Runs.Add();
Shape shape = run.GetRange().Shapes.Add();
shape.Fill.Type = FillType.Solid;
shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1;
var shapeFormat = shape.Effects.ThreeDFormat;
var schemeEffects = doc.Theme.FormatScheme.Effects.Add();
var schemeFormat = schemeEffects.ThreeDFormat;
var schemeScene = schemeEffects.ThreeDScene;
//TopBevel
schemeFormat.TopBevel.Type = BevelType.Angle;
schemeFormat.TopBevel.Width = 18.5f;
schemeFormat.TopBevel.Height = 058.5f;
//BottomBevel
schemeFormat.BottomBevel.Type = BevelType.ArtDeco;
schemeFormat.BottomBevel.Width = 11.5f;
schemeFormat.BottomBevel.Height = 21.5f;
//Depth
schemeFormat.Depth.Width = 33.5f;
schemeFormat.Depth.Color.ThemeColor = ThemeColorId.Accent1;
//Contour
schemeFormat.Contour.Width = 43.5f;
//color will be retrieved from placeholder.
schemeFormat.Contour.Color.ThemeColor = ThemeColorId.None;
//Material
schemeFormat.Material = MaterialType.Clear;
//DisnatceFromGround
schemeFormat.DistanceFromGround = 48.5f;
//set scene
schemeScene.Camera.Preset = CameraPreset.OrthographicFront;
schemeScene.Lighting.Direction = LightRigDirection.Top;
schemeScene.Lighting.Type = LightRigType.ThreePoints;
//set placeholder color
shape.Style.Effects.PlaceholderColor.ThemeColor = ThemeColorId.Accent6;
shape.Style.Effects.ThemeEffects = schemeEffects;
// Done:
return doc;
}
}
}