如何用fastreport打印stringgrid中的数据?
解决方案 »
- 求《Delphi+SQL Server数据库应用实例完全解析》电子书!!!谢谢帮忙!!!
- 关于注册协议的问题
- 用getFormImage 截取当前窗口屏幕 发现ComboBox1中的值为空值了
- 线程释放问题?急啊!!!
- Delphi 2005真实展现
- 用过tms grid的同志们请进,如何垂直居中?
- 如何删除DBGRID中的当前记录(用ADO连接的),请给代码示例,谢谢
- 快过年了,郁闷中,散分……
- 如何更新paradox里面的数据
- 转贴 一个美国人翻译的三字经
- 急!!!如何在PageControl页面中动态创建Frame实例,并且获取该Frame里面的控件(如DbGrid)属性
- 我们有没有可能直接看懂2进制码?
begin
frUserDataset1.RangeEndCount := dbgrid1.FieldCount;
frUserDataset2.RangeEndCount := dbgrid1.FieldCount;
frReport1.ShowReport;
end;procedure TqueryForm.frReport1GetValue(const ParName: String;
var ParValue: Variant);
begin
if ParName = 'Cell' then
ParValue := dbgrid1.Fields[frUserDataset1.RecNo].Value;
if ParName = 'Header' then
ParValue := dbgrid1.Fields[frUserDataset2.RecNo].FieldName;
end;
begin
ColDataset.RangeEnd := reCount;
ColDataset.RangeEndCount := StringGrid1.ColCount;
RowDataset.RangeEnd := reCount;
RowDataset.RangeEndCount := StringGrid1.RowCount;
frReport1.ShowReport;
end;procedure TForm1.FormCreate(Sender: TObject);
var
i, j: Integer;
begin
for i := 0 to StringGrid1.ColCount - 1 do
for j := 0 to StringGrid1.RowCount - 1 do
StringGrid1.Cells[i, j] := IntToStr(j * StringGrid1.ColCount + i + 1);
end;procedure TForm1.frReport1GetValue(const ParName: string;
var ParValue: Variant);
begin
if AnsiCompareText(ParName, 'Cell') = 0 then
ParValue := StringGrid1.Cells[ColDataset.RecNo, RowDataset.RecNo];
end;procedure TForm1.frReport2GetValue(const ParName: string;
var ParValue: Variant);
begin
if AnsiCompareText(ParName, 'Cell1') = 0 then
ParValue := StringGrid1.Cells[0, RowDataset.RecNo]
else if AnsiCompareText(ParName, 'Cell2') = 0 then
ParValue := StringGrid1.Cells[1, RowDataset.RecNo]
else if AnsiCompareText(ParName, 'Cell3') = 0 then
ParValue := StringGrid1.Cells[2, RowDataset.RecNo]
else if AnsiCompareText(ParName, 'Cell4') = 0 then
ParValue := StringGrid1.Cells[3, RowDataset.RecNo]
else if AnsiCompareText(ParName, 'Cell5') = 0 then
ParValue := StringGrid1.Cells[4, RowDataset.RecNo]
end;procedure TForm1.frReport3GetValue(const ParName: string;
var ParValue: Variant);
begin
if AnsiCompareText(ParName, 'Cell1') = 0 then
ParValue := StringGrid1.Cells[0, Dataset.RecNo]
else if AnsiCompareText(ParName, 'Cell2') = 0 then
ParValue := StringGrid1.Cells[1, Dataset.RecNo]
else if AnsiCompareText(ParName, 'Cell3') = 0 then
ParValue := StringGrid1.Cells[2, Dataset.RecNo]
else if AnsiCompareText(ParName, 'Cell4') = 0 then
ParValue := StringGrid1.Cells[3, Dataset.RecNo]
else if AnsiCompareText(ParName, 'Cell5') = 0 then
ParValue := StringGrid1.Cells[4, Dataset.RecNo]
end;procedure TForm1.DatasetCheckEOF(Sender: TObject; var Eof: Boolean);
begin
Eof := Dataset.RecNo >= StringGrid1.RowCount;
end;