method FormatContents.Add (Key as String, Expression as String, [Name as Variant])
Adds a FormatContent object and returns a reference to the newly created object.

TypeDescription
Key as String A String expression that defines the unique key to identify the FormatContent object. The Key must includes alpha-numeric characters, any other character will be ignored.
Expression as String The Expression parameter defines the format to be applied on the column or row. If the Expression is not valid, the FormatContent objects shows as disabled on the control's context menu. The value keyword defines the value to be converted, and the Expression supports a lot of predefined functions as shown here.
Name as Variant A String expression that defines the HTML Caption to be shown on the control's context menu.
ReturnDescription
FormatContentA FormatContent object being created.
The Add method adds a new FormatContent object to the collection. The Expression property defines the format to be applied on the column or row. If the Expression is not valid, the FormatContent objects shows as disabled on the control's context menu. The ToolTip property defines the FormatContent's tooltip, which is shown when the cursor hovers the object in the control's context menu.

Here's a few samples on how to use the FormatContent objects:

Use the Key of the FormatContent in [content=key] to apply the specified object to any column or row. For instance, the PivotRows property on "0[content=numeric]" to group by the first column and shows the column's content as numeric. The same rule is applied to PivotColumns or PivotTotals property.

The following samples show how you can display the column in upper-case.

VBA (MS Access, Excell...)

With Pivot1
	.Import "C:\Program Files\Exontrol\ExPivot\Sample\data.txt"
	.FormatContents.Add "upper","upper(value)"
	.PivotRows = "0[content=upper]"
End With

VB6

With Pivot1
	.Import "C:\Program Files\Exontrol\ExPivot\Sample\data.txt"
	.FormatContents.Add "upper","upper(value)"
	.PivotRows = "0[content=upper]"
End With

VB.NET

With Expivot1
	.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
	.FormatContents.Add("upper","upper(value)")
	.PivotRows = "0[content=upper]"
End With

VB.NET for /COM

With AxPivot1
	.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
	.FormatContents.Add("upper","upper(value)")
	.PivotRows = "0[content=upper]"
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXPIVOTLib' for the library: 'ExPivot 1.0 Control Library'

	#import <ExPivot.dll>
	using namespace EXPIVOTLib;
*/
EXPIVOTLib::IPivotPtr spPivot1 = GetDlgItem(IDC_PIVOT1)->GetControlUnknown();
spPivot1->Import("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt",vtMissing);
spPivot1->GetFormatContents()->Add(L"upper",L"upper(value)",vtMissing);
spPivot1->PutPivotRows(L"0[content=upper]");

C++ Builder

Pivot1->Import(TVariant("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt"),TNoParam());
Pivot1->FormatContents->Add(L"upper",L"upper(value)",TNoParam());
Pivot1->PivotRows = L"0[content=upper]";

C#

expivot1.Import("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt",null);
expivot1.FormatContents.Add("upper","upper(value)",null);
expivot1.PivotRows = "0[content=upper]";

JavaScript

<OBJECT classid="clsid:5C9DF3D3-81B1-42C4-BED6-658F17748686" id="Pivot1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	Pivot1.Import("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt",null);
	Pivot1.FormatContents.Add("upper","upper(value)",null);
	Pivot1.PivotRows = "0[content=upper]";
</SCRIPT>

C# for /COM

axPivot1.Import("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt",null);
axPivot1.FormatContents.Add("upper","upper(value)",null);
axPivot1.PivotRows = "0[content=upper]";

X++ (Dynamics Ax 2009)

public void init()
{
	;

	super();

	expivot1.Import("C:\\Program Files\\Exontrol\\ExPivot\\Sample\\data.txt");
	expivot1.FormatContents().Add("upper","upper(value)");
	expivot1.PivotRows("0[content=upper]");
}

Delphi 8 (.NET only)

with AxPivot1 do
begin
	Import('C:\Program Files\Exontrol\ExPivot\Sample\data.txt',Nil);
	FormatContents.Add('upper','upper(value)',Nil);
	PivotRows := '0[content=upper]';
end

Delphi (standard)

with Pivot1 do
begin
	Import('C:\Program Files\Exontrol\ExPivot\Sample\data.txt',Null);
	FormatContents.Add('upper','upper(value)',Null);
	PivotRows := '0[content=upper]';
end

VFP

with thisform.Pivot1
	.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
	.FormatContents.Add("upper","upper(value)")
	.PivotRows = "0[content=upper]"
endwith

dBASE Plus

local oPivot

oPivot = form.Activex1.nativeObject
oPivot.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
oPivot.FormatContents.Add("upper","upper(value)")
oPivot.PivotRows = "0[content=upper]"

XBasic (Alpha Five)

Dim oPivot as P

oPivot = topparent:CONTROL_ACTIVEX1.activex
oPivot.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
oPivot.FormatContents.Add("upper","upper(value)")
oPivot.PivotRows = "0[content=upper]"

Visual Objects


oDCOCX_Exontrol1:Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt",nil)
oDCOCX_Exontrol1:FormatContents:Add("upper","upper(value)",nil)
oDCOCX_Exontrol1:PivotRows := "0[content=upper]"

PowerBuilder

OleObject oPivot

oPivot = ole_1.Object
oPivot.Import("C:\Program Files\Exontrol\ExPivot\Sample\data.txt")
oPivot.FormatContents.Add("upper","upper(value)")
oPivot.PivotRows = "0[content=upper]"