com.aspose.words
Class BorderCollection

java.lang.Object
    extended by com.aspose.words.BorderCollection
All Implemented Interfaces:
java.lang.Iterable

public class BorderCollection 
extends java.lang.Object

A collection of Border objects. Different document elements have different borders. For example, ParagraphFormat has Bottom, Left, Right and Top borders. You can specify different formatting for each border independently or enumerate through all borders and apply same formatting.

Example:

Inserts a paragraph with a top border.
DocumentBuilder builder = new DocumentBuilder();

Border topBorder = builder.getParagraphFormat().getBorders().getByBorderType(BorderType.TOP);
topBorder.setColor(Color.RED);
topBorder.setLineStyle(LineStyle.DASH_SMALL_GAP);
topBorder.setLineWidth(4);

builder.writeln("Hello World!");

Property Getters/Setters Summary
BordergetBottom()
           Gets the bottom border.
java.awt.ColorgetColor()
voidsetColor(java.awt.Color value)
           Gets or sets the border color.
intgetCount()
           Gets the number of borders in the collection.
doublegetDistanceFromText()
voidsetDistanceFromText(double value)
           Gets or sets distance of the border from text in points.
BordergetHorizontal()
           Gets the horizontal border that is used between cells or conforming paragraphs.
BordergetLeft()
           Gets the left border.
intgetLineStyle()
voidsetLineStyle(int value)
           Gets or sets the border style. The value of the property is LineStyle integer constant.
doublegetLineWidth()
voidsetLineWidth(double value)
           Gets or sets the border width in points.
BordergetRight()
           Gets the right border.
booleangetShadow()
voidsetShadow(boolean value)
           Gets or sets a value indicating whether the border has a shadow.
BordergetTop()
           Gets the top border.
BordergetVertical()
           Gets the vertical border that is used between cells.
Borderget(int index)
           Retrieves a Border object by index.
BordergetByBorderType(int borderType)
           Retrieves a Border object by border type.
 
Method Summary
voidclearFormatting()
           Removes all borders of an object.
java.util.Iteratoriterator()
           Returns an enumerator object that can be used to iterate over all borders in the collection.
 

Property Getters/Setters Detail

getLeft

public Border getLeft()
Gets the left border.

getRight

public Border getRight()
Gets the right border.

getTop

public Border getTop()
Gets the top border.

getBottom

public Border getBottom()
Gets the bottom border.

getHorizontal

public Border getHorizontal()
Gets the horizontal border that is used between cells or conforming paragraphs.

getVertical

public Border getVertical()
Gets the vertical border that is used between cells.

getCount

public int getCount()
Gets the number of borders in the collection.

getLineWidth/setLineWidth

public double getLineWidth() / public void setLineWidth(double value)
Gets or sets the border width in points.

Returns the width of the first border in the collection.

Sets the width of all borders in the collection excluding diagonal borders.

Example:

Creates a fancy looking green wavy page border with a shadow.
Document doc = new Document();
PageSetup ps = doc.getSections().get(0).getPageSetup();

ps.getBorders().setLineStyle(LineStyle.DOUBLE_WAVE);
ps.getBorders().setLineWidth(2);
ps.getBorders().setColor(Color.GREEN);
ps.getBorders().setDistanceFromText(24);
ps.getBorders().setShadow(true);

doc.save(getMyDir() + "PageSetup.PageBorders Out.doc");

getLineStyle/setLineStyle

public int getLineStyle() / public void setLineStyle(int value)
Gets or sets the border style. The value of the property is LineStyle integer constant.

Returns the style of the first border in the collection.

Sets the style of all borders in the collection excluding diagonal borders.

Example:

Creates a fancy looking green wavy page border with a shadow.
Document doc = new Document();
PageSetup ps = doc.getSections().get(0).getPageSetup();

ps.getBorders().setLineStyle(LineStyle.DOUBLE_WAVE);
ps.getBorders().setLineWidth(2);
ps.getBorders().setColor(Color.GREEN);
ps.getBorders().setDistanceFromText(24);
ps.getBorders().setShadow(true);

doc.save(getMyDir() + "PageSetup.PageBorders Out.doc");

getColor/setColor

public java.awt.Color getColor() / public void setColor(java.awt.Color value)
Gets or sets the border color.

Returns the color of the first border in the collection.

Sets the color of all borders in the collection excluding diagonal borders.

Example:

Creates a fancy looking green wavy page border with a shadow.
Document doc = new Document();
PageSetup ps = doc.getSections().get(0).getPageSetup();

ps.getBorders().setLineStyle(LineStyle.DOUBLE_WAVE);
ps.getBorders().setLineWidth(2);
ps.getBorders().setColor(Color.GREEN);
ps.getBorders().setDistanceFromText(24);
ps.getBorders().setShadow(true);

doc.save(getMyDir() + "PageSetup.PageBorders Out.doc");

getDistanceFromText/setDistanceFromText

public double getDistanceFromText() / public void setDistanceFromText(double value)
Gets or sets distance of the border from text in points.

Gets the distance from text for the first border.

Sets the distance from text for all borders in the collection excluding diagonal borders.

Has no effect and will be automatically reset to zero for borders of table cells.

Example:

Creates a fancy looking green wavy page border with a shadow.
Document doc = new Document();
PageSetup ps = doc.getSections().get(0).getPageSetup();

ps.getBorders().setLineStyle(LineStyle.DOUBLE_WAVE);
ps.getBorders().setLineWidth(2);
ps.getBorders().setColor(Color.GREEN);
ps.getBorders().setDistanceFromText(24);
ps.getBorders().setShadow(true);

doc.save(getMyDir() + "PageSetup.PageBorders Out.doc");

getShadow/setShadow

public boolean getShadow() / public void setShadow(boolean value)
Gets or sets a value indicating whether the border has a shadow.

Gets the value from the first border in the collection.

Sets the value for all borders in the collection excluding diagonal borders.

Example:

Creates a fancy looking green wavy page border with a shadow.
Document doc = new Document();
PageSetup ps = doc.getSections().get(0).getPageSetup();

ps.getBorders().setLineStyle(LineStyle.DOUBLE_WAVE);
ps.getBorders().setLineWidth(2);
ps.getBorders().setColor(Color.GREEN);
ps.getBorders().setDistanceFromText(24);
ps.getBorders().setShadow(true);

doc.save(getMyDir() + "PageSetup.PageBorders Out.doc");

getByBorderType

public Border getByBorderType(int borderType)
Retrieves a Border object by border type.

Note that not all borders are present for different document elements. This method throws an exception if you request a border not applicable to the current object.

Parameters:
borderType - A BorderType value. A BorderType value that specifies the type of the border to retrieve.

get

public Border get(int index)
Retrieves a Border object by index.
Parameters:
index - Zero-based index of the border to retrieve.

Method Detail

clearFormatting

public void clearFormatting()
Removes all borders of an object.

iterator

public java.util.Iterator iterator()
Returns an enumerator object that can be used to iterate over all borders in the collection.

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