If p.Value <> "默认" Then
Dim r As Row = Tables("纸张设置表").current
if r isnot nothing then '必须判断是否有当前行,比如表格没有行的时候
e.form.page.LeftMargin = r("左边距")
e.form.page.RightMargin = r("右边距")
e.form.page.BottomMargin = r("下边距")
e.form.page.TopMargin = r("上边距")
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Doc.PrinterName = p.value
Doc.Print
e.Form.close
end if
End If