//控制页边距
  frReport1.Pages.Clear;
  frReport1.Pages.Add;              // create page
  Page := frReport1.Pages[0];
  Page.pgMargins.Left  := strtoint(Edit4.Text);//此句在预浏中,体现不出来,为什么?
  Page.pgMargins.Right := strtoint(Edit5.Text);//此句在预浏中,体现不出来,为什么?
  Page.pgMargins.Top := strtoint(Edit2.Text);
  Page.pgMargins.Bottom := strtoint(Edit3.Text);
//报表标题
  b := TfrBandView.Create;             // create Title band
  b.SetBounds(0, 20, 0, 20);           // position and size in pixels
  b.BandType := btReportTitle;         // (only Top and Height are significant
  Page.Objects.Add(b);             //  for the band)
  v := TfrMemoView.Create;             // create memo
  v.SetBounds(20, 20, 200, 16);
  v.BandAlign := baWidth;
  v.Prop['Alignment'] := frtaCenter;   // another way to access properties
  v.Prop['Font.Style'] := 2;
  v.Memo.Add(MyVar + '仓库库存数量');
  Page.Objects.Add(v);//报表字段名
{
  b := TfrBandView.Create;
  b.SetBounds(0,40,0,20);
  b.BandType := btPageHeader;
  // b.BandType := btReportTitle;
  Page.Objects.Add(b);
for i:=0 to ListBox6.Items.Count-1 do
begin
  v := TfrMemoView.Create;
  s := TfrShapeView.Create;
  v.SetBounds(20+(100*i),40,100,16);
  s.SetBounds(20+(100*i),40,100,20);
  v.Prop['Font.Style'] := 2;
  //Showmessage(Listbox6.Items.GetText[i]);
  v.Memo.Add(Listbox6.Items[i]);
  Page.Objects.Add(s);
  Page.Objects.Add(v);
end;
}
//报表数据
  b := TfrBandView.Create;             // create MasterData band
  b.SetBounds(0, 60, 0, 20);
  b.BandType := btMasterData;
  b.Dataset := 'frDBDataSet1';         // band's dataset
  Page.Objects.Add(b);
//字段一
for i:=0 to ListBox6.Items.Count-1 do
begin
  FieldName :=Listbox6.Items[i];
  if FieldName = '库存数量' then
    FieldName := 'SumTotal';
  v := TfrMemoView.Create;       // create data field
  s := TfrShapeView.Create;
  v.SetBounds(20+(100*i), 60, 100, 16);
  s.SetBounds(20+(100*i),60,100,20);
  v.Memo.Add('[ADODataSet1'+'."'+FieldName+'"'+']');
  //v.Memo.Add('[ADODataSet1."货号"]');
 // v.Memo.Add('[i]');
  Page.Objects.Add(s);
  Page.Objects.Add(v);
end;
//预浏报表
  frReport1.ShowReport;
以上报表程序如果屏蔽了从<//报表字段名>到<报表数据>这段程序,
预浏时就可以根据frDBDataSet1得到多条数据,
而如果加了上了从<//报表字段名>到<报表数据>这段程序,
这数据就只出现一条啊!
为什么,请教高手?

解决方案 »

  1.   

    兄弟们帮我顶一下吧,
    ding者有分.
      

  2.   

    frreport1.PrepareReport;
    frreport1.ShowPreparedReport;试试
      

  3.   

    我也在FastReport的RunTime示例中试图加一个btPageHeader型的band显示一个表头,结果
    预览时也只能显示一行,请兄弟们再指点指点,你们也试试会不会出现这样情况!!!!
      

  4.   

    测试了一下,代码没有问题,你将各个BAND的距离拉开一些即可。
      

  5.   

    b.SetBounds(0,60,0,20);
      b.BandType := btPageHeader;
     b := TfrBandView.Create;             // create MasterData band
      b.SetBounds(0, 100, 0, 20);
      b.BandType := btMasterData;
    在D6+FR2.51下调试通过
      

  6.   

    正如WWWWA(aaaa) 所说,问题解决。