不需要。给你一段程序,如何做。
//定义报表名称
QR_Head.Caption :=frm_find.rp_head.Caption;
//明细行的起始位置
Left := 0;
//对DBGRID表所有字段循环
for I := 0 to frm_result.gust_DBG.Columns.Count -1 do
begin
if frm_result.gust_DBG.Columns.Visible then
begin
//明细表栏目名称赋值(Column header)
DB_Column := TQRLabel.Create(self);
DB_Column.Frame.DrawTop := true;
DB_Column.Frame.DrawBottom := True;
DB_Column.Frame.DrawLeft := True;
DB_Column.Frame.DrawRight := True;
DB_Column.Alignment := taCenter;
DB_Column.top := 2;
DB_Column.Left := Left;
DB_Column.Height := QR_Column.Height;
DB_Column.AutoSize := False;
DB_Column.Font := frm_result.gust_DBG.Columns.Font;
DB_Column.Width := frm_result.gust_DBG.Columns.Width;
DB_Column.Caption := frm_result.gust_DBG.Columns.Title.Caption;
DB_Column.Parent := QR_Column;
//明细表数据部分赋值(Detail)
DB_Data := TQRDBText.Create(self);
DB_Data.Frame.DrawTop := True;
DB_Data.Frame.DrawBottom := true;
DB_Data.Frame.DrawLeft := true;
DB_Data.Frame.DrawRight := true;
DB_Data.Alignment := taCenter;
DB_Data.Left := Left;
DB_Data.Height := QR_Data.Height;
DB_Data.AutoSize := False;
DB_Data.Font := frm_result.gust_DBG.Columns.Font;
DB_Data.Width := frm_result.gust_DBG.Columns.Width;
DB_Data.DataSet := frm_result.gust_DBG.DataSource.DataSet;
DB_Data.DataField := frm_result.gust_DBG.Columns.FieldName;
DB_Data.Parent := QR_Data;
Left := Left + DB_Column.Width;
end;
end;
//以上完成REPORT布局,调用REPORT 输出报表
Report.Preview;