看样子你很懂了。我的外号叫这个。DBCONTROLS,帮忙阿?

解决方案 »

  1.   

    你用什麼做報表啊?Crystal report/Data report?
      

  2.   

    我用datareport做的。当表格的记录比较少时,采用程序划线的方式。
      

  3.   

    帮忙进一下“帮忙讲一下 FindText、 ReplaceText”
    谢谢 
      

  4.   

    比你小,不敢称你为妹妹但如果你想方便的话,试试我的如何http://progame.longcity.net/
      

  5.   

    现在国际上流行把数据写到EXCEL,
    http://go8.163.com/dbcontrols/
    上有个INTOCELL控件可以实现.
      

  6.   

    回dbcontrols(aa):我要格式固定的报表,不需要再排版,动态从recordset集中取结果就行了。从查询等结果中直接输出到报表的。
      

  7.   

    该拖动的都试过了;使用表尾明显不行,因为当记录太少时表尾会往上移。可能是我划线的原因吧,但明明没错啊Dim cnn As Connection
        Set cnn = New Connection
        strSQL = "Provider=SQLOLEDB.1;Password=llztclking;Persist Security Info=True;User ID=sa;Initial Catalog=jxda;Data Source=LUCKII"
        cnn.CursorLocation = adUseClient
        cnn.Open strSQL
        adoRecordsetX.Open "Select * from S_CTVRB", cnn, adOpenDynamic, adLockBatchOptimistic
        Set rptS_CTVRB.DataSource = adoRecordsetX
        Dim DSec1_Txt_Collection As New Collection
        Dim DSec1_Lbl_Collection As New Collection
        Dim DSec1_Shp_Collection As New Collection
        Dim PSec3_Line_Collection As New Collection
        Dim PSec3_HLine_Collection As New Collection
        Dim PSec3_VLine_Collection As New Collection
        Dim PSec3_Lbl_Collection As New Collection
        Dim PSec3_Shp_Collection As New Collection
        Dim Ctl As Object
        Dim i As Integer
    '----------------------建collection
    For Each Ctl In Me.Sections.Item("Section1").Controls  '细节Section1
        Select Case TypeName(Ctl)
            Case "RptLabel"
            DSec1_Lbl_Collection.Add Ctl
            Case "RptShape"
            DSec1_Shp_Collection.Add Ctl
            Case "RptTextBox"
            Ctl.DataField = adoRecordsetX.Fields.Item(0).Name
            '先将所有TextBox(RptTextBox) 控件绑定到某一字段,否则报错!
            DSec1_Txt_Collection.Add Ctl
         End Select
       ' Ctl.Visible = False
    Next Ctl
    ''--------------DSec1_Lbl_Collection序号
    'For i = 1 To adoRecordsetX.RecordCount
    '    DSec1_Lbl_Collection.Item(i).Caption = str(i)
    'Next i
    On Error Resume Next
    For Each Ctl In Me.Sections.Item("Section3").Controls
        Select Case TypeName(Ctl)
            Case "RptLabel"
            PSec3_Lbl_Collection.Add Ctl
            Case "RptShape"
            PSec3_Shp_Collection.Add Ctl
            Case "RptLine"
               PSec3_Line_Collection.Add Ctl
            If Ctl.Height = 0 Then
               PSec3_HLine_Collection.Add Ctl
               Else
               PSec3_VLine_Collection.Add Ctl
            End If
        End Select
       ' Ctl.Visible = False
    Next Ctl
    '-----------------------------------划竖线
    Dim otherH As Integer
    Dim h As Integer
    Dim ss As Integer
    ss = 1
    otherH = Me.Sections("section2").Height + Me.Sections("section3").Height + Me.Sections("section4").Height + Me.Sections("section5").Height
    h = 11907 - Me.TopMargin - Me.BottomMargin - otherH
    shapeH = Me.Sections("section1").Controls("Shape1").Height
    If adoRecordsetX.RecordCount >= (h / shapeH) Then
        For i = 1 To PSec3_Line_Collection.Count
            PSec3_Line_Collection.Item(i).Visible = False
        Next i
    Else
        For i = 1 To (h - shapeH * (adoRecordsetX.RecordCount)) / shapeH '- 1
            PSec3_HLine_Collection.Item(i).top = i * shapeH
           ' MsgBox PSec3_HLine_Collection.Item(i).top
        Next i
        ss = i - 1
        For i = 1 To PSec3_VLine_Collection.Count
            PSec3_VLine_Collection.Item(i).Height = ss * shapeH
        Next i
        For i = 1 To PSec3_Lbl_Collection.Count
            PSec3_Lbl_Collection.Item(i).top = ss * shapeH + PSec3_Lbl_Collection.Item(i).top  ' + (h - shapeH * (adoRecordsetX.RecordCount))
        Next i
        For i = 1 To PSec3_Shp_Collection.Count
            PSec3_Shp_Collection.Item(i).top = ss * shapeH + PSec3_Shp_Collection.Item(i).top '+ (h - shapeH * (adoRecordsetX.RecordCount))
        Next i
    End If
    请指教
      

  8.   

    该拖动的都试过了;使用表尾明显不行,因为当记录太少时表尾会往上移。可能是我划线的原因吧,但明明没错啊Dim cnn As Connection
        Set cnn = New Connection
        strSQL = "Provider=SQLOLEDB.1;Password=llztclking;Persist Security Info=True;User ID=sa;Initial Catalog=jxda;Data Source=LUCKII"
        cnn.CursorLocation = adUseClient
        cnn.Open strSQL
        adoRecordsetX.Open "Select * from S_CTVRB", cnn, adOpenDynamic, adLockBatchOptimistic
        Set rptS_CTVRB.DataSource = adoRecordsetX
        Dim DSec1_Txt_Collection As New Collection
        Dim DSec1_Lbl_Collection As New Collection
        Dim DSec1_Shp_Collection As New Collection
        Dim PSec3_Line_Collection As New Collection
        Dim PSec3_HLine_Collection As New Collection
        Dim PSec3_VLine_Collection As New Collection
        Dim PSec3_Lbl_Collection As New Collection
        Dim PSec3_Shp_Collection As New Collection
        Dim Ctl As Object
        Dim i As Integer
    '----------------------建collection
    For Each Ctl In Me.Sections.Item("Section1").Controls  '细节Section1
        Select Case TypeName(Ctl)
            Case "RptLabel"
            DSec1_Lbl_Collection.Add Ctl
            Case "RptShape"
            DSec1_Shp_Collection.Add Ctl
            Case "RptTextBox"
            Ctl.DataField = adoRecordsetX.Fields.Item(0).Name
            '先将所有TextBox(RptTextBox) 控件绑定到某一字段,否则报错!
            DSec1_Txt_Collection.Add Ctl
         End Select
       ' Ctl.Visible = False
    Next Ctl
    ''--------------DSec1_Lbl_Collection序号
    'For i = 1 To adoRecordsetX.RecordCount
    '    DSec1_Lbl_Collection.Item(i).Caption = str(i)
    'Next i
    On Error Resume Next
    For Each Ctl In Me.Sections.Item("Section3").Controls
        Select Case TypeName(Ctl)
            Case "RptLabel"
            PSec3_Lbl_Collection.Add Ctl
            Case "RptShape"
            PSec3_Shp_Collection.Add Ctl
            Case "RptLine"
               PSec3_Line_Collection.Add Ctl
            If Ctl.Height = 0 Then
               PSec3_HLine_Collection.Add Ctl
               Else
               PSec3_VLine_Collection.Add Ctl
            End If
        End Select
       ' Ctl.Visible = False
    Next Ctl
    '-----------------------------------划竖线
    Dim otherH As Integer
    Dim h As Integer
    Dim ss As Integer
    ss = 1
    otherH = Me.Sections("section2").Height + Me.Sections("section3").Height + Me.Sections("section4").Height + Me.Sections("section5").Height
    h = 11907 - Me.TopMargin - Me.BottomMargin - otherH
    shapeH = Me.Sections("section1").Controls("Shape1").Height
    If adoRecordsetX.RecordCount >= (h / shapeH) Then
        For i = 1 To PSec3_Line_Collection.Count
            PSec3_Line_Collection.Item(i).Visible = False
        Next i
    Else
        For i = 1 To (h - shapeH * (adoRecordsetX.RecordCount)) / shapeH '- 1
            PSec3_HLine_Collection.Item(i).top = i * shapeH
           ' MsgBox PSec3_HLine_Collection.Item(i).top
        Next i
        ss = i - 1
        For i = 1 To PSec3_VLine_Collection.Count
            PSec3_VLine_Collection.Item(i).Height = ss * shapeH
        Next i
        For i = 1 To PSec3_Lbl_Collection.Count
            PSec3_Lbl_Collection.Item(i).top = ss * shapeH + PSec3_Lbl_Collection.Item(i).top  ' + (h - shapeH * (adoRecordsetX.RecordCount))
        Next i
        For i = 1 To PSec3_Shp_Collection.Count
            PSec3_Shp_Collection.Item(i).top = ss * shapeH + PSec3_Shp_Collection.Item(i).top '+ (h - shapeH * (adoRecordsetX.RecordCount))
        Next i
    End If
    请指教
      

  9.   

    这么报表不费劲吗?
    http://go8.163.com/dbcontrols
    有个报表的源代码你参考一下.
    报表都是先画好然后改变查询条件即可.
      

  10.   

    看好哪个给我来信或在这里留下E-MAIL
    是163的问题.
      

  11.   

    工厂里的东西比较死,
    [email protected]我要有关报表的东西
    感激不尽