com.aspose.words

  • java.lang.Object
    • com.aspose.words.Fill
public class Fill 
extends java.lang.Object

Defines a fill for a shape.

Use the Shape.Fill property to access fill properties of a shape. You do not create instances of the Fill class directly.

Although the Fill class provides properties to specify solid color fill only, all of the more complex fill types, including as gradient, pattern and texture are fully preserved during document open-save cycles.

Example:

Demonstrates how to create shapes with fill.
DocumentBuilder builder = new DocumentBuilder();

builder.writeln();
builder.writeln();
builder.writeln();
builder.write("Some text under the shape.");

// Create a red balloon, semitransparent.
// The shape is floating and its coordinates are (0,0) by default, relative to the current paragraph.
Shape shape = new Shape(builder.getDocument(), ShapeType.BALLOON);
shape.setFillColor(Color.RED);
shape.getFill().setOpacity(0.3);
shape.setWidth(100);
shape.setHeight(100);
shape.setTop(-100);
builder.insertNode(shape);

builder.getDocument().save(getMyDir() + "\\Artifacts\\Shape.Fill.doc");
See Also:
Shape.Fill

Property Getters/Setters Summary
java.awt.ColorgetColor()
void
setColor(java.awt.Colorvalue)
           Defines the color of a fill.
byte[]getImageBytes()
Gets the raw bytes of the fill texture or pattern.
booleangetOn()
void
setOn(booleanvalue)
           Determines whether the shape will be filled.
doublegetOpacity()
void
setOpacity(doublevalue)
           Defines the transparency of a fill. Valid range from 0 to 1, where 0 is fully transparent and 1 is fully opaque.
 

    • Property Getters/Setters Detail

      • getColor/setColor

        public java.awt.Color getColor() / public void setColor(java.awt.Color value)
        
        Defines the color of a fill.

        The default value is java.awt.Color.WHITE.

      • getImageBytes

        public byte[] getImageBytes()
        
        Gets the raw bytes of the fill texture or pattern.

        The default value is null.

      • getOn/setOn

        public boolean getOn() / public void setOn(boolean value)
        
        Determines whether the shape will be filled.

        The default value is true.

      • getOpacity/setOpacity

        public double getOpacity() / public void setOpacity(double value)
        
        Defines the transparency of a fill. Valid range from 0 to 1, where 0 is fully transparent and 1 is fully opaque.

        The default value is 1.

        Example:

        Demonstrates how to create shapes with fill.
        DocumentBuilder builder = new DocumentBuilder();
        
        builder.writeln();
        builder.writeln();
        builder.writeln();
        builder.write("Some text under the shape.");
        
        // Create a red balloon, semitransparent.
        // The shape is floating and its coordinates are (0,0) by default, relative to the current paragraph.
        Shape shape = new Shape(builder.getDocument(), ShapeType.BALLOON);
        shape.setFillColor(Color.RED);
        shape.getFill().setOpacity(0.3);
        shape.setWidth(100);
        shape.setHeight(100);
        shape.setTop(-100);
        builder.insertNode(shape);
        
        builder.getDocument().save(getMyDir() + "\\Artifacts\\Shape.Fill.doc");