Borders (collection)

<< Click to Display Table of Contents >>

Borders (collection)

Access paths for paragraph borders:

Application à Documents à Item à Paragraphs à Item à Borders

Application à ActiveDocument à Paragraphs à Item à Borders

Access paths for table borders:

Application à Documents à Item à Tables à Item à Borders

Application à ActiveDocument à Tables à Item à Borders

Access path for table row borders:

Application à Documents à Item à Tables à Item à Rows à Item à Borders

Application à ActiveDocument à Tables à Item à Rows à Item à Borders

Access path for table cell borders:

Application à Documents à Item à Tables à Item à Cell(x, y) à Borders

Application à ActiveDocument à Tables à Item à Cell(x, y) à Borders

Application à Documents à Item à Tables à Item à Rows à Item à Cells à Item à Borders

Application à ActiveDocument à Tables à Item à Rows à Item à Cells à Item à Borders

 1  Description

Borders is a collection of the border lines (left, right, top, bottom, etc.) of a paragraph, a table, a table row or a cell. Accordingly, it is a child object of either Paragraph, Table, Row or Cell.

The individual elements of this collection are of the type Border.

 2  Access to the object

Each paragraph, table, table row or cell has exactly one instance of the Borders collection. It is accessed through the object pointer Borders in the respective object. The parameter you pass is the number of the border that you would like to access, as follows:

tmBorderTop          = -1 ' Top border line

tmBorderLeft         = -2 ' Left border line

tmBorderBottom       = -3 ' Bottom border line

tmBorderRight        = -4 ' Right border line

tmBorderHorizontal   = -5 ' Horizontal grid line (only for tables)

tmBorderVertical     = -6 ' Vertical grid line (only for tables and table rows)

tmBorderBetween      = -7 ' Border line between paragraphs (only for paragraphs)

Examples:

' Change the left border of the first paragraph

tm.ActiveDocument.Paragraphs(1).Borders(tmBorderLeft).Type = tmLineStyleSingle

 

' Change the top border of the first table

tm.ActiveDocument.Tables(1).Borders(tmBorderTop).Type = tmLineStyleDouble

 

' Change the vertical grid lines of the second row in the first table

tm.ActiveDocument.Tables(1).Rows(2).Borders(tmBorderVertical).Color = smoColorRed

 

' Change the bottom border of the third cell in the second row from the first table

tm.ActiveDocument.Tables(1).Rows(2).Cells(3).Borders(tmBorderBottom).Type = tmLineStyleDouble

 3  Properties, objects, collections and methods

Properties:

Count R/O

 

Objects:

Item Border (default object)

Application Application

Parent Paragraph, Table, Row or Cell

Count (property, R/O)

Data type: Long

Returns the number of Border objects in the collection, i.e. the number of border lines available for the related object:

When used as a child object of a Paragraph object, Count returns the value 5, since paragraphs have five different types of border lines (left, right, top, bottom, between the paragraphs).

When used as a child object of a Table object, Count returns 6, since tables have six different types of border lines (left, right, top, bottom, horizontal gutter, vertical gutter).

When used as a child object of a Row object, Count returns 5, since table rows have five different types of border lines (left, right, top, bottom, vertical gutter).

When used as a child object of a Cell object, Count returns 4, since table cells have four different types of border lines (left, right, top, bottom).

Item (pointer to object)

Data type: Object

Returns an individual Border object that you can use to get or set the properties (such as color and thickness) of one individual border line.

Which Border object you get depends on the numeric value that you pass to Item. The following table shows the admissible values:

tmBorderTop          = -1 ' Top border line

tmBorderLeft         = -2 ' Left border line

tmBorderBottom       = -3 ' Bottom border line

tmBorderRight        = -4 ' Right border line

tmBorderHorizontal   = -5 ' Horizontal grid line (only for tables)

tmBorderVertical     = -6 ' Vertical grid line (only for tables and table rows)

tmBorderBetween      = -7 ' Border line between paragraphs (only for paragraphs)

Application (pointer to object)

Data type: Object

Returns the Application object.

Parent (pointer to object)

Data type: Object

Returns the parent object, i.e. an object of the types Paragraph, Table, Row or Cell.

Example for the usage of the Borders collection

Sub Main

 Dim tm as Object

 

 Set tm = CreateObject("TextMaker.Application")

 tm.Visible = True

 

 With tm.ActiveDocument.Paragraphs.Item(1)

                 .Borders(tmBorderLeft).Type    = tmLineStyleSingle

                 .Borders(tmBorderLeft).Thick1  = 4

                 .Borders(tmBorderLeft).Color   = smoColorBlue

 

                 .Borders(tmBorderRight).Type   = tmLineStyleDouble

                 .Borders(tmBorderRight).Thick1 = 1

                 .Borders(tmBorderRight).Thick2 = 1

                 .Borders(tmBorderRight).Color  = smoColorRed

 End With

 

 Set tm = Nothing

End Sub