Working with Borders

Just as table cells are regular text shapes, table borders are just lines (a type of auto shape). However unlike cells, you do not work with the underlying shape in order to change a border. To change the appearance of a border you choose a cell or a rectangular set of cells, decide which borders for those cells you wish to update and then use the table border methods to access a border property (e.g. color, width, style, etc).

Setting borders

You can set the borders for a single cell or a collection of cells. You set the borders by changing the borders' properties, where the borders are specified by (a) the type of borders you wish, and (b) the applicable cell or cells. The border types are a set of predefined constants that represent the border formatting options available in PowerPoint. (Border type values are listed in the table below).

To set the border for a single cell use:

void setBorder(TextShape cell, int type, int property, java.lang.Object value)

To set the border for a rectangular collection of cells use:

void setBorder(java.util.Collection cells, int type, int property, java.lang.Object value)

Getting borders

To get the border for a cell, you get the border properties for that cell using:

java.lang.Object getBorder(int row, int column, int type, int property)

Border types

The library supports the following border types:

Type

Description

BORDER_BOTTOM

A bottom edge border

BORDER_DIAGONAL_DOWN

A diagonal border running from upper left to lower right

BORDER_DIAGONAL_UP

A diagonal border running from lower left to upper right

BORDER_INNER

A compound border combining horizontal and vertical inner borders

BORDER_INNER_HORIZONTAL

A horizontal border between cells (in multi-cell selections)

BORDER_INNER_VERTICAL

A vertical border between cells (in multi-cell selections)

BORDER_LEFT

A left edge border

BORDER_OUTER

A compound border combining left, right, top and bottom edge borders

BORDER_RIGHT

A right edge border

BORDER_TOP

A top edge border

For example the following code snippet set a green border around an entire table.

Table table = ...;
table.setBorder(table.selectTable(), Table.BORDER_OUTER, ShapeProperties.LINE, Boolean.TRUE);
table.setBorder(table.selectTable(), Table.BORDER_OUTER, ShapeProperties.LINE_COLOR, Color.green);

Page generated: 2008-01-18 02:53:28 GMT TonicPoint Builder Developer's Guide -- Version 2.3