'forms("客户报价窗口").controls("RadioButton2").checked = True
Tables("客户报价窗口_Table1").AutoSizeRows()
Dim path As String = Tables("客户报价表").Current("报价信息_文件路径")
'Dim path As String = ProjectPath & e.Form.Controls("ComboBox4").Text '不添加固定文件夹
If FileSys.DirectoryExists(path) = False
filesys.CreateDirectory(path)
End If '只是添加文件夹
Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "PDF文件|*.xlsx" '设置筛选器
'dlg.InitialDirectory = "自己指定的保存目录"
dlg.InitialDirectory = Tables("客户报价表").Current("报价信息_文件路径")
dlg.FileName = Tables("客户报价表").current("客户信息_客户名称") & Tables("客户报价表").current("客户信息_负责采购") & Tables("客户报价表").current("报价单号") & ".xlsx"
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
vars("p") = True
Tables("客户报价窗口_Table1").Refresh
e.Form.Page.Width =297 '纸张宽度为100毫米
e.Form.Page.Height =210'纸张高度为120毫米
e.Form.Page.LeftMargin = 10 '设置左边距
e.Form.Page.RightMargin = 0 '设置右边距
e.Form.Page.TopMargin = 20 '设置上边距
e.Form.Page.BottomMargin = 20 '设置下边距
Dim grp As WinForm.GroupBox = e.Form.Controls("GroupBox1")
Dim doc As PrintDoc = e.Form.GernatePrintDoc(grp)
Dim rar As new prt.RenderArea
rar.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Dim rm As prt.RenderImage
rm = New prt.RenderImage '创建一个图片
rm.Width = 15 '宽度等于页面宽度
rm.Height = 15 '高度由图片大小自动决定
rm.Image = GetImage("匹士克logo.png")
rm.x = 121
rm.y = 0
Dim ra As New prt.RenderText '设置文本对象的内容
ra.Text = e.Form.Controls("Label13").text
ra.Style.font = New Font("宋体", 8)
ra.Style.TextAlignHorz = prt.AlignHorzEnum.right
ra.Style.TextAlignVert =prt.AlignVertEnum.Bottom
ra.Style.Borders.Bottom = New prt.LineDef(1, Color.Black) '设置底边框
ra.Style.Padding.Bottom = 2 '底端内容缩进0.5毫米
ra.Style.FontSize = 12 '字体大小为8磅
ra.Height = 10
Dim rt As New prt.RenderText '设置文本对象的内容
'rt.Text = "第[PageNo]页,共[PageCount]页" '设置文本内容
rt.Text = "page [PageNo] of [PageCount]" '设置英文文本内容
rt.Style.font = New Font("宋体", 8)
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '靠右对齐
rt.Style.Borders.Top = New prt.LineDef(1, Color.Black) '设置底边框
rt.Style.Padding.Top = 0.5 '底端内容缩进0.5毫米
rt.Style.FontSize = 14 '字体大小为8磅
rt.Height = 15
rar.Children.Add(rm) '加入图片到RenderArea中
rar.Children.Add(ra) '加入文本到RenderArea中
Doc.Pageheader = rar '作为页眉使用
Doc.PageFooter = rt '作为页眉使用
doc.PageSetting.Landscape = True '横向打印
'设置页眉
doc.SavePDF(dlg.FileName)
Dim Proc As New Process '打开PDF文件
Proc.File = (dlg.FileName)
Proc.Start() '预览pdf内容
'doc.Preview() '预览
End If
vars("p") = False
Tables("客户报价窗口_Table1").Refresh