com.aspose.words
Class ShadowFormat

java.lang.Object
    extended by com.aspose.words.ShadowFormat

public class ShadowFormat 
extends java.lang.Object

Represents shadow formatting for an object.

To learn more, visit the Working with Graphic Elements documentation article.

Example:

Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();

Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());

Property Getters/Setters Summary
java.awt.ColorgetColor()
           Gets a java.awt.Color object that represents the color for the shadow. The default value is Black .
intgetType()
voidsetType(int value)
           Gets or sets the specified ShadowType for ShadowFormat. The value of the property is ShadowType integer constant.
booleangetVisible()
           Returns true if the formatting applied to this instance is visible.
 
Method Summary
voidclear()
           Clears shadow format.
 

Property Getters/Setters Detail

getColor

public java.awt.Color getColor()
Gets a java.awt.Color object that represents the color for the shadow. The default value is Black .

Example:

Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();

Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());

getType/setType

public int getType() / public void setType(int value)
Gets or sets the specified ShadowType for ShadowFormat. The value of the property is ShadowType integer constant.

Example:

Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();

Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());

getVisible

public boolean getVisible()
Returns true if the formatting applied to this instance is visible. Unlike clear(), assigning false to Visible does not clear the formatting, it only hides the shape effect.

Example:

Shows how to work with a shadow formatting for the shape.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);

if (shape.getShadowFormat().getVisible() && shape.getShadowFormat().getType() == ShadowType.SHADOW_2)
    shape.getShadowFormat().setType(ShadowType.SHADOW_7);

if (shape.getShadowFormat().getType() == ShadowType.SHADOW_MIXED)
    shape.getShadowFormat().clear();

Method Detail

clear

public void clear()
Clears shadow format.

Example:

Shows how to work with a shadow formatting for the shape.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);

if (shape.getShadowFormat().getVisible() && shape.getShadowFormat().getType() == ShadowType.SHADOW_2)
    shape.getShadowFormat().setType(ShadowType.SHADOW_7);

if (shape.getShadowFormat().getType() == ShadowType.SHADOW_MIXED)
    shape.getShadowFormat().clear();

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.