property Items.Caption(Index as Long, ColIndex as Variant) as Variant
Retrieves or sets the text displayed by a specific cell.

 TypeDescription 
   Index as Long A long expression that indicates the index of the item.  
   ColIndex as Variant A long expression that indicates the column's index, or a string expression that indicates the column's caption or column's key.  
   Variant A string expression that indicates the cell's caption.  

The CellCaption property specifies the cell's content. To associate an user data for a cell you can use CellData property. Use the CaptionFormat property to use HTML tags in the cell's caption, or to specify a computed field .  Use the ItemData property to associate an extra data to an item. To hide a column you have to use Visible property of the Column object. The Add method specifies also the caption for the first cell in the item. Use the <img> HTML tag to insert icons inside the cell's caption, if the CaptionFormat property is exHTML. For instance, the "some image <img>1</img> other image <img>2</img> rest of text", displays combined text and icons in the cell's caption. Use the Images method to load icons at runtime. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula.

The Caption property is interpreted in different ways, based on the CaptionFormat property as follows:

If the CaptionFormat property is exComputedField, the Caption property may may include variables, constants, operators or ( ) parenthesis.  A variable is defined as %n, where n is the index of the column ( zero based ). For instance, the %0 indicates the first column, the %1, indicates the second column, and so on.  A constant is a float expression ( for instance, 23.45 ). 

The property supports the following binary arithmetic operators:

The property supports the following unary boolean operators:

The property supports the following binary boolean operators:

The property supports the following binary boolean operators, all these with the same priority 0 :

Obviously, the priority of the operations inside the expression is determined by ( ) parenthesis and the priority for each operator. The property may be a combination of variables, constants and operators.

Samples:

  1. "1", the cell displays 1
  2. "%0 + %1", the cell displays the sum between cells in the first and second columns.
  3. "%0 + %1 - %2", the cell displays the sum between cells in the first and second columns minus the third column.
  4. "(%0 + %1)*0.19", the cell displays the sum between cells in the first and second columns multiplied with 0.19.
  5. "(%0 + %1 + %2)/3", the cell displays the arithmetic average for the first three columns.
  6. "%0 + %1 < %2 + %3", displays 1 if the sum between cells in the first  two columns is less than the sum of third and forth columns.

 

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.