Page 1 of 1

Extending Reports before Rendering

Posted: Tue Apr 07, 2009 11:20 pm
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

Extending Reports before Rendering

Posted: Wed Apr 08, 2009 12:13 am
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.

Extending Reports before Rendering

Posted: Wed Apr 08, 2009 3:11 am
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.

Extending Reports before Rendering

Posted: Wed Apr 08, 2009 3:35 am
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();

Extending Reports before Rendering

Posted: Wed Apr 08, 2009 4:20 am
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.

Extending Reports before Rendering

Posted: Thu Apr 09, 2009 8:43 am
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 :)