Cell Attributes

identifier can be used to access each cell’s or Row attributes.   The Cell is acObjectTypeCell and the Row is acObjectTypeRow.

To access the attributes of cell(Row, Col) of a document or a table, one can use the "Cells[Row, Col]" reference.

To access the attributes from the row, one can use the "Cells[Row]" reference.

Note that cell indices start at 1 and the index 0 is invalid.

 

Example: To set the background color of cell(3, 2) to red, we can use:

PDF1.ObjectAttribute["Cells[3,2] ", "BackColor"] = 0x00FF0000;

 

Note that the document itself can be in the form of a table (Excel style spreadsheet), in this case we can access each cell’s attributes through ObjectAttribute. If a table object named Table1 is added to a document, and we want to access the attributes of Table1, we should use:

PDF1.ObjectAttribute["Table1.Cells[3,2] ", "BackColor"] = 0x00FF0000;

 

Cell Attributes

 

Attribute Name

Description

Type

Values

Default Value

xPos

*Read only

Horizontal position in Twips.

Integer

>= 0

0

Width

Width of cell in Twips. Changing this property changes the width of the column where the cell is located.

Integer

>= 0

2248

Text

Multiline text contained in cell.

String

 

NULL

Font

Font used to draw cell’s content.

Font

If empty, default document font is used

NULL

TextColor

Color used to draw text.

Color

COLORREF (bbggrr) 000000 to FFFFFF

COLORREF (aabbggrr) 00000000 to FFFFFFFF

000000 (Solid black)

HorzAlign

Horizontal text alignment.

enum acHorzAlign

1: acHorzAlignLeft

2: acHorzAlignCenter

3: acHorzAlignRight

4: acHorzJustify

1: acHorzAlignLeft

VertAlign

Vertical text alignment.

enum acVertAlign

1: acVertAlignTop

2: acVertAlignCenter

3: acVertAlignBottom

3: acVertAlignBottom

TextGap

Gap between text and borders.

Integer

Units are in points or 12th of an inch.

0: None

1: Thin

2: Medium

3: Thick

1: Thin

DataType

Type of data expected in the field object.

enum acDataType

0: acDataTypeUnknown

1: acDataTypeText

2: acDataTypeNumerical

3: acDataTypeDate

0: acDataTypeUnknown

Format

Mask used to format the data contained in the field.

Text

The formats for each DataType are similar to what is provided by Microsoft Excel®.

NULL

TitleColor

Color for cell title.

Color

COLORREF (bbggrr) 000000 to FFFFFF

COLORREF (aabbggrr) 00000000 to FFFFFFFF

000000 (Solid black)

TitleText

Cell title.

String

 

NULL

TitleFont

Cell title font.

Font

If empty, default document value is used

NULL

TitlePosition

Position of cell’s title.

enum acTitlePosition

1: acTopLeft

2: acTopCenter

3: acTopRight

4: acBottomLeft

5 : acBottomCenter

6: acBottomRight

1: acTopLeft

TitleVertical

Draw cell’s title vertically.

Boolean

True/ False

False

HorzBorders

Top and bottom cell borders.

enum acHorzBorders

0: acHorzBordersNone

1: acHorzBordersTop

2: acHorzBordersBottom

3: acHorzBordersTopBottom

0: acHorzBordersNone

VertBorders

Left and right cell borders.

enum acVertBorders

0: acVertBordersNone

1: acVertBordersLeft

2: acVertBordersRight

3: acVertBordersLeftRight

0: acVertBordersNone

BorderColor

Color for drawing text border.

Color

COLORREF (bbggrr) 000000 to FFFFFF

COLORREF (aabbggrr) 00000000 to FFFFFFFF

000000 (Solid black)

BorderWidth

Width of border around cell.

Integer.

Units are in points or 12th of an inch.

0: acBorderWidthNone

1: acBorderWidthSimple

2: acBorderWidthDouble

3: acBorderWidthTriple

4: acBorderWidthQuadruple

0: acBorderWidth None

BackColor

Background color.

Color

COLORREF (bbggrr) 000000 to FFFFFF

COLORREF (aabbggrr) 00000000 to FFFFFFFF

FFFFFFFF (Transparent)

CharSpacing

Spacing between characters.

Integer

10th of a Twip

0

WordSpacing

Spacing between words.

Integer

10th of a Twip

0

Editable

Field can be modified by user when the document is compiled or saved in view only mode.

Boolean

True / False

False

Vertical

Vertical text.

Boolean

True / False

False

xMain

When multiple cells are grouped together, xMain and yMain contain the main cell of the group.

Integer

 

0

yMain

When multiple cells are grouped together, xMain and yMain contain the main cell of the group.

Integer

 

0

xSpan

When multiple cells are grouped together,Xspan contains the number of cells covered by the group.

Integer

 

1

ySpan

When multiple cells are grouped together,ySpan contains the number of cells covered by the group.

Integer

 

1

MergeOption

When the cell is grouped with other cells, specifies in which direction the cell is grouped (right, left, top, bottom).

Integer

 

0

Value

Result of compiling the formula contained in the Text property.

String

 

NULL

 

Result

It is the final value that the user sees after applying any formatting.

String

 

NULL

 

Hyperlink

It is the link targeted when the object is clicked.

String

 

NULL

 

FormattedText

It is the string contents of the cell that includes formatting information such as Bold or Italic.

String

 

NULL

The Formatted Text property allows the user to specify the text that has some sections formatted with a given format style such as: font size, color, bold, italics, underlined, strike-through, etc.

The notations mentioned below are used to specify the needed formats:

Notations

Meaning

b

Bold

i

Italics

u

Underline

s

Strike-through

fs

Font size multiplied by 100.

fc

Font Color, and the color number is hexadecimal.

 

The text section should be enclosed with tags to specify the formatting. For example: <b>Hello World</b> will make the text "Hello World" to be bold.

If a style has an attribute like in the case of font size and font color, we add a colon to the opening tag and append the attribute after it, for example: <fs:1200>Hello World</fs> will set the text "Hello World" to a font size of 12.

 

Example

<fc:FF0000><fs:2400><u>Hello</u><i>W<s>or</s>l</i>d</fs></fc>

displays as:

 

 

 

 

Row Attributes

 

Attribute Name

Description

Type

Values

Default Value

CellArray

Array of cells contained in this row

Array

acObjectTypeCell

NULL

Height

Height of row in Twips.

Integer

>= 0

1584

Page

*Read only

Page number on which the row is located.

Integer

>= 0

 

yPos

*Read only

Vertical position of the row in the page in Twips.

Integer

>= 0

0

 

Inserting Formulas in Cells

Each cell of a table can contain an expression that is evaluated when the document is compiled. An expression always starts with the equal sign =.

The following operators are supported by the PDF Creator interpreter:

 

Operator

Description

+

Addition.

-

Subtraction or unary minus.

/

Division.

*

Multiplication.

&

String concatenation.

And

Logical AND (French speakers can also use Et).

Or

Logical OR (French speakers can also use Ou).

Not

Logical NOT.

<>

Not equal to.

<

Less than.

<=

Less or equal.

>

Greater.

>=

Greater or equal.

 

The following rules apply when evaluating expressions:

 

 

Formatting Cell Contents

When DataType is Text: No predefine formatting is applicable.

When Data Type is Numerical, for example, formats for the following input number: 1264341.56234.

 

Format String

Output

#

1264341.56234

#,###.00

1,264,341.56

#,###.0000

1,264,341.5623

 

When Data Type is Date:

 

Symbol

Meaning

dddd

Day in Text format (Monday, Tuesday, etc).

ddd

Day in short text format (Mon, Tues, Wed, etc).

dd

Day in two digit format (08, 09, 10, 11, etc).

d

Day in minimum digit format (8, 9, 10, etc).

mmmm

Month in Text format (January, February, etc).

mmm

Month in short text format (Jan, Feb, etc).

mm

Month in two digit format (08, 09, 10, 11, etc).

m

Month in minimum digit format (8, 9, 10, etc).

yyyy

Year (2007, 2008, etc).

yy

Year in short format (07, 08, etc).

 

Examples:

Formats for the following input date/time: 03/18/2008 04:39:23 PM

 

Format String

Output

ddd mmmm dd yy

Tuesday March 18 08

HH:MM:SS T

16:39:23 PM

dddd/mmm/yyyy HH:MM:SS T

Tuesday/Mar/2008 16:39:23 PM