我在Windows7上使用Delphi7和QuickReports。通常QuickReports需要一个由查询生成的DataSet,但我想从StringGrid的内容生成一个报告,就好像StringGrid是查询结果的表示一样。
多么?
发布于 2010-07-15 01:44:44
使用QuickReport.OnNeedData事件处理程序。它传递一个名为MoreData (布尔值)的var参数;将其设置为True意味着它将再次被调用。将QuickReport.DataSource属性保留为空,并使用纯TQRText控件而不是TQRDBText。
// CurrLine is an Integer. In your case, it can represent a row in the StringGrid.
procedure TPrintLogForm.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
MoreData := (CurrLine < StringGrid1.RowCount);
if MoreData then
begin
qrTextLine.Caption := StringGrid1.Cells[0, CurrLine];
qrTextData.Caption := StringGrid1.Cells[1, CurrLine];
Inc(CurrLine);
end;
end;https://stackoverflow.com/questions/3244249
复制相似问题