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

                char    Str1;

                AnsiString s1;

                Variant range1;

                int Index1=0,Index2=0;

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

                {

                        Table1->RecNo = i;

                        TCommand *tmpRec = new TCommand;

                        tmpRec->ID = Table1ID->AsInteger;

                        tmpRec->Name = Table1Name->AsString;

                        if(Table1Name->AsString.AnsiPos("Сборная") == 0)

                        {

                                Index1+=1;

                                tmpRec->Ind1 = Index1+1;

                                Commands->Add(tmpRec);

                        }

                        else

                        {

                                Index2+=1;

                                tmpRec->Ind1 = Index2+1;

                                Modulars->Add(tmpRec);

                        }

                }

                SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), 1, 2, "Сводная таблица игр клубов");

                Str1 = 'A'+Commands->Count+1;

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

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

                range1.OlePropertySet("MergeCells",1);

 char    tmpStr = 'A'+Commands->Count+1;

                AnsiString s = "B2:"+ AnsiString(tmpStr) +IntToStr(Commands->Count+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=0;i<Commands->Count;i++)

                {

                        SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), i+3, 2, ((TCommand*)Commands->Items[i])->Name);

                        SetCellValue(ExcelApplication.OlePropertyGet("WorkSheets",1), 2, i+3, ((TCommand*)Commands->Items[i])->Name);

                }

                ExcelApplication.OlePropertySet("Visible",true);

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

                {

                        Table3->RecNo = i;

                        int     tmpC1, tmpC2;

                        int     indC1, indC2;

                        AnsiString      Str;

                        int    Flag1 = 0, Flag2 = 0;

                        tmpC1 = Table3IDTeam1->AsInteger;

                        tmpC2 = Table3IDTeam2->AsInteger;

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

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

                        {

                                Flag1 = 0;

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

                                {

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

                                        Flag1 = 1;

                                        break;

                                }

                        }

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

                        {

                                Flag2 = 0;

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

                                {

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

                                        Flag2 = 1;

                                        break;

                                }