我的一个个程序有很多stringgrid表格..并且每个表格所显示的数据都不同,我想做一个打印程序来跟据不同的调用打印不同表格的内容!我才刚开始用fastreport,请大家指条路,能给出例子更好!(不好意思我没分了)

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender:TObject);begin
    if PrintDialog1.Execute then
      begin
        with Printer do
        begin
          BeginDoc;
          StringGrid1.PaintTo(Handle, 10, 10);
          EndDoc;
        end;
      end;end;
      

  2.   

    楼上所言,是不能由用户来设置列宽,要打印的列的..............
    我不想直接打印..我想通过fastreprot来预览后再打印//
      

  3.   

    procedure Tfrm_query_all_dujin.frBeforePrint(Sender: TfrxReportComponent);
    var
     Cross:TfrxCrossView;
     i,j:integer;
    begin
     if Sender is  TfrxCrossView then
      begin
        Cross:=tfrxcrossView(Sender);
        for i:=1 to stringgrid1.RowCount do
         for j:=1 to stringgrid1.ColCount do
          begin
            if stringgrid1.Cells[1,i-1]<>'' then
             begin
              if i=1 then
               begin
                cross.Font.Size:=18;
                cross.AddValue([i],[j],[Stringgrid1.cells[j-1,i-1]]);
               end
              else
               begin
                cross.Font.Size:=10;
                cross.AddValue([i],[j],[Stringgrid1.cells[j-1,i-1]]);
               end;
             end;
          end;  end;end;我是这样实现输出数据,先请问一下怎么实现自动换行呢.....自动换行..