就29分了,全给了!这个问题解决不了我真的死定了!帮帮忙吧~~~~555~~~ (29分)

B

bigsun

Unregistered / Unconfirmed
GUEST, unregistred user!
以下程序折行时出现错误,例如想显示:1234567890as [:(][:(][:(][:(][:(][:(][:(]
预期效果:
123456
7890as
实际效果:
123456
12345
6789as
6789a
s

代码:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  FR_Class, FR_DSet, StdCtrls, Grids;
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Dataset: TfrUserDataset;
    frReport1: TfrReport;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure frReport1GetValue(const ParName: string;
      var ParValue: Variant);
    procedure Button1Click(Sender: TObject);
    procedure DatasetCheckEOF(Sender: TObject;
var Eof: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
implementation
{$R *.DFM}
[:(]procedure TForm1.Button1Click(Sender: TObject);
begin
  frReport1.ShowReport;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i, j: Integer;
begin
  for i := 0 to StringGrid1.ColCount - 1do
    for j := 0 to StringGrid1.RowCount - 1do
      StringGrid1.Cells[i, j] :='ABCDEFGHIJKLMNOPQRSTUVWXYZ' + IntToStr(j * StringGrid1.ColCount + i + 1);
end;
procedure TForm1.frReport1GetValue(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;

end.
 
我运行的结果是
表格中是顺序的数字
1 2 3 4 5
6 7 8 9 10
11 12 13。。。
你的意思我不明白
 
不好意思,刚才代码没有贴完,请再看.....
 
报表呢?
 
在一个form上放四个控件就可以了一个frreport1 一个button 一个fruserdataset 一个stringgrid
 
接受答案了.
 
顶部