打印预览
Posted xiehaofeng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了打印预览相关的知识,希望对你有一定的参考价值。
1 Sub Browse_Click() 2 ‘打印信息 3 Dim columnCount As Integer ‘列数 4 Dim rowCount As Integer ‘行数 5 columnCount = getColumnCount(XsXxSheet) 6 rowCount = Application.CountA(ActiveSheet.Range("B:B")) 7 If rowCount = 0 Then 8 MsgBox ("没有数据,无需打印!") 9 Exit Sub 10 End If 11 If rowCount = 1 Then 12 MsgBox ("没有数据,无需打印!") 13 Exit Sub 14 End If 15 16 Worksheets("学生信息打印模板").Visible = True 17 ‘弹出打印提示窗口 18 ‘循环1--行 19 For ro = 2 To 2 20 ‘循环2--列 填写学生模板信息-->生成新的Excel 21 For col = 1 To columnCount 22 Title = Sheets(XsXxSheet).Cells(1, col) 23 If Title <> "" Then 24 Dim content As String 25 content = Sheets(XsXxSheet).Cells(ro, col) 26 Dim exl As TypeValueCell 27 exl.cellName = Title 28 exl.cellContent = content 29 aa = fileXsExportModel(exl) 30 End If 31 Next col 32 Next ro 33 Worksheets("学生信息打印模板").PrintPreview 34 ‘清空模板 35 For col = 1 To columnCount 36 Title = Sheets(XsXxSheet).Cells(1, col) 37 If Title <> "" Then 38 Dim content2 As String 39 content2 = Sheets(XsXxSheet).Cells(2, col) 40 Dim exl2 As TypeValueCell 41 exl2.cellName = Title 42 exl2.cellContent = content1 43 bb = clearXsExportModel(exl2) 44 End If 45 Next col 46 Worksheets("学生信息打印模板").Visible = False 47 End Sub
以上是关于打印预览的主要内容,如果未能解决你的问题,请参考以下文章
c# winform 打印groupbox内容打印预览显示不全