property Column.FormatColumn as String
Specifies the format to display the cells in the column.

 TypeDescription 
   String A string expression that defines the format to display the cell, including HTML formatting, if the cell supports it.  
By default, the FormatColumn property is empty. The cells in the column use the provided format only if is valid ( not empty, and syntactically correct ), to display data in the column. The FormatColumn property provides a format to display all cells in the column using a predefined format. The expression may be a combination of variables, constants, strings, dates and operators, and value. The value operator gives the value to be formatted.  A string is delimited by ", ` or ' characters, and inside they can have the starting character preceded by \ character, ie "\"This is a quote\"". A date is delimited by # character, ie #1/31/2001 10:00# means the January 31th, 2001, 10:00 AM. The cell's HTML format is applied only if the CellCaptionFormat or Def(exCellCaptionFormat) is exHTML. If valid, the FormatColumn is applied to all cells for which the CellCaptionFormat property is not exComputedField. This way you can specify which cells use or not the FormatColumn property. The ComputedField property indicates the formula of the computed column.

For instance:

The value keyword in the property indicates the value to be formatted. 

The expression supports cell's identifiers as follows:

The predefined operators for auto-numbering are:

This property/method supports predefined constants and operators/functions as described here.

The following VB sample shows how can I display the column using currency:

With Tree1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	With .Items
		.AddItem "1.23"
		.AddItem "2.34"
		.AddItem "0"
		.AddItem 5
		.AddItem "10000.99"
	End With
End With
The following VB.NET sample shows how can I display the column using currency:
With AxTree1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	With .Items
		.AddItem "1.23"
		.AddItem "2.34"
		.AddItem "0"
		.AddItem 5
		.AddItem "10000.99"
	End With
End With
The following C++ sample shows how can I display the column using currency:
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXTREELib' for the library: 'ExTree 1.0 Control Library'

	#import "C:\\Windows\\System32\\ExTree.dll"
	using namespace EXTREELib;
*/
EXTREELib::ITreePtr spTree1 = GetDlgItem(IDC_TREE1)->GetControlUnknown();
((EXTREELib::IColumnPtr)(spTree1->GetColumns()->Add(L"Currency")))->PutFormatColumn(L"currency(dbl(value))");
EXTREELib::IItemsPtr var_Items = spTree1->GetItems();
	var_Items->AddItem("1.23");
	var_Items->AddItem("2.34");
	var_Items->AddItem("0");
	var_Items->AddItem(long(5));
	var_Items->AddItem("10000.99");
The following C# sample shows how can I display the column using currency:
(axTree1.Columns.Add("Currency") as EXTREELib.Column).FormatColumn = "currency(dbl(value))";
EXTREELib.Items var_Items = axTree1.Items;
	var_Items.AddItem("1.23");
	var_Items.AddItem("2.34");
	var_Items.AddItem("0");
	var_Items.AddItem(5);
	var_Items.AddItem("10000.99");
The following VFP sample shows how can I display the column using currency:
with thisform.Tree1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	with .Items
		.AddItem("1.23")
		.AddItem("2.34")
		.AddItem("0")
		.AddItem(5)
		.AddItem("10000.99")
	endwith
endwith
 


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