以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  以下代码中想加一个小计  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=114102)

--  作者:hopestarxia
--  发布时间:2018/1/29 7:23:00
--  以下代码中想加一个小计
老师,像这种分页打印,如果想在每一页加一个数量的小计,请问代码如何修改?

Dim t As Table = e.Form.Controls("Table1").Table
Dim ps As Integer = Math.Ceiling(t.Rows.count / 15) 
For i As Integer = 1 To ps
    Dim idxs As String = ""
    t.Filter = ""
    For j As Integer = (i-1)*15 To i*15-1
        If j >= t.Rows.count Then
            Exit For
        End If
        idxs &= "\'" & t.Rows(j)("itemno") & "\',"
    Next
    t.Filter = "itemno in (" & idxs.trim(",") & ")"
    e.Form.Controls("Label40").Text = "页码  第 " & i & " 页 ; 共 " & ps  + e.Form.Controls("NumericComboBox2").value & " 页"
    Dim doc As PrintDoc = e.Form.GernatePrintDoc()
    doc.Preview()
Next
t.Filter = ""

--  作者:有点甜
--  发布时间:2018/1/29 9:13:00
--  

参考代码

 

Dim t As Table = e.Form.Controls("Table1").Table
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
For Each c As object In doc.Body.children
    If typeof c Is prt.RenderTable Then
        Dim i = c.rows.count+1
        c.cells(i, 0).text = "123"
        c.cells(i, 1).text = "abc"

    End If
Next
doc.Preview()


--  作者:hopestarxia
--  发布时间:2018/2/2 21:29:00
--  
谢谢老师。找了一个变通的方法处理。代码还需要再研究一下才明白,用了老师的代码,大概意思知道,但是还没套成功、