[]
        
(Showing Draft Content)

Adding a Watermark to a Printed Page

You can print a background image or a watermark when the spreadsheet is printed.

Set the PrintBackground event to fire when printing, and specify the graphic with the PrintBackground event, and the opacity with the PrintInfo.Opacity property, so the printing of the spreadsheet has no watermark if opacity is highest (transparency is lowest) and shows the watermark through the spreadsheet if the opacity is low (transparency is high).

Using Code

Use the PrintInfo object to specify the opacity for printing a watermark.

Example

This example shows how to print a watermark.

private void fpSpread1_PrintBackground(object sender, FarPoint.Win.Spread.PrintBackgroundEventArgs e)
{
    FarPoint.Win.Picture pic = new FarPoint.Win.Picture(System.Drawing.Image.FromFile("D:\\Files\\cover.jpg"), FarPoint.Win.RenderStyle.Normal);
    pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Left;
    pic.AlignVert = FarPoint.Win.VerticalAlignment.Top;
    pic.Paint(e.Graphics, e.SheetRectangle);
}
    

private void button1_Click(object sender, System.EventArgs e)
{
    FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
    pi.Opacity = 100;
    fpSpread1.ActiveSheet.PrintInfo = pi;
    fpSpread1.PrintSheet(0);
}
Private Sub fpSpread1_PrintBackground(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintBackgroundEventArgs) Handles FpSpread1.PrintBackground
    Dim pic As New FarPoint.Win.Picture(Image.FromFile("D:\Files\cover.jpg"), FarPoint.Win.RenderStyle.Normal)
    pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Left
    pic.AlignVert = FarPoint.Win.VerticalAlignment.Top
    pic.Paint(e.Graphics, e.SheetRectangle)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim pi As New FarPoint.Win.Spread.PrintInfo()
    pi.Opacity = 100
    fpSpread1.ActiveSheet.PrintInfo = pi
    fpSpread1.PrintSheet(0)
End Sub

See Also

Understanding the Printing Options

Customizing the Print Job Settings

Customizing the Printed Page Layout

Customizing the Printed Page Header or Footer

Customizing the Print Preview Dialog

Repeating Rows or Columns on Printed Pages

Adding a Page Break