以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何连续打印凭证?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=103221)

--  作者:狂风暴雨狂波
--  发布时间:2017/7/3 15:37:00
--  如何连续打印凭证?

凭证和凭证明细关联.要打印选定凭证或者所有凭证并且凭证明细行数固定为7行,用A4纸打印,每张纸打印2张凭证,如何编写代码?求高手赐教!谢谢!


--  作者:有点甜
--  发布时间:2017/7/3 16:21:00
--  

用excel报表打印

 

http://www.foxtable.com/webhelp/scr/0204.htm

 

http://www.foxtable.com/webhelp/scr/1145.htm

 

 

 


--  作者:狂风暴雨狂波
--  发布时间:2017/7/3 17:00:00
--  
以下是引用有点甜在2017/7/3 16:21:00的发言:

用excel报表打印

 

http://www.foxtable.com/webhelp/scr/0204.htm

 

http://www.foxtable.com/webhelp/scr/1145.htm

 

 

 

不可以用专业报表编写代码打印吗?帮助里的连续打印关联表可以打印,但就是不知道关联表怎么写打印固定行数的代码.


--  作者:有点甜
--  发布时间:2017/7/3 17:36:00
--  

对应例子,修改代码

 

http://www.foxtable.com/webhelp/scr/1250.htm

 

 

Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("类别")

For i As Integer = tbl.TopRow To tbl.BottomRow Step 2
    For j As Integer = 1 To 2
        If i+j-1 <= tbl.BottomRow Then
            rx = New prt.RenderText
            rx.Style.FontSize = 14
            rx.Style.FontBold = True
            rx.Style.Spacing.Bottom = 5
            rx.Text = "类别: " & Tables("类别").Rows(i+j-1)("类别名称")
            doc.Body.Children.Add(rx)
           
            rt = New prt.RenderTable
            rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
            rt.Style.TextAlignVert = prt.AlignVertEnum.Center
            rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
            rt.CellStyle.Spacing.All = 1
            rt.Cols.Count = 4
            rt.Cells(0,0).Text = "产品名称"
            rt.Cells(0,1).Text = "单价"
            rt.Cells(0,2).Text = "库存量"
            rt.Cells(0,3).Text = "订购量"
            rt.Cells(0,4).Text = "再订购量"
            rt.Cells(0,5).Text = "中止"
            rt.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
            rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
           
            Rows = Tables("类别").Rows(i+j-1).DataRow.GetChildRows("产品")
            For r As Integer = 0 To 6
                If r >= Rows.count Then
                    rt.Cells(r+1,0).Text = "   "
                Else
                    rt.Cells(r+1,0).Text = rows(r)("产品名称")
                    rt.Cells(r+1,1).Text = rows(r)("单价")
                    rt.Cells(r+1,2).Text = rows(r)("库存量")
                    rt.Cells(r+1,3).Text = rows(r)("订购量")
                    rt.Cells(r+1,4).Text = rows(r)("再订购量")
                End If
            Next
           
            doc.Body.Children.Add(rt)
            If j = 2 Then
                rt.BreakAfter = prt.BreakEnum.Page \'另起一页再打印
            End If
        End If
    Next
Next
doc.Preview