BorderType

Inheritance: java.lang.Object

public class BorderType

Specifies sides of a border.

To learn more, visit the Programming with Documents documentation article.

Examples:

Shows how to insert a paragraph with a top border.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);

 Border topBorder = builder.getParagraphFormat().getBorders().getByBorderType(BorderType.TOP);
 topBorder.setLineWidth(4.0d);
 topBorder.setLineStyle(LineStyle.DASH_SMALL_GAP);
 // Set ThemeColor only when LineWidth or LineStyle setted.
 topBorder.setThemeColor(ThemeColor.ACCENT_1);
 topBorder.setTintAndShade(0.25d);

 builder.writeln("Text with a top border.");

 doc.save(getArtifactsDir() + "Border.ParagraphTopBorder.docx");
 

Fields

FieldDescription
BOTTOMSpecifies the bottom border of a paragraph or a table cell.
DIAGONAL_DOWNSpecifies the diagonal border in a table cell.
DIAGONAL_UPSpecifies the diagonal border in a table cell.
HORIZONTALSpecifies the horizontal border between cells in a table or between conforming paragraphs.
LEFTSpecifies the left border of a paragraph or a table cell.
NONEDefault value.
RIGHTSpecifies the right border of a paragraph or a table cell.
TOPSpecifies the top border of a paragraph or a table cell.
VERTICALSpecifies the vertical border between cells in a table.
length

Methods

MethodDescription
fromName(String borderTypeName)
getName(int borderType)
getValues()
toString(int borderType)

BOTTOM

public static int BOTTOM

Specifies the bottom border of a paragraph or a table cell.

DIAGONAL_DOWN

public static int DIAGONAL_DOWN

Specifies the diagonal border in a table cell.

DIAGONAL_UP

public static int DIAGONAL_UP

Specifies the diagonal border in a table cell.

HORIZONTAL

public static int HORIZONTAL

Specifies the horizontal border between cells in a table or between conforming paragraphs.

LEFT

public static int LEFT

Specifies the left border of a paragraph or a table cell.

NONE

public static int NONE

Default value.

public static int RIGHT

Specifies the right border of a paragraph or a table cell.

TOP

public static int TOP

Specifies the top border of a paragraph or a table cell.

VERTICAL

public static int VERTICAL

Specifies the vertical border between cells in a table.

length

public static int length

fromName(String borderTypeName)

public static int fromName(String borderTypeName)

Parameters:

ParameterTypeDescription
borderTypeNamejava.lang.String

Returns: int

getName(int borderType)

public static String getName(int borderType)

Parameters:

ParameterTypeDescription
borderTypeint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int borderType)

public static String toString(int borderType)

Parameters:

ParameterTypeDescription
borderTypeint

Returns: java.lang.String