Para exportar por ej los resultados contenidos en un query puedes hacer asi:Declaras una variable Variant V por ej en el header bajo el titulo public, el codigo es el siguente .
V= CreateOleObject("Excel.Application");
//V.OlePropertySet("Visible",false);
V.OlePropertyGet("Workbooks").OleProcedure("Add");
DataSource1->Enabled = false;//para no visualizar el movimiento del DBGrid
int row = 1;
String COLUMNA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";//para los nombres de columnas
Query1->First();
Screen->Cursor = Controls::TCursor(crHourGlass);
//cabeceras
for (int i = 0; i < FQuery->Query1->FieldDefs->Count; i++)
{
TFieldDef *fd = FQuery->Query1->FieldDefs->Items[i];
if(i<=25)
V.OlePropertyGet("Range",COLUMNA.SubString(i+1,1)+IntToStr(row)).OleProcedure("Select");
if(i>25 && i <=51)
V.OlePropertyGet("Range","A"+COLUMNA.SubString(i+1-26,1)+IntToStr(row)).OleProcedure("Select");
if(i>51 && i <=77)
V.OlePropertyGet("Range","B"+COLUMNA.SubString(i+1-26,1)+IntToStr(row)).OleProcedure("Select");
if(i>77 && i <=103)
V.OlePropertyGet("Range","C"+COLUMNA.SubString(i+1-78,1)+IntToStr(row)).OleProcedure("Select");
V.OlePropertyGet("ActiveCell").
OlePropertySet("Value",fd->Name);
}
row++;
row++;
while(!Query1->Eof)
{
for(int col=0;col<Query1->FieldCount;col++)
{
if(col<=25)
V.OlePropertyGet("Range",COLUMNA.SubString(col+1,1)+IntToStr(row)).OleProcedure("Select");
if(col>25 && col <=51)//if(col>26 <=52)
V.OlePropertyGet("Range","A"+COLUMNA.SubString(col+1-26,1)+IntToStr(row)).OleProcedure("Select");
if(col>51 && col <=77)
V.OlePropertyGet("Range","B"+COLUMNA.SubString(col+1-52,1)+IntToStr(row)).OleProcedure("Select");
if(col>77 && col <=103)
V.OlePropertyGet("Range","C"+COLUMNA.SubString(col+1-78,1)+IntToStr(row)).OleProcedure("Select");
V.OlePropertyGet("ActiveCell").
OlePropertySet("Value",Query1->Fields->Fields[col]->AsString);
}
Query1->Next();
row++;
}
V.OlePropertySet("Visible",true);//si lo pones al principio visualizas la insercion, pero ralentiza
Screen->Cursor = Controls::TCursor(crDefault);
DataSource1->Enabled = true;