直接做一个cross报表了,
//标准报表,用于Grid中的数据打印
function fnGetReport(Cross: TfrxCrossView;aGridEh:TDBGridEh):Boolean;
var
i, j: Integer;
begin
Cross.Align := baCenter;
with aGridEhdo
begin
DataSource.DataSet.First;
i := 0;
while not DataSource.DataSet.Eofdo
begin
for j := 0 to FieldCount - 1do
if Columns[j].Visible then
begin
if Columns[j].Checkboxes then
begin
if Columns[j].CheckboxState = cbchecked then
Cross.AddValue(, [Columns[j].Title.Caption],
['√'])
else
Cross.AddValue(, [Columns[j].Title.Caption],
['×'])
end
else
Cross.AddValue(, [Columns[j].Title.Caption],
[Columns[j].DisplayText]);
end;
DataSource.DataSet.Next;
Inc(i);
end;
end;
Result := True;
end;
打印前事件
procedure TfrmMdlBase.onRptBeforePrint(Sender: TfrxReportComponent);
var
Cross: TfrxCrossView;
begin
inherited;
try
if Sender is TfrxCrossView then
begin
Cross := TfrxCrossView(Sender);
fnGetReport(cross,FRptDBGridEh);
end;
except
raise;
end;
end;