ShadowFormat

Inheritance: java.lang.Object

public class ShadowFormat

Represents shadow formatting for an object.

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

Examples:

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());
 

Methods

MethodDescription
clear()Clears shadow format.
getColor()Gets a java.awt.Color object that represents the color for the shadow.
getType()Gets the specified ShadowType for ShadowFormat.
getVisible()Returns true if the formatting applied to this instance is visible.
setType(int value)Sets the specified ShadowType for ShadowFormat.

clear()

public void clear()

Clears shadow format.

Examples:

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();
 

getColor()

public Color getColor()

Gets a java.awt.Color object that represents the color for the shadow. The default value is java.awt.Color#getBlack().getBlack().

Examples:

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());
 

Returns: java.awt.Color - A java.awt.Color object that represents the color for the shadow.

getType()

public int getType()

Gets the specified ShadowType for ShadowFormat.

Examples:

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());
 

Returns: int - The specified ShadowType for ShadowFormat. The returned value is one of ShadowType constants.

getVisible()

public boolean getVisible()

Returns true if the formatting applied to this instance is visible.

Remarks:

Unlike clear(), assigning false to Visible does not clear the formatting, it only hides the shape effect.

Examples:

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();
 

Returns: boolean - true if the formatting applied to this instance is visible.

setType(int value)

public void setType(int value)

Sets the specified ShadowType for ShadowFormat.

Examples:

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());
 

Parameters:

ParameterTypeDescription
valueintThe specified ShadowType for ShadowFormat. The value must be one of ShadowType constants.