以文本方式查看主题

-  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=148443)

--  作者:deliangzhaoe
--  发布时间:2020/4/8 8:48:00
--  竖向打印时页脚不显示
A4竖向打印时,页脚为什么不显示出来?
\'设置页脚
Dim yj As New prt.RenderText \'定义一个文本对象
yj = New prt.RenderText \'设置文本对象的内容
yj.Text = "第[PageNo]页  共[PageCount]页" \'设置文本内容
yj.Style.TextAlignHorz = prt.AlignHorzEnum.center \'页脚中间对齐
yj.Style.FontSize = 10 \'字体大小为10磅
yj.Style.Padding.Bottom = -20 \'底端内容缩进10毫米
Doc.PageFooter = yj \'作为页脚使用

--  作者:有点蓝
--  发布时间:2020/4/8 9:07:00
--  
测试没有问题

Dim doc As New PrintDoc \'定义一个报表
doc.PageSetting.PaperKind = 9
Dim rt As New prt.RenderText \'定义一个文本对象
rt.Text = "Hello Foxtable" \'设置文本对象的内容
doc.Body.Children.Add(rt) \'将文本对象加入到报表
Dim yj As New prt.RenderText \'定义一个文本对象
yj = New prt.RenderText \'设置文本对象的内容
yj.Text = "第[PageNo]页  共[PageCount]页" \'设置文本内容
yj.Style.TextAlignHorz = prt.AlignHorzEnum.center \'页脚中间对齐
yj.Style.FontSize = 10 \'字体大小为10磅
yj.Style.Padding.Bottom = -20 \'底端内容缩进10毫米
Doc.PageFooter = yj \'作为页脚使用
doc.Preview() \'预览

--  作者:deliangzhaoe
--  发布时间:2020/4/8 21:16:00
--  
竖向打印的都没有页脚了,横向打印的都有页脚。
竖向打印:
\'页面设置
Dim doc As New PrintDoc \'定义一个报表
Doc.PageSetting.LeftMargin = 20
Doc.PageSetting.BottomMargin = 15
Doc.PageSetting.TopMargin = 15
Doc.PageSetting.rightMargin = 20
Dim rm As prt.RenderEmpty \'定一个空对象
\'doc.Pagesetting.LandScape = True \'横向打印
Dim tbl1 As Table = Tables("应急预案修订情况")
\'设置页脚
Dim yj As New prt.RenderText \'定义一个文本对象
yj = New prt.RenderText \'设置文本对象的内容
yj.Text = "第[PageNo]页  共[PageCount]页" \'设置文本内容
yj.Style.TextAlignHorz = prt.AlignHorzEnum.center \'页脚中间对齐
yj.Style.FontSize = 10 \'字体大小为10磅
yj.Style.Padding.Bottom = -20 \'底端内容缩进10毫米
Doc.PageFooter = yj \'作为页脚使用
\'打印
For i As Integer = 0 To tbl1.Rows.Count - 1
    rm = new prt.RenderEmpty \'定义一个新的空对象
    rm.BreakBefore = prt.BreakEnum.Page \'打印前换页
    doc.Body.Children.Add(rm) \'加入到报表中
    Dim rw As Row = tbl1.Rows(i)
    Dim rt As New prt.RenderTable() \'定义一个表格对象
    Dim rx As New prt.RenderText \'定义一个文本对象
    Dim ra As New prt.RenderArea \'定义一个容器
    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never  \'禁止容器因为分页而被垂直分割
    \'设置一级标题
    Dim dr As String = e.Form.controls("ComboBox1").value
    rx.text = dr & vbcrlf & "生产安全事故应急预案修订记录"
    rx.Style.FontBold = True \'字体加粗
    rx.Style.FontSize = 18 \'大体大小为18磅
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列
    rx.Style.Spacing.Bottom = 5 \'和下面的对象(表格)距离5毫米
    ra.Children.Add(rx) \'加入到容器中
    \'设置表格样式
    rt.Rows.Count = 13 \'设置总行数
    rt.Cols.Count = 2 \'设置总列数
    rt.Height = 240 \'设置表格的高度
    rt.Style.FontSize = 12 \'大体大小为12磅
    rt.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
    rt.cells(4,1).Style.TextAlignHorz = prt.AlignHorzEnum.left \'第7行内容靠上对齐
    rt.cells(5,1).Style.TextAlignHorz = prt.AlignHorzEnum.left \'第7行内容靠上对齐
    rt.cells(7,0).Style.TextAlignHorz = prt.AlignHorzEnum.left \'第7行内容靠上对齐
    rt.cells(8,1).Style.TextAlignHorz = prt.AlignHorzEnum.left \'第7行内容靠上对齐
    rt.cells(9,1).Style.TextAlignHorz = prt.AlignHorzEnum.left \'第7行内容靠上对齐
    rt.Cols(0).Width = 50 \'设置列的宽度
    rt.Cols(1).Width = 135
    rt.Rows(0).Height = 10 \'设置行的高度
    rt.Rows(1).Height = 10
    rt.Rows(2).Height = 10
    rt.Rows(3).Height = 10
    rt.Rows(4).Height = 10
    rt.Rows(5).Height = 10
    rt.Rows(6).Height = 10
    rt.Rows(7).Height = 70
    rt.Rows(8).Height = 10
    rt.Rows(9).Height = 20
    rt.Rows(10).Height = 10
    rt.Rows(11).Height = 10
    rt.Rows(12).Height = 10
    \'设置合并单元格
    rt.Cells(6,0).SpanCols = 2 \'向右合并2列
    rt.Cells(7,0).SpanCols = 2 \'向右合并2列
    \'设置表格样式
    rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米
    rt.Style.Spacing.Bottom = 5 \'和下一个资料卡的距离是5毫米
    rt.Style.GridLines.All = New prt.Linedef \'设置网格线
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'内容垂直居中
    rt.Cells(0,0).Text= "企业名称"
    rt.Cells(0,1).Text = rw("企业名称")
    rt.Cells(1,0).Text= "预案类别"
    rt.Cells(1,1).Text = rw("预案类别")
    rt.Cells(2,0).Text= "应急预案名称"
    rt.Cells(2,1).Text = rw("预案名称")
    rt.Cells(3,0).Text= "修订日期"
    rt.Cells(3,1).Text = rw("修订日期")
    rt.Cells(4,0).Text= "修订原因/依据"
    rt.Cells(4,1).Text = rw("修订依据")
    rt.Cells(5,0).Text= "修订条款"
    rt.Cells(5,1).Text = rw("修订条款")
    rt.Cells(6,0).Text= "应急预案修订内容"
    rt.Cells(7,0).Text = rw("修订内容")
    rt.Cells(8,0).Text= "修订评审结果"
    rt.Cells(8,1).Text = rw("修订评估")
    rt.Cells(9,0).Text= "参加评估人员"
    rt.Cells(9,1).Text = rw("评审人员")
    rt.Cells(10,0).Text= "评估日期"
    rt.Cells(10,1).Text = rw("评审日期")
    rt.Cells(11,0).Text= "实施日期"
    rt.Cells(11,1).Text = rw("实施日期")
    rt.Cells(12,0).Text= "修订后发布签字"
    ra.Children.Add(rt) \'加入到容器中
    Doc.Body.ChildRen.Add(ra) \'将容器加入到报表中
Next
Doc.Preview() \'预览报表

横向打印的:
\'页面设置
Dim doc As New PrintDoc \'定义一个报表
Doc.PageSetting.LeftMargin = 15
Doc.PageSetting.BottomMargin = 15
Doc.PageSetting.TopMargin = 15
Doc.PageSetting.rightMargin = 15
Dim rm As prt.RenderEmpty \'定一个空对象
doc.Pagesetting.LandScape = True
\'设置页脚
Dim yj As New prt.RenderText \'定义一个文本对象
yj = New prt.RenderText \'设置文本对象的内容
yj.Text = "第[PageNo]页  共[PageCount]页" \'设置文本内容
yj.Style.TextAlignHorz = prt.AlignHorzEnum.center \'页脚中间对齐
yj.Style.FontSize = 10 \'字体大小为10磅
yj.Style.Padding.Bottom = -20 \'底端内容缩进10毫米
Doc.PageFooter = yj \'作为页脚使用
Dim nd As winform.combobox = Forms("mainform").controls("员工演练情况年度")
Dim qm As winform.combobox = Forms("mainform").controls("员工演练情况所在部门")
Dim xm As winform.combobox = Forms("mainform").controls("员工演练情况姓名")
Dim tbl8 As Table = Tables("员工演练情况") \'演练
\'打印员工参加演练情况
Dim rt8 As Prt.RenderTable
Dim rx8 As prt.RenderText
Dim Rows8 As List(Of DataRow)
\'设置二级标题
rx8 = New prt.RenderText
rx8.Style.FontSize = 14
rx8.Style.Spacing.Bottom = 2
Dim dr As String = Forms("mainform").controls("员工演练情况所在部门").value
rx8.text = dr & vbcrlf & "员工参加演练记录"
rx8.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题水平居中
doc.Body.Children.Add(rx8)
\'设置表格样式
rt8 = New prt.RenderTable
rt8.Style.Font = tbl8.Font
rt8.Style.TextAlignVert = prt.AlignVertEnum.Center
rt8.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
rt8.Style.Spacing.Bottom = 5
rt8.CellStyle.Spacing.All = 1
rt8.Style.Font = tbl8.Font
\'设置表格细节
Rows8 = tbl8.DataTable.Select("[年度] Like \'*" & nd.text & "*\' And [企业名称] Like \'*" & qm.text & "*\' And 姓名 Like \'*" & xm.text & "*\'","演练时间 DESC") \'指定符合条件的行和排序方式
Dim nms8() As String = {"企业名称","年度","姓名","演练时间","演练地点","组织单位","事故类型","演练目的","演练内容"} \'指定要显示的列即要打印的列
Dim caps() As String = {"序号","年度","姓名","演练时间","演练地点","组织单位","事故类型","演练目的","演练内容"} \'自定义列名
For c As Integer = 0 To nms8.length - 1
    Dim ary() As String = caps(c).split("|")
    For i As Integer = 0 To ary.length-1
        rt8.cells(i, c).text = ary(i)
    Next    \'打印的列标题自定义
    rt8.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
    \'rt8.Cols(c).Width = tbl8.Cols(c).PrintWidth \'根据原表格确定列宽
    rt8.Cols(0).Width = 15 \'设置各列宽度
    rt8.Cols(1).Width = 15
    rt8.Cols(2).Width = 15
    rt8.Cols(3).Width = 20
    rt8.Cols(4).Width = 20
    rt8.Cols(5).Width = 20
    rt8.Cols(6).Width = 25
    rt8.Cols(7).Width = 50
    rt8.Cols(8).Width = 50
     For r As Integer = 0 To Rows8.Count -1
        If c=0 Then
            rt8.Cells(r + 1, c).Text = r+1 \'增加了序号列,并自动填充
        Else
            rt8.Cells(r + 1, c).Text = rows8(r)(tbl8.Cols(nms8(c)).Name)
        End If
    Next
Next
rt8.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt8)
Doc.Preview() \'预览报表

--  作者:有点蓝
--  发布时间:2020/4/9 9:11:00
--  
yj.Style.Padding.Bottom = -20
改为
yj.Style.Padding.Bottom = -10

超出了打印范围