com.aspose.words

Class HorizontalRuleFormat

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

Represents horizontal rule formatting.

Example:

Shows how to insert a horizontal rule shape, and customize its formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertHorizontalRule();

HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
horizontalRuleFormat.setWidthPercent(70.0);
horizontalRuleFormat.setHeight(3.0);
horizontalRuleFormat.setColor(Color.BLUE);
horizontalRuleFormat.setNoShade(true);

Assert.assertTrue(shape.isHorizontalRule());
Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());

Property Getters/Setters Summary
intgetAlignment()
void
setAlignment(intvalue)
           Gets or sets the alignment of the horizontal rule. The value of the property is HorizontalRuleAlignment integer constant.
java.awt.ColorgetColor()
void
setColor(java.awt.Colorvalue)
           Gets or sets the brush color that fills the horizontal rule.
doublegetHeight()
void
setHeight(doublevalue)
           Gets or sets the height of the horizontal rule.
booleangetNoShade()
void
setNoShade(booleanvalue)
           Indicates the presence of 3D shading for the horizontal rule. If true, then the horizontal rule is without 3D shading and solid color is used.
doublegetWidthPercent()
void
setWidthPercent(doublevalue)
           Gets or sets the length of the specified horizontal rule expressed as a percentage of the window width.
 

    • Property Getters/Setters Detail

      • getAlignment/setAlignment

        public int getAlignment() / public void setAlignment(int value)
        
        Gets or sets the alignment of the horizontal rule. The value of the property is HorizontalRuleAlignment integer constant.

        The default value is HorizontalRuleAlignment.LEFT.

        Example:

        Shows how to insert a horizontal rule shape, and customize its formatting.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        Shape shape = builder.insertHorizontalRule();
        
        HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
        horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
        horizontalRuleFormat.setWidthPercent(70.0);
        horizontalRuleFormat.setHeight(3.0);
        horizontalRuleFormat.setColor(Color.BLUE);
        horizontalRuleFormat.setNoShade(true);
        
        Assert.assertTrue(shape.isHorizontalRule());
        Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
      • getColor/setColor

        public java.awt.Color getColor() / public void setColor(java.awt.Color value)
        
        Gets or sets the brush color that fills the horizontal rule.

        This is a shortcut to the Fill.Color property.

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

        Example:

        Shows how to insert a horizontal rule shape, and customize its formatting.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        Shape shape = builder.insertHorizontalRule();
        
        HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
        horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
        horizontalRuleFormat.setWidthPercent(70.0);
        horizontalRuleFormat.setHeight(3.0);
        horizontalRuleFormat.setColor(Color.BLUE);
        horizontalRuleFormat.setNoShade(true);
        
        Assert.assertTrue(shape.isHorizontalRule());
        Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
      • getHeight/setHeight

        public double getHeight() / public void setHeight(double value)
        
        Gets or sets the height of the horizontal rule.

        This is a shortcut to the ShapeBase.Height property.

        Valid values ​​range from 0 to 1584 inclusive.

        The default value is 1.5.

        Example:

        Shows how to insert a horizontal rule shape, and customize its formatting.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        Shape shape = builder.insertHorizontalRule();
        
        HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
        horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
        horizontalRuleFormat.setWidthPercent(70.0);
        horizontalRuleFormat.setHeight(3.0);
        horizontalRuleFormat.setColor(Color.BLUE);
        horizontalRuleFormat.setNoShade(true);
        
        Assert.assertTrue(shape.isHorizontalRule());
        Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
      • getNoShade/setNoShade

        public boolean getNoShade() / public void setNoShade(boolean value)
        
        Indicates the presence of 3D shading for the horizontal rule. If true, then the horizontal rule is without 3D shading and solid color is used.

        The default value is false.

        Example:

        Shows how to insert a horizontal rule shape, and customize its formatting.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        Shape shape = builder.insertHorizontalRule();
        
        HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
        horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
        horizontalRuleFormat.setWidthPercent(70.0);
        horizontalRuleFormat.setHeight(3.0);
        horizontalRuleFormat.setColor(Color.BLUE);
        horizontalRuleFormat.setNoShade(true);
        
        Assert.assertTrue(shape.isHorizontalRule());
        Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
      • getWidthPercent/setWidthPercent

        public double getWidthPercent() / public void setWidthPercent(double value)
        
        Gets or sets the length of the specified horizontal rule expressed as a percentage of the window width.

        Valid values ​​range from 1 to 100 inclusive.

        The default value is 100.

        Example:

        Shows how to insert a horizontal rule shape, and customize its formatting.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        Shape shape = builder.insertHorizontalRule();
        
        HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
        horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
        horizontalRuleFormat.setWidthPercent(70.0);
        horizontalRuleFormat.setHeight(3.0);
        horizontalRuleFormat.setColor(Color.BLUE);
        horizontalRuleFormat.setNoShade(true);
        
        Assert.assertTrue(shape.isHorizontalRule());
        Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());