如何打印当前grid中的数据

解决方案 »

  1.   

    用dbgrideh控件,它的控件组中有打印控件
      

  2.   

    我想用frxReport空间 怎么做啊
      

  3.   

    FastReprot自身例子有demo  看PrintStringGrid
      

  4.   

    简单...拖几个控件连上当前在使用 DBGRID的ADOquery 就行了  下面是部分控件的设置
     object QuickRep1: TQuickRep
        Left = 0
        Top = 464
        Width = 794
        Height = 1123
        Frame.Color = clBlack
        Frame.DrawTop = False
        Frame.DrawBottom = False
        Frame.DrawLeft = False
        Frame.DrawRight = False
        DataSet = ADOQuery1
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Arial'
        Font.Style = []
        Functions.Strings = (
          'PAGENUMBER'
          'COLUMNNUMBER'
          'REPORTTITLE')
        Functions.DATA = (
          '0'
          '0'
          #39#39)
        Options = [FirstPageHeader, LastPageFooter]
        Page.Columns = 1
        Page.Orientation = poPortrait
        Page.PaperSize = A4
        Page.Values = (
          100
          2970
          100
          2100
          100
          100
          0)
        PrinterSettings.Copies = 1
        PrinterSettings.Duplex = False
        PrinterSettings.FirstPage = 0
        PrinterSettings.LastPage = 0
        PrinterSettings.OutputBin = Auto
        PrintIfEmpty = True
        SnapToGrid = True
        Units = MM
        Zoom = 100
        object QRBand1: TQRBand
          Left = 38
          Top = 119
          Width = 718
          Height = 49
          Frame.Color = clBlack
          Frame.DrawTop = False
          Frame.DrawBottom = False
          Frame.DrawLeft = False
          Frame.DrawRight = False
          AlignToBottom = False
          Color = clWhite
          ForceNewColumn = False
          ForceNewPage = False
          Size.Values = (
            129.645833333333
            1899.70833333333)
          BandType = rbColumnHeader   object QRBand2: TQRBand
          Left = 38
          Top = 168
          Width = 718
          Height = 22
          Frame.Color = clBlack
          Frame.DrawTop = False
          Frame.DrawBottom = False
          Frame.DrawLeft = False
          Frame.DrawRight = False
          AlignToBottom = False
          Color = clWhite
          ForceNewColumn = False
          ForceNewPage = False
          Size.Values = (
            58.2083333333333
            1899.70833333333)
          BandType = rbDetail
      object QRSysData1: TQRSysData
            Left = 2
            Top = 2
            Width = 35
            Height = 17
            Frame.Color = clBlack
            Frame.DrawTop = False
            Frame.DrawBottom = False
            Frame.DrawLeft = False
            Frame.DrawRight = False
            Size.Values = (
              44.9791666666667
              5.29166666666667
              5.29166666666667
              92.6041666666667)
            Alignment = taCenter
            AlignToBand = False
            AutoSize = False
            Color = clWhite
            Data = qrsDetailNo
            Transparent = False
            FontSize = 10
          end
         object QRDBText11: TQRDBText
            Left = 528
            Top = 2
            Width = 65
            Height = 17
            Frame.Color = clBlack
            Frame.DrawTop = False
            Frame.DrawBottom = False
            Frame.DrawLeft = False
            Frame.DrawRight = False
            Size.Values = (
              44.9791666666667
              1397
              5.29166666666667
              171.979166666667)
            Alignment = taRightJustify
            AlignToBand = False
            AutoSize = False
            AutoStretch = False
            Color = clWhite
            DataSet = ADOQuery1
            DataField = #22443#20184#27454#24050#25910#26410#20184
            Transparent = False
            WordWrap = True
            FontSize = 10
          end
         object QRDBText2: TQRDBText
            Left = 314
            Top = 2
            Width = 69
            Height = 17
            Frame.Color = clBlack
            Frame.DrawTop = False
            Frame.DrawBottom = False
            Frame.DrawLeft = False
            Frame.DrawRight = False
            Size.Values = (
              44.9791666666667
              830.791666666667
              5.29166666666667
              182.5625)
            Alignment = taRightJustify
            AlignToBand = False
            AutoSize = False
            AutoStretch = False
            Color = clWhite
            DataSet = ADOQuery1
            DataField = #22443#20184#27454#26410#25910#24050#20184#26410#20986#31080
            Transparent = False
            WordWrap = True
            FontSize = 10
          end    end
        object QRBand3: TQRBand
          Left = 38
          Top = 38
          Width = 718
          Height = 81
          Frame.Color = clBlack
          Frame.DrawTop = False
          Frame.DrawBottom = False
          Frame.DrawLeft = False
          Frame.DrawRight = False
          AlignToBottom = False
          Color = clWhite
          ForceNewColumn = False
          ForceNewPage = False
          Size.Values = (
            214.3125
            1899.70833333333)
          BandType = rbPageHeader
           object QRSysData2: TQRSysData
            Left = 669
            Top = 16
            Width = 24
            Height = 17
            Frame.Color = clBlack
            Frame.DrawTop = False
            Frame.DrawBottom = False
            Frame.DrawLeft = False
            Frame.DrawRight = False
            Size.Values = (
              44.9791666666667
              1770.0625
              42.3333333333333
              63.5)
            Alignment = taCenter
            AlignToBand = False
            AutoSize = False
            Color = clWhite
            Data = qrsPageNumber
            Transparent = False
            FontSize = 10
          end  
        end
        object QRBand4: TQRBand
          Left = 38
          Top = 190
          Width = 718
          Height = 22
          Frame.Color = clBlack
          Frame.DrawTop = False
          Frame.DrawBottom = False
          Frame.DrawLeft = False
          Frame.DrawRight = False
          AlignToBottom = False
          Color = clWhite
          ForceNewColumn = False
          ForceNewPage = False
          Size.Values = (
            58.2083333333333
            1899.70833333333)
          BandType = rbPageFooter
          object QRLabel3: TQRLabel
            Left = 3
            Top = 2
            Width = 374
            Height = 17
            Frame.Color = clBlack
            Frame.DrawTop = False
            Frame.DrawBottom = False
            Frame.DrawLeft = False
            Frame.DrawRight = False
            Size.Values = (
              44.9791666666667
              7.9375
              5.29166666666667
              989.541666666667)
            Alignment = taLeftJustify
            AlignToBand = False
            AutoSize = False
            AutoStretch = False
            Caption = 'QRLabel3'
            Color = clWhite
            Transparent = False
            WordWrap = True
            FontSize = 10
          end
        end
      end
      object DataSource1: TDataSource
        DataSet = ADOQuery1
        Left = 64
        Top = 65528
      end
      object ADOQuery1: TADOQuery
        Connection = ADOConnection1
        Parameters = <>
        Left = 96
        Top = 65528
      end
      object ADOConnection1: TADOConnection
        LoginPrompt = False
        Provider = 'MSDASQL.1'
        Left = 24
        Top = 65528
      end
    end