Show Watermark on selected Pages

Stimulsoft Reports.NET discussion
Post Reply
vorauler
Posts: 71
Joined: Wed Jul 15, 2009 1:20 am

Show Watermark on selected Pages

Post by vorauler »

Hello

I would show a watermark on selected pages on a report.
For that I use the BeforPrint event of the page object.

Code: Select all

Page1.Watermark.Enabled = Insurant.ShowWatermark;
Page1.Watermark.Text = Insurant.WatermarkText
The simplified code for printing is

Code: Select all

private void PrintReport()
{
   var data = new List();
   data.Add(new ReportPrintValue { Nachname = "Person1", Vorname = "Test", ShowWatermark = true, WatermarkText = "Person1 Watermark" });
   data.Add(new ReportPrintValue { Nachname = "Person2", Vorname = "Test", ShowWatermark = false });
   data.Add(new ReportPrintValue { Nachname = "Person3", Vorname = "Test", ShowWatermark = false });
   data.Add(new ReportPrintValue { Nachname = "Person4", Vorname = "Test", ShowWatermark = false });
   data.Add(new ReportPrintValue { Nachname = "Person5", Vorname = "Test", ShowWatermark = true, WatermarkText = "Person5 Watermark" });
   data.Add(new ReportPrintValue { Nachname = "Person6", Vorname = "Test", ShowWatermark = false });
   data.Add(new ReportPrintValue { Nachname = "Person7", Vorname = "Test", ShowWatermark = false });
   StiReport report = new StiReport();
   report.Load(Application.StartupPath + @"\\Watermark.mrt");

   report.Compile();
   report.RegData("Insurant", data);
   report.ShowWithRibbonGUI();
}

class ReportPrintValue
{
   public string Nachname { get; set; }
   public string Vorname { get; set; }
   public bool ShowWatermark { get; set; }
   public string WatermarkText { get; set; }
}
Now I thought I get a watermark on page1 and page5, but I get a watermark on page1, page2 and page6.

Can I use the watermark for my purposes or is there an other procedure to achive this?

Ralf
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Show Watermark on selected Pages

Post by Brendan »

Do you get the behaviour you want if you use the Page Rendering event instead of the BeforePrint event?
vorauler
Posts: 71
Joined: Wed Jul 15, 2009 1:20 am

Show Watermark on selected Pages

Post by vorauler »

Thank you. This solved my problem.

Ralf
Post Reply