要求不高的话,用tbprint,网上搜一下,还好用的。找不到的花,再找我。

解决方案 »

  1.   

    自己写程序
    给你一个用EXCEL打印的例子:
    Sub print_click(MSFlexGrid1 As MSFlexGrid)
    On Error GoTo ErrHandler
    Dim EXCELApp As Excel.Application
    Dim EXCELWorkBook As Excel.Workbook
    Dim xlSheet As Excel.WorksheetDim rows, cols As Integer
    Dim Irow, hCol, Icol As Integer
    Dim New_Col As Boolean
        If MSFlexGrid1 .rows <= 1 Then
            MsgBox "还没有数据记录", vbInformation, App.Title
            Exit Sub
        End If
        
        Set EXCELApp = CreateObject("Excel.application")
        Set EXCELWorkBook = EXCELApp.Workbooks.Add
        Set xlSheet = EXCELWorkBook.Sheets(1)
        Dim New_Column As Boolean
        
        With MSFlexGrid1 
            rows = .rows
            cols = .cols
            Irow = 0
            Icol = 1
            For hCol = 0 To cols - 1
                For Irow = 1 To rows
                    EXCELApp.Cells(Irow + 1, Icol).Value = .TextMatrix(Irow - 1, hCol)
                Next Irow
                Icol = Icol + 1
            Next hCol
        End With
        'xlsheet.Range(xlsheet.Cells(2, 0), xlsheet.Cells(rows, cols - 1)).Borders.LineStyle = xlContinuous
      
        EXCELApp.rows(2).Font.Bold = True
        EXCELApp.Cells.Select
        EXCELApp.Columns.AutoFit
        EXCELApp.Cells(1, 1).Select
        EXCELApp.Application.Visible = True
        'EXCELApp.Sheets.PrintPreview
        Set EXCELWorkBook = Nothing
        Set EXCELApp = Nothing
        MSFlexGrid1.SetFocus
       ' MsgBox "Data has been successfully copied to Excel. ", vbInformation, "Success"
    Exit Sub
    ErrHandler:
      MsgBox "报表错误", vbInformation, "报表错误"
    End Sub
      

  2.   

    http://usevb.yeah.net
    打印的数据源支持:
    ms adodb.recordset 保存的xml
    ms sql2000 查询得到的xml
    ms adodb.recordset
    数组
    datagrid
    mshflexgrid、msflexgrid(如果选中多行,只打印选中行,否则打印全部)
    可用于:cs、dhtml、iis服务器端