void __fastcall TForm1::Button1Click(TObject *Sender){ frReport1->LoadFromFile("A4.frf"); frReport1->Title = "Привет"; frReport1->Pages->Clear(); frReport1->Pages->Add(); TfrPage *Page = new TfrPage(0,0,0,0,poPortrait); Page = frReport1->Pages->Pages[frReport1->Pages->Count - 1]; //создаём страницу TfrBandView *Band = new TfrBandView(); // создаём TitleBand Band->SetBounds(0,20,0,200); Band->BandType = btReportTitle; Page->Objects->Add(Band); int b = 0; TfrMemoView *Memo; for (int i=0;i5;i++) { Memo = new TfrMemoView();// создаём Memo Memo->Name = "Memo"+AnsiString(i); b+=20; Memo->SetBounds(20,b,76,22); Memo->BandAlign = baCenter; Memo->Alignment = frtaCenter; Memo->Prop["Font.Style"] = 2; Memo->Font->Size = 12; Memo->FillColor = clSilver; Memo->FrameColor = clBlack; Memo->FrameStyle = psSolid; Memo->FrameTyp = 15; Memo->FrameWidth = 2; Memo->Memo->Add("Здарова"); Page->Objects->Add(Memo); } delete Band; Band = NULL; delete Page; Page = NULL; delete Memo; Memo = NULL; frReport1->PrepareReport(); frReport1->ShowPreparedReport();
TfrPage *Page = NULL;Page = frReport1->Pages->Pages[frReport1->Pages->Count - 1]; // дальше можно проверять Page на "не NULL"
frReport1->LoadFromFile("A4.frf"); frReport1->Title = "Привет"; frReport1->Pages->Clear(); frReport1->Pages->Add(); TfrPage *Page = NULL; Page = frReport1->Pages->Pages[frReport1->Pages->Count - 1]; TfrBandView *Band = new TfrBandView(); Band->SetBounds(0,20,0,200); Band->BandType = btReportTitle; Page->Objects->Add(Band); int b = 0; for (int i=0;i5;i++) { TfrMemoView *Memo = new TfrMemoView(); Memo->Name = "Memo"+AnsiString(i); b+=20; Memo->SetBounds(20,b,76,22); Memo->BandAlign = baCenter; Memo->Alignment = frtaCenter; Memo->Prop["Font.Style"] = 2; Memo->Font->Size = 12; Memo->FillColor = clSilver; Memo->FrameColor = clBlack; Memo->FrameStyle = psSolid; Memo->FrameTyp = 15; Memo->FrameWidth = 2; Memo->Memo->Add("Здарова"); Page->Objects->Add(Memo); delete Memo; Memo = NULL; } if (Page !=NULL) { delete Page; Page = NULL; } if(frReport1->PrepareReport()) { frReport1->ShowPreparedReport(); }