Cell (object)

<< Click to Display Table of Contents >>

Cell (object)

Access paths:

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

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

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

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

 1  Description

A Cell object represents one individual cell of a table row and allows you to retrieve and change the formatting of this table cell.

An individual Cell object exists for each cell. If you add cells to a table row or delete them, the respective Cell objects will be created or deleted dynamically.

 2  Access to the object

The individual Cell objects can be accessed solely through enumerating the elements of the collection Cells. Each row in a table has exactly one instance of this collection.

An example:

' Set the width of the fifth cell in the second row of the first table to 25

tm.ActiveDocument.Tables(1).Rows(2).Cells(5).PreferredWidth = 25

 3  Properties, objects, collections and methods

Properties:

PreferredWidthType

PreferredWidth

Width

VerticalAlignment

Orientation

LockText

LeftPadding

RightPadding

TopPadding

BottomPadding

 

Objects:

Shading Shading

Application Application

Parent Row

 

Collections:

Borders Borders

PreferredWidthType (property)

Data type: Long (TmPreferredWidthType)

Gets or sets the method used to determine the width of the cell. The possible values are:

tmPreferredWidthPoints    = 0 ' width in points

tmPreferredWidthPercent   = 1 ' width in percent

tmPreferredWidthAuto      = 2 ' automatic width

PreferredWidth (property)

Data type: Single

Gets or sets the width of the cell. Depending on the width type of the cell, the value is expressed either in points or in percent (see PreferredWidthType above).

Example:

' Set the width for the first cell to 25 percent

tm.ActiveDocument.Tables(1).Rows(1).Cells(1).PreferredWidthType = tmPreferredWidthPercent

tm.ActiveDocument.Tables(1).Rows(1).Cells(1).PreferredWidth = 25

 

' Set the width for the second cell to 3.5cm

tm.ActiveDocument.Tables(1).Rows(1).Cells(2).PreferredWidthType = tmPreferredWidthPoints

tm.ActiveDocument.Tables(1).Rows(1).Cells(1).PreferredWidth = tm.CentimetersToPoints(3.5)

Width (property)

Data type: Single

Gets or sets the width of the cell in points (1 point corresponds to 1/72 inches).

Unlike the PreferredWidth property (see there), it will be ignored whether the cell has an absolute, percentual or automatic width – it will always return the width in points.

VerticalAlignment (property)

Data type: Long (TmCellVerticalAlignment)

Gets or sets the vertical alignment of the text inside the cell. The possible values are:

tmCellVerticalAlignmentTop       = 0 ' top alignment

tmCellVerticalAlignmentCenter    = 1 ' center alignment

tmCellVerticalAlignmentBottom    = 2 ' bottom alignment

tmCellVerticalAlignmentJustify   = 3 ' vertical justification

Orientation (property)

Data type: Long

Gets or sets the print orientation of the cell. Possible values: 0, 90, 180 and -90, corresponding to the respective rotation angle.

Note: The value 270 will be automatically converted to -90.

LockText (property)

Data type: Boolean

Gets or sets the property "Lock text" for the cell (True or False). Note that TextMaker locks the cell only when form mode is active.

LeftPadding (property)

Data type: Single

Gets or sets the left text margin inside the cell, measured in points (1 point corresponds to 1/72 inches).

RightPadding (property)

Data type: Single

Gets or sets the right text margin inside the cell, measured in points (1 point corresponds to 1/72 inches).

TopPadding (property)

Data type: Single

Gets or sets the top text margin inside the cell, measured in points (1 point corresponds to 1/72 inches).

BottomPadding (property)

Data type: Single

Gets or sets the bottom text margin inside the cell, measured in points (1 point corresponds to 1/72 inches).

Shading (pointer to object)

Data type: Object

Returns the Shading object which you can use to access the shading of the table cell.

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 type Row.

Borders (pointer to collection)

Data type: Object

Returns a Borders collection representing the four border lines of the table cell. You can use this collection to retrieve and change the line settings (thickness, color, etc.).