Foxtable(狐表)用户栏目专家坐堂 → [求助]报表打印中公式问题


  共有4609人关注过本帖树形打印复制链接

主题:[求助]报表打印中公式问题

帅哥哟,离线,有人找我吗?
有点蓝
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/1 14:20:00 [只看该作者]

方法一样的啊,什么取得课程的内容就一样怎么取班级名单的内容,取得到内容了想填充打印什么都可以

 回到顶部
帅哥哟,离线,有人找我吗?
大雪山
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:290 积分:2931 威望:0 精华:0 注册:2008/9/29 10:13:00
  发帖心情 Post By:2016/11/4 8:54:00 [只看该作者]

打印公式怎么修改?   问题 1. 页脚和日期同时共存, 2.A4 竖变横

 

 

Dim t As Table = CurrentTable
With Tables("student").PrintInfo
    '.PageHeader = "继续教育||"  '左
    .PageHeader = "|继续教育|"  '中
    .PageHeader = "||继续教育"  '右
    '.PageFooter = "第[PageNo]页,共[PageCount]页"  '页脚
    .PageFooter = "||[Today]|"
    '.PaperKind = 9 '纸张类型设为自定义  'A4
    .LeftMargin = 15  '左边距
    .RightMargin = 5  '右边距
    .TopMargin = 10  '上边距
    .BottomMargin = 10  '上边距
End With

T.Print(True,False)
msgbox(t.PrintInfo.SubTitle)


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/4 9:27:00 [只看该作者]

1、把日期加到页脚中
.PageFooter = Date.today & " 第[PageNo]页,共[PageCount]页"  '页脚

 回到顶部
帅哥哟,离线,有人找我吗?
大雪山
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:290 积分:2931 威望:0 精华:0 注册:2008/9/29 10:13:00
  发帖心情 Post By:2016/11/4 12:54:00 [只看该作者]

红字部分的页脚怎么加到这段代码中?

 

 

Dim doc As New PrintDoc '定义一个新报表
Dim rt As New prt.RenderTable '定义一个新表格
Dim tb As Table = Tables("student")
doc.PageSetting.Landscape = True '横向打印
Dim ColNames As New List(Of String)
For Each cl As Col In tb.Cols '排除隐藏列
    If cl.Visible Then
        ColNames.Add(cl.Name)
    End If
Next

Dim t As Table = CurrentTable
With Tables("student").PrintInfo


    .PageFooter =  "第[PageNo]页,共[PageCount]页"   &  " ||[Today]"  '页脚
  
End With

 


Dim top As Integer = getConfigValue("上边距",10)
Dim lft As Integer = getConfigValue("左边距",16)
Dim btm As Integer = getConfigValue("下边距",10)
Dim fl As Integer = getConfigValue("分栏距",6)
Dim zrs As Integer = 1
Dim dqh As Integer = Tables("student").Position
If getConfigValue("全部打印",True) = True
    zrs = DataTables("student").DataRows.Count
End If
Dim clr As Color = Color.White
If getConfigValue("填表模式",True) = False
    clr = Color.Black
End If
Dim s As String
Dim mxh,cnt As Integer
Dim dr As DataRow
Dim h As Integer = Top
'-------------------------------------------------------以下代码定义报表
'Dim doc As New PrintDoc() '定义一个报表
'Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim ra As New prt.RenderArea '定义一个容器
doc.PageSetting.Width = 210 '纸张宽度为210毫米
doc.PageSetting.Height = 297 '纸张高度为120毫米
doc.AutoRotate = False '禁止自动旋转打印内容
doc.PageSetting.Landscape = True '横向打印
Doc.PageSetting.TopMargin = top '设置上边距
Doc.PageSetting.LeftMargin = lft '设置左边距
Doc.PageSetting.BottomMargin = btm '设置下边距

Dim drs As List(Of DataRow)
For rn As Integer = 0 To zrs - 1
    If getConfigValue("全部打印",True) = True
        dqh = rn
    End If
   
    rt = New prt.RenderTable() '定义一个表格对象
    rx = New prt.RenderText '定义一个文本对象
    ra = New prt.RenderArea '定义一个容器
    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never  '禁止容器因为分页而被垂直分割
    ra.Width = "177mm"
    rt.Style.GridLines.All = New prt.LineDef(clr) '将网格线类型设为默认类型Color.White
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
    rt.Style.Spacing.Top = 5 '表格和前面对象的垂直间隔为5毫米
    rt.Style.Spacing.Bottom = 5 '表和和后续对象的垂直间隔为5毫米
    rt.Style.Spacing.All = 2 '所有表格内边距为2mm


Next

 

 


rt.Width = "Auto" '表格宽度为自动,也就是等于各列设置宽度之和
rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded '表格宽度超出页宽时,可以水平换页
rt.Style.Font = tb.Font
rt.Cells(0,0).text = "继续教育"
rt.Cells(0,0).SpanCols = 6 '合并第一行全部单元格,用于显示主标题
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '主标题居中
rt.Cells(0,0).Style.Font = New Font("华文新魏",20.25,1,3,1,False) '设置主标题字体
rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第一行的网格线?
rt.Rows(0).Style.Borders.Bottom = New prt.Linedef
For c As Integer = 0 To ColNames.Count - 1 '逐列设置和填入内容
    rt.Cells(1,c).Text = ColNames(c) '列名作为标题
    rt.Cells(1,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
    rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth '列宽等于实际列宽
    If tb.Cols(ColNames(c)).IsNumeric OrElse tb.Cols(ColNames(c)).IsDate Then '如果是数值或日期列
        rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
    End If
    For r As Integer = 0 To tb.Rows.Count -1 '开始填入该列内容
        rt.Cells(r + 2, c).Text = tb.Rows(r)(ColNames(c))
    Next
Next
rt.cells(0,0).SpanCols = rt.Cols.Count
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt.CellStyle.Spacing.All = 2.0 '单元格内距设为1.0毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中

rt.Rows(1).Style.Font = New Font("宋体", 12, FontStyle.Bold) '修改参数 12 ,调整字体大小

rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All '利用行组,将第一行设为表头.
doc.Body.Children.Add(rt) '将表格加入到报表
doc.Preview()
doc.Print


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107680 积分:547721 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/4 13:37:00 [只看该作者]

专业报表打印页眉页脚参考:http://www.foxtable.com/webhelp/scr/1197.htm

表格打印和专业报表打印是2回事

 回到顶部
总数 15 上一页 1 2