Разработка информационно-поисковой системы на основе Borland Database Engine, драйвер – Paradox, страница 8

void __fastcall TFormMain::N10Click(TObject *Sender)

{

        try

        {

                TList   *Commands = new TList();

                Variant ExcelApplication = InitExcel(1);

                SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), 1, 2, "Сводная таблица всех баскетбольных матчей");

                Variant Sh = ExcelApplication.OlePropertyGet("Worksheets").OlePropertyGet("Item", 1);

                Sh.OlePropertySet("Name", "Общая таблица матчей");

                char    Str1 = 'A'+Table1->RecordCount+1;

                AnsiString s1 = "B1:"+ AnsiString(Str1) + "1";

                Variant range1 = ExcelApplication.OlePropertyGet("Range", s1.c_str());

                 range1.OlePropertySet("MergeCells",1);

                for(int i=1;i<=Table1->RecordCount;i++)

                {

                        TCommand *tmpRec = new TCommand;

                        tmpRec->ID = Table1ID->AsInteger;

                        tmpRec->Ind1 = i+1;

                        Commands->Add(tmpRec);

                        Table1->RecNo = i;

                        SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), i+2, 2, Table1Name->AsString);

 SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), 2, i+2, Table1Name->AsString);

                }

                char    tmpStr = 'A'+Table1->RecordCount+1;

                AnsiString s = "B2:"+ AnsiString(tmpStr) +IntToStr(Table1->RecordCount+2);

                Variant range = ExcelApplication.OlePropertyGet("Range", s.c_str());

                for (int i=1; i<=4; i++)

                {

                        range.OlePropertyGet("Borders").OlePropertyGet("Item", i).OlePropertySet("LineStyle", 1);

                }

                for(int i=1;i<=Table3->RecordCount;i++)

                {

                        Table3->RecNo = i;

                        int     tmpC1, tmpC2;

                        int     indC1, indC2;

                        AnsiString      Str;

                        tmpC1 = Table3IDTeam1->AsInteger;

                        tmpC2 = Table3IDTeam2->AsInteger;

                        Str = StaticText1->Caption + ":" + StaticText2->Caption;

                        for(int i=0;i<Commands->Count;i++)

                        {

                                if(((TCommand*)Commands->Items[i])->ID == tmpC1)

                                        indC1 = ((TCommand*)Commands->Items[i])->Ind1;

                                if(((TCommand*)Commands->Items[i])->ID == tmpC2)

                                        indC2 = ((TCommand*)Commands->Items[i])->Ind1;

                        }

                        SetCellValue(ExcelApplication,indC1,indC2,Str);

                }

                for(int i=Commands->Count-1;i>=0;i--)

                {

                        delete (TCommand*)Commands->Items[i];

                }

                delete Commands;

                ExcelApplication.OlePropertySet("Visible",true);

        }

        catch(...)

        {

                Application->MessageBox("Ошибка создания отчёта. Проверьте состояния фильтров.","Ошибка",MB_OK+MB_ICONERROR);

        }

}

Статистика игроков команд

void __fastcall TFormMain::N12Click(TObject *Sender)

{

        try

        {

                AnsiString s;

                Variant range;

                TList   *Players1 = new TList();

                TList   *Players2 = new TList();

                Variant Range;

                Variant Sh;

                int     tmpIndex1, tmpIndex2, tmpIndex4, tmpCh;