CallPreview过程: procedure DataForm.CallPreview(dbgrid: TDBGrid; Dataset: TDataset); begin with qrForm do begin TitleBand1.Height :=60; Cheader:= TQRLabel.Create(qrForm); ////在TitleBand1中写大标题 Cheader.Parent := TitleBand1; with Cheader do begin AlignMent:= TaCenter; Caption := '这是标题'; Width := TitleBand1.width; Height := TitleBand1.height-10; Left := 0; Top := -10; Font.Name := TitleFont; Font.Size := TitleSize; end;//with Cheader end; // with Rep_xsxx
// 画线 with qrForm do begin ColumnHeaderBand1.Height := DBGridHeight; QRShapec:= TQRShape.Create(qrForm); //在Columnheader中建立上框线 QRshapec.Parent := ColumnHeaderBand1; with QRShapec do begin Shape := QRShorLine; Pen.Width := DBGridwLine; Top := 0; Width := ColumnHeaderBand1.Width; Height := 1; Left := 0; end;//with QRshapec do end;//with qrForm
// 标题 with DBGrid do for i := 0 to Columns.Count - 1 do begin with qrForm do begin Cheader:= TQRLabel.Create(qrForm); Cheader.Parent := ColumnHeaderBand1; with Cheader do begin Alignment := Tacenter; Caption := Columns[i].Title.Caption;//fieldname; Width := Columns[i].Width; Height := ColumnHeaderBand1.Height-10; Left := 100; Top := 7; Font.Name := ColumHeaderFont; Font.Size := DetailBandSize; end; end; end; ......... ........ try qrForm.QuickRep1.Preview//报表预览 finally qrForm.Hide; qrForm.Free; end;