Reputation: 380
I've got a function that help me to create a report with XtraReport from DevExpress (v17.2). The reports are created programatically based on some other data sent by the client, so I've got several templates for each of the cases my app support.
My function is creating and populating correctly the report templates, so I can present the document in the client, but I need to add some watermark conditionally.
I added the watermark to one of the report and it worked fine, but as there are many of them I'd rather prefer and might be more convenient for maintenance reasons to added it globally, I did this:
Default.aspx.cs
void Page_Load()
{
AspxDocumentViewer docViewer;
...
docViewer.Report = GetSpecificReport(...);
// Here I try to add the watermark via some other function
SetWaterMark(docViewer.Report, someImageIRetrieve);
// When I debug the code after setting the watermark it shows what I've set.
}
private void SetWatermark(XtraReport report, System.Drawing.Image watermarkImage)
{
var waterMark = new XRWatermark();
waterMark.Image = watermarkImage;
waterMark.ImageTiling = true;
waterMark.ImageTransparency = 200;
waterMark.ShowBehind = false;
report.Watermark.CopyFrom(waterMark);
}
I've sort of summarised the code, if any other info is required for extending the context, please let me know and I'll update the question. Thanks in advance.
Upvotes: 0
Views: 1083
Reputation: 502
if you're using the ASPxDocumentViewer , so plz try to use the modern html5 viewer ASPxWebDocumentViewer so you will see the watermark
Upvotes: 1