以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助] 需要将表格顺时针90度旋转,并且在这个纸张上面打印二个表格  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=85955)

--  作者:农村人
--  发布时间:2016/6/6 18:02:00
--  [求助] 需要将表格顺时针90度旋转,并且在这个纸张上面打印二个表格
[求助] 需要将表格顺时针90度旋转,并且在这个纸张上面打印二个表格,求前辈帮忙

Dim doc As New PrintDoc
doc.PageSetting.Width = 80 \'纸张宽度为100毫米
doc.PageSetting.Height = 240 \'纸张高度为120毫米
Doc.PageSetting.LeftMargin = 5 \'设置左边距
Doc.PageSetting.RightMargin = 5 \'设置右边距
Doc.PageSetting.TopMargin = 5 \'设置上边距
Doc.PageSetting.BottomMargin = 5 \'设置下边距
Dim tb As Table = Tables("分箱打印")
Dim prs As Integer = 10 \'每页20行
For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
    Dim rt As New prt.RenderTable
    rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
    rt.CellStyle.Spacing.All = 0.5
    For c As Integer = 0 To tb.Cols.Count - 1
        rt.Cells(0,c).Text = tb.Cols(c).Name
    Next
    For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
        For c As Integer = 0 To tb.Cols.Count - 1
            rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
        Next
    Next
    If p = math.Ceiling(tb.Rows.Count / prs) - 1 \'如果是最后一页
        For r As Integer = tb.Rows.Count To ( p + 1) * prs - 1 \'补空行
            rt.Rows.Count = rt.Rows.Count + 1
            rt.Rows(rt.Rows.count -1)(0).text = " "
        Next
    Else
        rt.BreakAfter = prt.BreakEnum.Page \'否则换页
    End If
    doc.Body.Children.Add(rt)
Next
doc.Preview()


--  作者:大红袍
--  发布时间:2016/6/6 18:05:00
--  
 不能这样,你只能设置横向打印。
--  作者:农村人
--  发布时间:2016/6/6 18:11:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160606181019.png
图片点击可在新窗口打开查看
你好!我希望如上图那样打印出来标签 、有没有什么以做到

--  作者:大红袍
--  发布时间:2016/6/6 18:14:00
--  
 不能直接设计,然后横向打印吗?
--  作者:农村人
--  发布时间:2016/6/6 18:19:00
--  
谢谢,那么同时在一张纸上面打印二个表格,同样的内容。这应该怎么做
--  作者:Hyphen
--  发布时间:2016/6/7 8:41:00
--  
上传具体例子测试
--  作者:狐狸爸爸
--  发布时间:2016/6/7 8:44:00
--  

打印两次的话,重复执行两次即可,加粗的部分,用于设置两次打印之间的间距:

 

Dim doc As New PrintDoc
doc.PageSetting.Width = 80 \'纸张宽度为100毫米
doc.PageSetting.Height = 240 \'纸张高度为120毫米
Doc.PageSetting.LeftMargin = 5 \'设置左边距
Doc.PageSetting.RightMargin = 5 \'设置右边距
Doc.PageSetting.TopMargin = 5 \'设置上边距
Doc.PageSetting.BottomMargin = 5 \'设置下边距
For i As Integer = 1 To 2
    Dim tb As Table = Tables("表A")
    Dim prs As Integer = 10 \'每页20行
    For p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
        Dim rt As New prt.RenderTable
        rt.Style.Spacing.Top = 6
        rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
        rt.CellStyle.Spacing.All = 0.5
        For c As Integer = 0 To tb.Cols.Count - 1
            rt.Cells(0,c).Text = tb.Cols(c).Name
        Next
        For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
            For c As Integer = 0 To tb.Cols.Count - 1
                rt.Cells(r - p * prs + 1, c).Text = tb.rows(r)(c)
            Next
        Next
        If p = math.Ceiling(tb.Rows.Count / prs) - 1 \'如果是最后一页
            For r As Integer = tb.Rows.Count To ( p + 1) * prs - 1 \'补空行
                rt.Rows.Count = rt.Rows.Count + 1
                rt.Rows(rt.Rows.count -1)(0).text = " "
            Next
        Else
            rt.BreakAfter = prt.BreakEnum.Page \'否则换页
        End If
        doc.Body.Children.Add(rt)
    Next
Next
doc.Preview()