Farpoint Spread的Sheet打印,通过调用SpreadPrintBackground事件,处理PrintBackgroundEventArgs参数的Graphics来添加水印,在对同一个Spread Sheet调用多次时,之前的水印设置一直存在,请问各位版主,如何在本次调用的时候把上次的水印清除,或者有其他方法来实现水印的打印,以下是部分代码共参考:
- Private Sub SpreadPrintBackground(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintBackgroundEventArgs)
- Dim maskStr As String = String.Empty
- If (txtPrintMask.Text = "") Then
- maskStr = "系统打印"
- Else
- maskStr = txtPrintMask.Text.Replace("/ds", Now.ToShortDateString()).Replace("/tl", Now.ToLongTimeString()).Replace("/st", "PRINT").Replace("/un", UserName)
- End If
- gMask = e.Graphics
- gMask.TranslateTransform(100, 0)
- gMask.RotateTransform(IIf(rbLandscape.Checked, 35, 55), Drawing2D.MatrixOrder.Prepend)
- gMask.DrawString(maskStr, New Font("Arial", 72, FontStyle.Bold), New SolidBrush(Color.FromArgb(64, Color.Black)), 0, 0)
- End Sub
复制代码
打印方法:
- Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click
- loadPrintSet()
- printSet.Preview = True
- Spread.ActiveSheet.PrintInfo = printSet
- Spread.PrintSheet(0)
- End Sub
复制代码
打印出来的效果:
20140928104553.jpg
(88.87 KB, 下载次数: 213)
|
|