示例#1
0
//-------------------------------------------------------------------------
void ReportDiplom2015::Run(int grpId, int studentId)
{
  WordMacros macros;
  macros.BeginMacros();

  ReportDiplim2015Data data = GetData(grpId, studentId);

  macros.Replace("$FIO_1$",        data.fio1);
  macros.Replace("$FIO_2$",        data.fio2);
  macros.Replace("$SPEC$",         data.spec);
  macros.Replace("$KVALIF$",       data.kvalif);
  macros.Replace("$GAK_NUM$",      data.gakNum);
  macros.Replace("$D1$",           data.kvalifDay);
  macros.Replace("$D2$",           data.kvalifMonth);
  macros.Replace("$D3$",           data.kvalifYear);
  macros.Replace("$REG_NUM$",      data.regNum);
  macros.Replace("$DIPLOM_DATE$", data.diplomDate);

  macros.EndMacros();
  macros.RunMacros(theApp.GetModuleDir() + "diplom-2015.dot");
}
示例#2
0
//---------------------------------------------------------------------------
void __fastcall TFormReportBUCityMounth::CreateWordDocument(void)
{
    InitReportQuery();

    WordMacros macros;
    macros.BeginMacros();

    if (ZMySqlQuery->RecordCount == 0)
        return;

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionFont("Size=20");
    macros.SelectionFont("Bold=true");
    macros.SelectionText("ќтчет по оплате представительств");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Size=12");
    macros.SelectionFont("Bold=false");
    TDateTime DateRep=pFormSelDate->GetSelectedDate();
    macros.SelectionText("на "+DateRep.DateString());
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.SelectionText("ќтчетный период: ");
    macros.SelectionFont("Bold=true");
    macros.SelectionText(GetPeriodStr(DateRep));
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold=false");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");

  // ‘ормирование таблицы
    AnsiString Str,Strtmp;
    int CountTables=0;
    int CountRows=ZMySqlQuery->RecordCount;

    macros.TablesAdd(CountRows+1, 3);
    CountTables++;

    macros.TablesColumns(CountTables, 1, "Width = 50");
    macros.TablesColumns(CountTables, 2, "Width = 300");
    macros.TablesColumns(CountTables, 3, "Width = 80");

    macros.TablesColumns(CountTables, 1, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.TablesColumns(CountTables, 2, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.TablesColumns(CountTables, 3, "Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
    macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

    macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Rows.Item(1).Range.Font.Bold=true");
//  WordDocument->Tables->Item(CountTables)->Range->Select();

    macros.TablesCell(CountTables, 1, 1, "Range.Text = \"єп/п\"");
    macros.TablesCell(CountTables, 1, 1, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.TablesCell(CountTables, 1, 2, "Range.Text = \"ѕредставительство\"");
    macros.TablesCell(CountTables, 1, 2, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.TablesCell(CountTables, 1, 3, "Range.Text = \"—умма (руб.)\"");
    macros.TablesCell(CountTables, 1, 3, "Range.Select");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");

    AnsiString SummStr;
    unsigned short year,month,day;
    DateRep.DecodeDate(&year,&month,&day);
    long commsumm=0;
    for (int i=0;i<ZMySqlQuery->RecordCount;i++)
    {
        ZMySqlQuery->RecNo=i+1;

        macros.TablesCell(CountTables, i+2, 1, "Range.Text = \"" + AnsiString(i+1) + "\"");
        macros.TablesCell(CountTables, i+2, 2, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(1)->AsString);
        SummStr=GetSummCity(ZMySqlQuery->Fields->FieldByNumber(2)->AsString,AnsiString(month),AnsiString(year) + "\"");
        macros.TablesCell(CountTables, i+2, 3, "Range.Text = \"" + SummStr + "\"");
        commsumm+=SummStr.ToInt();
    }

    macros.TablesCell(CountTables, CountRows+1, 1, "Range.Select");
    macros.InsertLine("Selection.MoveDown Unit := wdLine");
    macros.SelectionTypeParagraph();
    macros.SelectionText("»того: обща¤ сумма зафиксированных выплат со стороны всех представительств составл¤ет "+AnsiString(commsumm)+" рублей.");

    macros.EndMacros();
    macros.RunMacros();
}
示例#3
0
//-------------------------------------------------------------------------
void ReportDiplom::Run(int grpId, int studentId)
{
  r::PrivateData privData;
  r::GetPrivateData(privData, studentId);
  DirectData dirData;
  GetDirectData(dirData, privData);
  std::vector<Discip> cursDiscip;
  std::vector<Discip> commonDiscip;
  std::vector<Discip> specDiscip;
  bool useZe = privData.specOrProfilTag.startsWith("бак") || privData.specOrProfilTag == "маг";    // так же для расчета объема программы
  bool anotherEnd = privData.specOrProfilTag.empty() || privData.specOrProfilTag == "бак1";
  GetDiscipInfo(studentId, cursDiscip, commonDiscip, specDiscip, privData.lang, privData.vkrTitle, useZe, anotherEnd);

  WordMacros macros;
  macros.BeginMacros();

  // ФИО
  macros.Cell(1, 3, 7, "Range.Select");
  macros.SelectionText(privData.secondName);
  macros.Cell(1, 4, 7, "Range.Select");
  macros.SelectionText(privData.firstName);
  macros.Cell(1, 5, 7, "Range.Select");
  macros.SelectionText(privData.thirdName);

  // дата рождения
  macros.Cell(1, 6, 8, "Range.Select");
  macros.SelectionText(r::to_str_date(privData.bornDate, "года"));

  // аттестат
  macros.Cell(1, 8, 6, "Range.Select");
  macros.SelectionText(privData.prevDoc.toUpperFirst() + " " + privData.prevDocYear + " год");

  // номер регистрации
  macros.Cell(1, 13, 5, "Range.Select");
  macros.SelectionText(privData.regNum);

  // дата выдачи
  macros.Cell(1, 15, 7, "Range.Select");
  macros.SelectionText(r::to_str_date(privData.dataVidachi, "года"));  

  // специалиста (специалиста с отличием, бакалавра, бакалавра с отличием)
  macros.Cell(1, 9, 4, "Range.Select");
  macros.SelectionText(dirData.title1);

  // по специальности, по направлению
  macros.Cell(1, 11, 9, "Range.Select");
  macros.SelectionText(dirData.title2);

  // сколько обучался
  macros.Cell(1, 15, 9, "Range.Select");
  macros.SelectionText(dirData.title3);

  // дополнительная информация
  macros.Cell(1, 12, 3, "Range.Select");
  macros.SelectionText(dirData.bottomInfo);

  // курсовые работы
  for (int i = 0; i < (int)cursDiscip.size(); ++i)
  {
     macros.CellCell(1, 3, 2, i + 1, 1, "Select");
     macros.SelectionText(toQuate(cursDiscip[i].title));
     macros.CellCell(1, 3, 2, i + 1, 2, "Select");
     macros.SelectionText(cursDiscip[i].ocenka);
  }
  
  struct local
  {
    static void table_text(WordMacros& macros, bool secondTable, int row, int col, string_t text) { 
      if (secondTable)
        macros.CellCell(2, 2, 7, row, col, "Select");
      else
        macros.CellCell(2, 3, 2, row, col, "Select");
      macros.SelectionText(text); 
    }
  };

  // обычные дисциплины на первой таблице
  int table1RowCount = 56;  // всего осталось строк в первой таблице
  int usedDiscip = 0;       // сколько на самом деле добавили дисциплин в первую таблицу
  for (int i = 0; i < (int)commonDiscip.size() && table1RowCount > 0; ++i)
  {
    table1RowCount -= PrepareDiscipTitle(commonDiscip[i].title, 63);
    if (table1RowCount < 0) // если строка не уберется в конце таблицы, то сразу нечего продолжать
      break;

    usedDiscip++;
    local::table_text(macros, false, i+1, 1, toQuate(commonDiscip[i].title));
    local::table_text(macros, false, i+1, 2, commonDiscip[i].period);
    local::table_text(macros, false, i+1, 3, commonDiscip[i].ocenka);
  }
  
  int table2CurRow = 1;
  bool need_second_table = usedDiscip < (int)commonDiscip.size();
  // обычные дисциплины во второй таблице если не хватило места на первой
  if (need_second_table)
    for (int i = usedDiscip; i < (int)commonDiscip.size(); ++i)
    {
      local::table_text(macros, true, table2CurRow, 1, toQuate(commonDiscip[i].title));
      local::table_text(macros, true, table2CurRow, 2, commonDiscip[i].period);
      local::table_text(macros, true, table2CurRow, 3, commonDiscip[i].ocenka);
      ++table2CurRow;
    }
  
  // остальные данные могут или убраться на первой таблице или надо перенести на вторую
  if (!need_second_table)
    if (table1RowCount <= (int)specDiscip.size())
      need_second_table = true;

  int rowPos = need_second_table ? table2CurRow : usedDiscip + 1;
  for (int i = 0; i < (int)specDiscip.size(); ++i)
  {
    local::table_text(macros, need_second_table, rowPos+i, 1, toQuate(specDiscip[i].title));
    local::table_text(macros, need_second_table, rowPos+i, 2, specDiscip[i].period);
    local::table_text(macros, need_second_table, rowPos+i, 3, specDiscip[i].ocenka);
  }

  macros.EndMacros();
  macros.RunMacros(theApp.GetModuleDir() + "diplom-2014.dot");
}
示例#4
0
//---------------------------------------------------------------------------
void __fastcall TFormReportStudsCandRedDiplom::CreateWordDocument(void)
{
    InitReportQuery();

    if (ZMySqlQuery->RecordCount==0)
        return;

    WordMacros macros;
    macros.BeginMacros();

    macros.InsertLine("ActiveDocument.PageSetup.TopMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.BottomMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.LeftMargin=35");
    macros.InsertLine("ActiveDocument.PageSetup.RightMargin=35");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionFont("Bold=true");
    macros.SelectionFont("Size=16");
    macros.SelectionText("Список кандидатов на получение красного диплома");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Size=12");
    macros.SelectionFont("Bold=false");
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");

    int CountTables=0;
    int CountRows;
    for (int i=0; i<ZMySqlQuery->RecordCount; i++)
    {
        ZMySqlQuery->RecNo=i+1;
        int numgroup=ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt();

        // подготавливает запрос на список студенов
        //InitStudentsForGroup(numgroup);
        // получает список студентов на красный диплом
        //CountUsefullStuds=GetCountUsefullStudents(listNumUsefullStuds);
        //if (CountUsefullStuds==0)  continue;
        std::vector<red_student> redStudents = GetRedStudents(numgroup);
        if (redStudents.empty())
            continue;
        int CountUsefullStuds = redStudents.size();

        macros.SelectionTypeParagraph();
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
        macros.SelectionText("Группа ");
        macros.SelectionFont("Bold=true");
        macros.SelectionText(WCGetTitleForKeyNum(GROUPS,numgroup));
        macros.SelectionFont("Bold=false");
        macros.SelectionTypeParagraph();

        CountRows=CountUsefullStuds+1;
        macros.TablesAdd(CountRows,7);
        CountTables++;

        macros.TablesColumns(CountTables, 1, "Width = 20");
        macros.TablesColumns(CountTables, 2, "Width = 180");
        macros.TablesColumns(CountTables, 3, "Width = 60");
        macros.TablesColumns(CountTables, 4, "Width = 70");
        macros.TablesColumns(CountTables, 5, "Width = 70");
        macros.TablesColumns(CountTables, 6, "Width = 70");
        macros.TablesColumns(CountTables, 7, "Width = 50");

        macros.TablesColumns(CountTables, 1, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
        macros.TablesColumns(CountTables, 2, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
        macros.TablesColumns(CountTables, 3, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 4, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 5, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 6, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesColumns(CountTables, 7, "Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.SelectionFont("Bold=true");
        macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

        macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Rows.Item(1).Range.Font.Bold=true");
//    WordDocument->Tables->Item(CountTables)->Range->Select();

        macros.TablesCell(CountTables, 1, 1, "Range.Text = \"№\"");
        macros.TablesCell(CountTables, 1, 1, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 2, "Range.Text = \"Фамилия, имя, отчество\"");
        macros.TablesCell(CountTables, 1, 2, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 3, "Range.Text = \"№ зач. книжки\"");
        macros.TablesCell(CountTables, 1, 3, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 4, "Range.Text = \"Кол-во \"\"удовл.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 4, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 5, "Range.Text = \"Кол-во \"\"хор.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 5, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 6, "Range.Text = \"Кол-во \"\"отл.\"\" (%)\"");
        macros.TablesCell(CountTables, 1, 6, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
        macros.TablesCell(CountTables, 1, 7, "Range.Text = \"Средний балл\"");
        macros.TablesCell(CountTables, 1, 7, "Range.Select");
        macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");

        // проходим по списку на красный диплом
        for (int j = 0; j < redStudents.size(); ++j)
        {
            red_student& redStudent = redStudents[j];
            // номер позиции
            macros.TablesCell(CountTables, j+2,1, "Range.Text= \"" + AnsiString(j+1) + "\"");
            // фио
            macros.TablesCell(CountTables, j+2,2, "Range.Text= \"" + redStudent.name + "\"");
            // номер зачетки
            macros.TablesCell(CountTables, j+2,3, "Range.Text= \"" + redStudent.znum + "\"");

            // вычисляет баллы для студента
            //int countUDOVL,countHOR,countOTL;
            //double percUDOVL,percHOR,percOTL;
            //AnsiString AvrgBallStr;
            //GetBallsCount(countUDOVL,percUDOVL,countHOR,percHOR,countOTL,percOTL,AvrgBallStr,ZMySqlQueryStudsOfGrp->Fields->FieldByNumber(1)->AsString);

            AnsiString percUDOVLStr = AnsiString(redStudent.perc_ud);
            AnsiString percHORStr   = AnsiString(redStudent.perc_hor);
            AnsiString percOTLStr   = AnsiString(redStudent.perc_otl);
            char str[10];
            sprintf(str,"%4.2lf",percUDOVLStr.ToDouble());
            percUDOVLStr = AnsiString(str);
            sprintf(str,"%4.2lf",percHORStr.ToDouble());
            percHORStr = AnsiString(str);
            sprintf(str,"%4.2lf",percOTLStr.ToDouble());
            percOTLStr = AnsiString(str);

            AnsiString Str=AnsiString(redStudent.count_ud)+" ("+percUDOVLStr+"%)";
            macros.TablesCell(CountTables, j+2,4, "Range.Text= \"" + Str + "\"");
            Str=AnsiString(redStudent.count_hor)+" ("+percHORStr+"%)";
            macros.TablesCell(CountTables, j+2,5, "Range.Text= \"" + Str+ "\"");
            Str=AnsiString(redStudent.count_otl)+" ("+percOTLStr+"%)";
            macros.TablesCell(CountTables, j+2,6, "Range.Text= \"" + Str+ "\"");
            macros.TablesCell(CountTables, j+2,7, "Range.Text= \"" + redStudent.avrBall + "\"");
        }

        macros.TablesCell(CountTables, CountRows+1, 1, "Range.Select");
        macros.InsertLine("Selection.MoveDown Unit := wdLine");
    }
    //delete listNumUsefullStuds;

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
    macros.SelectionFont("Size=8");
    macros.SelectionText("(*)В таблицах не учитываются оценки \"\"зачтено\\"", \"\"незачтено\"\" и \"\"неудовлетворительно\"\".");
    macros.SelectionTypeParagraph();
    macros.SelectionText("(*)Таблицы содержат студентов, имеющих не более одной \"\"удовл\"\" и не менее 75% \"\"отл\"\".");

    macros.EndMacros();
    macros.RunMacros();
}
示例#5
0
//---------------------------------------------------------------------------
void __fastcall TFormReportDocZachislenie::CreateWordDocument(void)
{
    int numspec,numform;

    InitReportQuery();

    WordMacros macros;
    macros.BeginMacros();

    macros.InsertLine("Selection.SetRange Start:=0, End:=0");

    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphJustify");
    macros.SelectionFont("Bold = true");
    macros.SelectionText("Слушали: ");
    macros.SelectionFont("Bold = false");
    macros.SelectionText("о зачислении студентами и слушателями ННГАСУ на места с оплатой стоимости обучения на договорной основе.");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = true");
    macros.SelectionText("Постановили: ");
    macros.SelectionFont("Bold = false");
    macros.SelectionText("зачислить студентами и слушателями ННГАСУ на места с оплатой стоимости обучения на договорной основе.");
    macros.SelectionTypeParagraph();
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = false");
    macros.SelectionText("Зачислить студентами 1-го курса с 01 сентября 20__ года на места с оплатой стоимости обучения на договорной основе следующих абитуриентов:");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = true");
    macros.SelectionText(" в институт экономики, управления и права");
    macros.SelectionTypeParagraph();
    macros.SelectionFont("Bold = false");

    if (ZMySqlQuery->RecordCount==0)
        return;

    numspec=-1;
    numform=-1;
    int CountTables=0;
    int CountRows;
    int CountPrevRows=0;
    int CountPrevPrevRows=0;
    AnsiString Str,Strtmp;
    for (int i = 0; i < ZMySqlQuery->RecordCount; i++)
    {
        ZMySqlQuery->RecNo = i+1;
        if ( numspec!=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt() ||
                numform!=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt() )
        {
            numspec=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt();
            numform=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt();
            macros.SelectionTypeParagraph();
            macros.SelectionTypeParagraph();
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphCenter");
            macros.SelectionText("на 1 курс по специальности \"");
            macros.SelectionFont("Bold = true");
            macros.SelectionText(WCGetTitleForKeyNum(SPECS,numspec));
            macros.SelectionText("\"");
            macros.SelectionFont("Bold = false");
            macros.SelectionText(", с формой обучения - ");
            macros.SelectionText(WCGetTitleForKeyNum(EDUFORMS,numform));
            macros.SelectionTypeParagraph();
            macros.SelectionTypeParagraph();
            CountRows=0;
            for (int j=i;j<ZMySqlQuery->RecordCount;j++)
            {
                ZMySqlQuery->RecNo=j+1;
                if (numspec!=ZMySqlQuery->Fields->FieldByNumber(4)->AsString.ToInt() ||
                    numform!=ZMySqlQuery->Fields->FieldByNumber(5)->AsString.ToInt()) break;
                CountRows++;
            }
            ZMySqlQuery->RecNo=i+1;
            macros.TablesAdd(CountRows, 6);
            macros.TableStyle(WordMacros::StyleNone);
            CountTables++;

            macros.TablesColumns(CountTables, 1, "Width = 30");
            macros.TablesColumns(CountTables, 2, "Width = 90");
            macros.TablesColumns(CountTables, 3, "Width = 80");
            macros.TablesColumns(CountTables, 4, "Width = 90");
            macros.TablesColumns(CountTables, 5, "Width = 100");
            macros.TablesColumns(CountTables, 6, "Width = 50");

            macros.TablesColumns(CountTables, 1, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
            macros.TablesColumns(CountTables, 2, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 3, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 4, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.TablesColumns(CountTables, 5, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphRight");
            macros.TablesColumns(CountTables, 6, "Select");
            macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
            macros.InsertLine("ActiveDocument.Tables.Item(" + IntToStr(CountTables) + ").Range.Font.Size = 10");

            CountPrevPrevRows=CountPrevRows;
            CountPrevRows+=CountRows;
        }
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 1, "Range.Text = \"" + AnsiString(i+1-CountPrevPrevRows) + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 2, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(1)->AsString + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 3, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(2)->AsString + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 4, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(3)->AsString + "\"");

        Str=WCGetTitleForKeyNum(DOGSHIFRS,ZMySqlQuery->Fields->FieldByNumber(6)->AsString.ToInt())+"-";
        Str+=WCGetTitleForKeyNum(DOGYEARS,ZMySqlQuery->Fields->FieldByNumber(8)->AsString.ToInt());
        Strtmp=WCGetTitleForKeyNum(DOGFASTS,ZMySqlQuery->Fields->FieldByNumber(9)->AsString.ToInt());
        if (!Strtmp.IsEmpty())
            Str+="-"+Strtmp;
        Str+=" -";
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 5, "Range.Text = \"" + Str + "\"");
        macros.TablesCell(CountTables, i+1-CountPrevPrevRows, 6, "Range.Text = \"" + ZMySqlQuery->Fields->FieldByNumber(7)->AsString + "\"");
        if (i+1 == CountPrevRows)
        {
           macros.TablesCell(CountTables, CountRows, 1, "Range.Select");
           macros.InsertLine("Selection.MoveDown Unit := wdLine, Count := 2");
        }
    }
    macros.SelectionParagraphFormat("Alignment = wdAlignParagraphLeft");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionText("Председатель приемной комиссии");
    macros.SelectionTypeParagraph();
    macros.SelectionText("ректор, академик                                                                       Е.В. Копосов");
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionTypeParagraph();
    macros.SelectionText("Ответственный секретарь");
    macros.SelectionTypeParagraph();
    macros.SelectionText("приемной комиссии, доцент                                                   Н.Д. Жилина");
    macros.InsertLine("ActiveWindow.ActivePane.VerticalPercentScrolled = 0");
    
    macros.EndMacros();
    macros.RunMacros();

}