如何在Delphi中将列表视图项添加到数据集中?

问题描述:

我正在开发发票系统

在我的应用程序中,有一个列表视图,一个快速报告按钮。.
当按下报告应显示的​​按钮时报告
中的所有项目,谁能为此提供最佳解决方案?

in my application there is a listview, a fastreport, button.. when press the the button the report should show the all item in the report can anyone provide best solution for this?

来自FastReport的Demos文件夹中的示例PrintStringList :

From example PrintStringList from FastReport's Demos folder:

var
  Button1: TButton;
  StringDS: TfrxUserDataSet;
  frxReport1: TfrxReport;
  StringList: TStringList;

procedure TForm1.Button1Click(Sender: TObject);
begin
  StringDS.RangeEnd := reCount;
  StringDS.RangeEndCount := StringList.Count;
  frxReport1.ShowReport;
end;

procedure TForm1.frxReport1GetValue(const VarName: String; var Value: Variant);
begin
  if AnsiCompareText(VarName, 'element') = 0 then
    Value := StringList[StringDS.RecNo];
end;