How can I manipulate a image right before rendering in report?

Stimulsoft Ultimate discussion
Post Reply
hamidx5
Posts: 1
Joined: Sun Mar 06, 2011 9:13 am

How can I manipulate a image right before rendering in report?

Post by hamidx5 »

Hi.
For some reasons I have to manipulate first 4 bytes of my images right before they show up on my report!
I write following class and add its complied dll to my report and reference it.
Here is my actual problem:
There is no "Expression" section in Image control. Image control uses Data Column with help of Data Source.
What can I do to overcome this problem?

I manipulate generated code and call my method such like below code but nothing happend!

public virtual byte[] B_Picture
{
get
{
return ((byte[])(ImageUtility.ManipulatePic((StiReport.ChangeType(this["B_Picture"], typeof(byte[]), true))));
}
}

Why every time I preview a report my above changed code disappear!?

I am in extra time.please help me as soon as possible.
Thanks in advance.


------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;


namespace ImageUtility
{
public class ImageUtility
{
public byte[] ManipulatePic(byte[] rawByte)
{
var image= new byte[rawByte.Length];
for (var i = 0; i < rawByte.Length - 4; i++)
{
image = rawByte[i + 4];
}

return image;

}

}
}
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How can I manipulate a image right before rendering in report?

Post by Jan »

Hello,
hamidx5 wrote:Hi.
For some reasons I have to manipulate first 4 bytes of my images right before they show up on my report!
I write following class and add its complied dll to my report and reference it.
Here is my actual problem:
There is no "Expression" section in Image control. Image control uses Data Column with help of Data Source.
What can I do to overcome this problem?
You can use ImageData expression of image component. For example:

Code: Select all

{Image.LoadFrom(stream)}
Also you can use BeforePrintEvent of image component. For example:

Code: Select all

image1.Image = myImage;
Thank you.
Post Reply