Hi,
(VS2010 c# .NET 4 for Winfrom)
I know how to change the text from my application, Frist I create new variable of string from Dictionary, then I can change it with my application.
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
...
So it is OK.
But I want to change images from my application or from file, I made a image component from Stimulsoft Designer Tools, Then made image variable named MyImage. So ImageData is {MyImage}, Edit Variable: Name:MyImage, Alias:MyImage,Type:image,value.
Then my code is,
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep["MyImage"] = image; //Wrong here;
stiViewerControl1.Report = rep;
rep.Render();
Or
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep.Compile();
rep["MyImage"] = image; //Wrong here;
rep.Show();
I compile both my code, there are wrong, rep["MyImage"] = image; "Stimulsoft.Report.Components.StiImage" object can not change to "System.Drawing.Image".
So, please help me, thanks.
How can I change my application Images?
How can I change my application Images?
I solved this problem,
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
System.Drawing.Image img = System.Drawing.Image.FromFile("pic01.jpg");
rep["MyImage"] = img; //It is ok now.
stiViewerControl1.Report = rep;
rep.Render();
But I still don't understand. Why can't I use StiImage image = new StiImage(); image.Image = Image.FromFile("pic01.jpg"); ?
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
System.Drawing.Image img = System.Drawing.Image.FromFile("pic01.jpg");
rep["MyImage"] = img; //It is ok now.
stiViewerControl1.Report = rep;
rep.Render();
But I still don't understand. Why can't I use StiImage image = new StiImage(); image.Image = Image.FromFile("pic01.jpg"); ?
How can I change my application Images?
Hello.
Therefore you previous code didn't work properly.
Thank you.
If you'd look in our Class Reference you'll see that StiImage.Image Property is a System.Drawing.Image type.nathanma wrote:But I still don't understand. Why can't I use StiImage image = new StiImage(); image.Image = Image.FromFile("pic01.jpg"); ?
Therefore you previous code didn't work properly.
Thank you.