Extending Reports before Rendering

Stimulsoft Reports.NET discussion
Post Reply
zreptil
Posts: 18
Joined: Tue Aug 19, 2008 1:17 am

Extending Reports before Rendering

Post by zreptil »

Hi,

is it possible to extend a report after loading and before rendering? I have to place an emf-stream in a form after loading the mrt-file. This has to be done by the program, not using the designer. Is there a possibility to do this?

thanks in advance
Andi
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Extending Reports before Rendering

Post by Jan »

Hello Andi,
zreptil wrote: is it possible to extend a report after loading and before rendering? I have to place an emf-stream in a form after loading the mrt-file. This has to be done by the program, not using the designer. Is there a possibility to do
For example:

Code: Select all

report.Load("report.mrt");
Image image = report.GetComponentByName("Image1") as StiImage;
image.Image = image123;

report.Render();
Thank you.
zreptil
Posts: 18
Joined: Tue Aug 19, 2008 1:17 am

Extending Reports before Rendering

Post by zreptil »

Hi Jan,

thanks for the quick reply. Unfortunately this doesn't help with my problem. I need to know how to place an emf-stream as a new component in a report. this has to be done so that the emf covers the whole page and lies in the background. i thought about something like this:

stream contains the emf.

report.Load("report.mrt");
StiImage img = new StiImage();
img.GetImageFromStreamOrSimilarMethod(stream);
report.InsertImageAsBackground(img);
report.Render();

in this example i need to know the correct Methodnames for GetImageFromStreamOrSimilarMethod and InsertImageAsBackground.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Extending Reports before Rendering

Post by Brendan »

You could use the Watermark property of a report page. This way the image will be in the background for the entire page.

Something like:

Code: Select all

report.Load("report.mrt");

Stimulsoft.Report.Components.StiPage page = report.Pages[0];
page.Watermark.Image = emfImage;
//page.Watermark.ImageStretch = true;
//page.Watermark.AspectRatio = true;

report.Render();
zreptil
Posts: 18
Joined: Tue Aug 19, 2008 1:17 am

Extending Reports before Rendering

Post by zreptil »

Hi Brendan,

thanks for the reply. But this is not enough for my needs. I need to place more emf-streams in the background of the report. The watermark can only contain one image. So i think i have to add an image to the components of the page.
zreptil
Posts: 18
Joined: Tue Aug 19, 2008 1:17 am

Extending Reports before Rendering

Post by zreptil »

At last i found a way to have an emf-stream in my report.

StiPage page = _report.Pages[0];
StiImage img = new StiImage();
img.Image = StiImageConverter.BytesToImage(StiMetafileConverter.MetafileToBytes(new System.Drawing.Imaging.Metafile(emfStream)));
img.Left = 0;
img.Top = 0;
img.Width = page.Width;
img.Height = page.Height;
img.Name = string.Format("Emf{0}", page.Components.Count);
img.Parent = page;

page.Components.Insert(0, img);

This does the job :)
Post Reply