以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于打印预览相关问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91921) |
||||
-- 作者:Meiling -- 发布时间:2016/10/21 22:54:00 -- 关于打印预览相关问题 老师,您好, 相应测试文件:
再次麻烦老师啦~
|
||||
-- 作者:有点蓝 -- 发布时间:2016/10/22 9:35:00 -- 把预览和打印按钮放到查询结果窗口,从窗口取数据打印 |
||||
-- 作者:Meiling -- 发布时间:2016/10/22 10:13:00 -- 不好意思,可以请问下具体怎么操作吗? 把相关按钮放到查询结果窗口的代码是? 从窗口提取数据打印的代码是怎么进行编写呢? |
||||
-- 作者:有点蓝 -- 发布时间:2016/10/22 10:57:00 -- 其实查询和结果窗口完全可以合并到一起,没有必要分开2个窗口 |
||||
-- 作者:Meiling -- 发布时间:2016/10/22 15:08:00 -- 老师,您好,如果想要点击打印按钮的话,可以把所有筛选的后台数据都可以直接打印得出来吗? 打印按钮的代码为: Dim doc As New PrintDoc \'定义一个新报表 Dim rt As New prt.RenderTable \'定义一个新表格 Dim tb As Table = Tables("T28") Dim ColNames As String() = New String(){"F396","F397","F398","F399","F400","F401","F402","F4367","F5222","F407","F416","F417","F418","F419","F4375","F5311","F5313","F4373","F4377","F4378","F4379","F4380","F4381"} rt.Style.Font = tb.Font doc.PageSetting.Landscape = True For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,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 + 1, c).Text = tb.Rows(r)(ColNames(c)) Next Next rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线 rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头. doc.Body.Children.Add(rt) \'将表格加入到报表 doc.Print() |
||||
-- 作者:有点蓝 -- 发布时间:2016/10/22 15:13:00 -- Dim doc As New PrintDoc \'定义一个新报表 Dim rt As New prt.RenderTable \'定义一个新表格 Dim tb As Table = Tables("T28") Dim ColNames As String() = New String(){"F396","F397","F398","F399","F400","F401","F402","F4367","F5222","F407","F416","F417","F418","F419","F4375","F5311","F5313","F4373","F4377","F4378","F4379","F4380","F4381"} rt.Style.Font = tb.Font doc.PageSetting.Landscape = True Dim drs As = tb.DataTable.SQLSelect(tb.DataTable.LoadFilter) For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,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 drs.Count -1 \'开始填入该列内容 rt.Cells(r + 1, c).Text = drs(r)(ColNames(c)) Next Next rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线 rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头. doc.Body.Children.Add(rt) \'将表格加入到报表 doc.Print() |
||||
-- 作者:Meiling -- 发布时间:2016/10/22 15:31:00 -- 太谢谢老师了!! |
||||
-- 作者:Meiling -- 发布时间:2016/10/22 15:47:00 -- 老师,您好,想请问下Dim drs As = tb.DataTable.SQLSelect(tb.DataTable.LoadFilter) 这句代码是缺个类型吗? |
||||
-- 作者:有点蓝 -- 发布时间:2016/10/22 16:03:00 -- Dim drs As list(of datatarow) = tb.DataTable.SQLSelect(tb.DataTable.LoadFilter) |
||||
-- 作者:Meiling -- 发布时间:2016/10/22 16:36:00 -- Dim drs As list(of datatarow) = tb.DataTable.SQLSelect(tb.DataTable.LoadFilter) 老师,您好,输入代码提示:未定义datatarow 类型。 是不是datatarow 是DataRow呢?还是? |