Board index » cppbuilder » OWC in BCB

OWC in BCB


2006-03-21 06:36:06 PM
cppbuilder58
Hi,
I have imported OWC components with the activex import bcb utility and
after put a pivottable component on a form, I have writed the next code
in a click event buttom:
pt1->ConnectionString = "DRIVER=SQL Server;SERVER=pruebas; etc ...";
pt1->CommandText = "SELECT * FROM
[owner1].[VIE_PLANIFICACION_RECURSOS]";
//pt1.ActiveView.FieldSets("ano").Fields(0).Caption = "Aņos"
//pt1.ActiveView.ColumnAxis.InsertFieldSet _ pt1.ActiveView.FieldSets("ano")
pt1->DisplayFieldList = False;
pt1->DisplayToolbar = True;
...this works fine, but I don't know what to do with the two commented
lines to convert and work with BCB. Pleeease heeeelp.
Thanks in advance.
 
 

Re:OWC in BCB

Hey, I've resolved my problem using an OleContainer (OC1) with
AutoActivate=aaGetFocus.
This is the code:
#define _set OlePropertySet //used to abreviate the code
#define _get OlePropertyGet
#define _proc OleProcedure
#define _func OleFunction
void __fastcall TOleWordForm::Connect(TObject *Sender)
{
try {
OC1->CreateObject("OWC10.PivotTable",false);
OC1->SetFocus();
OC1->OleObject.OlePropertySet("ConnectionString","DRIVER=SQL
Server;SERVER=pruebas; etc ..."); //without abreviating
OC1->OleObject.OlePropertySet("CommandText","SELECT * FROM
[owner1].[VIE_PLANIFICACION_RECURSOS]");
Variant AV=OC1->OleObject.OlePropertyGet("ActiveView");
//OC1->ObjectPropertiesDialog();
AV._get("FilterAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Proyecto"));
AV._get("FilterAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Dpto"));
AV._get("FilterAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Programa"));
AV._get("FilterAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Nombre"));
Variant IT=AV.OlePropertyGet("FieldSets","ano");
IT.OlePropertyGet("Fields","ano").OlePropertySet("Caption","Aņos");
IT.OlePropertyGet("Fields","ano").OlePropertySet("Expanded","False");
IT.OlePropertyGet("Fields","ano").OlePropertySet("Subtotals",
0, "False");
AV.OlePropertyGet("ColumnAxis").OleProcedure("InsertFieldSet", IT);
AV.OlePropertyGet("ColumnAxis").OleProcedure("InsertFieldSet",
AV._get("FieldSets","mes"));
AV._get("FieldSets","Acronimo")._get("Fields","Acronimo")._set("Expanded","False");
AV._get("RowAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Acronimo"));
AV._get("DataAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Unidades"));
AV._get("DataAxis")._proc("InsertFieldSet",
AV._get("FieldSets","Recurso"));
AV._get("DataAxis")._proc("InsertTotal",
AV._func("AddTotal","Cantidad Planificada",
AV._get("FieldSets","Unidades")._get("Fields","Unidades"), 1));
OC1->OleObject._get("ActiveData")._proc("HideDetails");
}
catch(...) {
}
}
LuisYamil escribi?
Quote
Hi,
I have imported OWC components with the activex import bcb utility and
after put a pivottable component on a form, I have writed the next code
in a click event buttom:

pt1->ConnectionString = "DRIVER=SQL Server;SERVER=pruebas; etc ...";
pt1->CommandText = "SELECT * FROM
[owner1].[VIE_PLANIFICACION_RECURSOS]";
//pt1.ActiveView.FieldSets("ano").Fields(0).Caption = "Aņos"
//pt1.ActiveView.ColumnAxis.InsertFieldSet _
pt1.ActiveView.FieldSets("ano")
pt1->DisplayFieldList = False;
pt1->DisplayToolbar = True;

...this works fine, but I don't know what to do with the two commented
lines to convert and work with BCB. Pleeease heeeelp.

Thanks in advance.