Foxtable(狐表)用户栏目专家坐堂 → 为什么预览效果与导出的效果不一样?


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

主题:为什么预览效果与导出的效果不一样?

美女呀,离线,留言给我吧!
采菊东篱下
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
为什么预览效果与导出的效果不一样?  发帖心情 Post By:2023/3/13 21:43:00 [只看该作者]

预览显示正常,导出后标题分行了!

图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20230313214353.png
图片点击可在新窗口打开查看


 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:22.rar


[此贴子已经被作者于2023/3/14 7:36:33编辑过]

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


加好友 发短信
等级:超级版主 帖子:106680 积分:542589 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/3/13 22:21:00 [只看该作者]

怎么做的导出?用的word模板?

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2023/3/14 7:43:00 [只看该作者]

在窗口用代码生成打印预览,再用预览左上角自带的保存功能导出,就出现标题错位效果了。
[此贴子已经被作者于2023/3/14 8:00:20编辑过]

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


加好友 发短信
等级:狐精 帖子:3082 积分:20596 威望:0 精华:0 注册:2016/3/28 16:57:00
  发帖心情 Post By:2023/3/14 8:31:00 [只看该作者]

你是word模板的话,就把模板里面标题的文本框宽度拉宽点啊,文字居中就行了

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


加好友 发短信
等级:超级版主 帖子:106680 积分:542589 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/3/14 8:41:00 [只看该作者]

预览左上角自带的保存功能是有问题的,不能用。

在窗口用什么代码生成打印预览?

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2023/3/14 8:51:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20230314084857.png
图片点击可在新窗口打开查看

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
If e.Form.Controls("TextBox4").Value Is Nothing OrElse e.Form.Controls("TextBox5").Value Is Nothing Then
    messagebox.show("模板长宽不能为空")
    Return
End If
If e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(0) Then
    doc.PageSetting.Width = 297 'A3纸张宽度,单位为毫米
    doc.PageSetting.Height = 420 'A3纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(1) Then
    doc.PageSetting.Width = 210 'A4纸张宽度,单位为毫米
    doc.PageSetting.Height = 297 'A4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(2) Then
    doc.PageSetting.Width = 148.5 'A5纸张宽度,单位为毫米
    doc.PageSetting.Height = 210 'A5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(3) Then
    doc.PageSetting.Width = 257 'B4纸张宽度,单位为毫米
    doc.PageSetting.Height = 364 'B4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(4) Then
    doc.PageSetting.Width = 176 'B5纸张宽度,单位为毫米
    doc.PageSetting.Height = 250 'B5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(5) Then
    doc.PageSetting.Width = 420 'A2纸张宽度,单位为毫米
    doc.PageSetting.Height = 594 'A2纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(6) Then
    doc.PageSetting.Width = 105 'A6纸张宽度,单位为毫米
    doc.PageSetting.Height = 148 'A6纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("TextBox1").text IsNot Nothing And e.Form.Controls("TextBox2").text IsNot Nothing Then
    doc.PageSetting.Width = Val(e.Form.Controls("TextBox2").Value) '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = Val(e.Form.Controls("TextBox1").Value) '自定义纸张高度,单位为毫米
Else
    messagebox.show("纸张规格不能为空")
    Return
End If
If e.Form.Controls("ComboBox2").Value Is Nothing Then
    messagebox.show("棋赛名称不能为空")
    Return
End If
Dim drs As List(Of DataRow) = DataTables("基本信息").SQLSelect("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [身份] = '" & e.Form.Controls("ComboBox7").text & "'")
If e.Form.Controls("ComboBox7").Value Is Nothing Then
    messagebox.show("身份不能为空")
    Return
ElseIf e.Form.Controls("ComboBox7").Value = "裁判" And drs.count = 0 Then
    messagebox.show("没有裁判基本信息")
    Return
End If
Dim c1 As Integer = e.Form.Controls("TextBox4").Value
Dim c2 As Integer = e.Form.Controls("TextBox5").Value
Dim c3 As Integer = Val(doc.PageSetting.Width)
Dim c4 As Integer = Val(doc.PageSetting.Height)
Doc.PageSetting.LeftMargin = (c3 - c1 * (Math.Floor(c3 / c1))) / 2 '设置左边距
Doc.PageSetting.RightMargin = (c3 - c1 * (Math.Floor(c3 / c1))) / 2 '设置右边距
Doc.PageSetting.TopMargin = (c4 - c2 * (Math.Floor(c4 / c2))) / 2 '设置上边距
Doc.PageSetting.BottomMargin = (c4 - c2 * (Math.Floor(c4 / c2))) / 2 '设置下边距
For i As Integer = 0 To drs.count - 1
    Dim rt As New prt.RenderTable() '定义一个表格对象
    If drs IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Style.GridLines.Horz = New Prt.LineDef(Color.white)
        rt.Style.GridLines.Vert = New Prt.LineDef(Color.white)
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 8 '设置总行数
        rt.Cols.Count = 7 '设置总列数
        rt.Rows(0).Height = 8
        rt.Cols(0).Width = 3
        rt.cells(0, 0).SpanCols = 7
        rt.cells(1, 1).SpanCols = 5
        rt.Rows(1).Height = 10
        rt.Cells(1, 1).Style.FontBold = True
        rt.Cells(1, 1).Style.FontName = e.Form.Controls("FontPicker1").Value
        rt.Cells(1, 1).Style.TextColor = e.Form.Controls("ColorPicker1").Value
        rt.Cells(1, 1).Style.FontSize = e.Form.Controls("ComboBox3").Value
        rt.cells(1, 1).Text = e.Form.Controls("ComboBox2").text
        rt.cells(1, 1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(1, 1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Cells(2, 1).SpanCols = 5
        If drs(i).IsNull("棋赛副名") Then
            rt.Cells(2, 1).Text = Nothing
            rt.Rows(2).Height = 5
        Else
            rt.Cells(2, 1).Text = drs(i)("棋赛副名")
        End If
        rt.Cells(2, 1).Style.FontName = e.Form.Controls("FontPicker2").Value
        rt.Cells(2, 1).Style.TextColor = e.Form.Controls("ColorPicker2").Value
        rt.Cells(2, 1).Style.FontSize = e.Form.Controls("ComboBox4").Value
        rt.Cells(2, 1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(2, 1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(3).Height = 2
        rt.Cols(3).Width = 37
        rt.Rows(4).Height = 25
        If e.Form.Controls("ComboBox7").text = "参赛人" Then
            rt.Cells(4, 3).Text = drs(i)("编号")
        ElseIf e.Form.Controls("ComboBox7").text = "裁判" Then
            rt.Cells(4, 3).Text = "裁判"
        End If
        rt.Cells(4, 3).Style.FontName = e.Form.Controls("FontPicker3").Value
        rt.Cells(4, 3).Style.TextColor = e.Form.Controls("ColorPicker3").Value
        rt.Cells(4, 3).Style.FontSize = e.Form.Controls("ComboBox5").Value
        rt.Cells(4, 3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(4, 3).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(5).Height = 2
        rt.cells(6, 2).SpanCols = 3
        rt.Cells(6, 2).Text = drs(i)("姓名")
        rt.Cells(6, 2).Style.FontName = e.Form.Controls("FontPicker4").Value
        rt.Cells(6, 2).Style.TextColor = e.Form.Controls("ColorPicker4").Value
        rt.Cells(6, 2).Style.FontSize = e.Form.Controls("ComboBox6").Value
        rt.Cells(6, 2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(6, 2).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.cells(7, 0).SpanCols = 7
        rt.Rows(7).Height = 8
        rt.Cols(6).Width = 3
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Else
        Return
    End If
Next
Doc.Preview() '预览报表

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2023/3/14 8:58:00 [只看该作者]

我想把预览的效果导出Word

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


加好友 发短信
等级:超级版主 帖子:106680 积分:542589 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/3/14 9:02:00 [只看该作者]

建议保存为pdf:http://www.foxtable.com/webhelp/topics/2450.htm

在预览里的保存功能会失真,这个是预览组件自己的问题,改不了的。

或者试试把文字字体设置小点,调整一下文字边距设置:http://www.foxtable.com/webhelp/topics/1178.htm,不行就没有办法了

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2024/3/12 17:20:00 [只看该作者]

      我昨晚帮棋协生成胸牌,结中果忘了以前碰过这问题,弄了很久不行,只能让秘书长帮我在手提中下载打印驱动直接打印,打出来没问题,回家后我上论坛翻看以前提出的相同问题,用pdf格式导出,发现预览效果与导出的字体不符,没那么好看!
[此贴子已经被作者于2024/3/12 17:31:54编辑过]

 回到顶部