Page 1 of 1
Image not load properly on report.
Posted: Mon Feb 17, 2014 7:47 am
by roomy
I have an image control in databand. When I attach my xml and xsd to report template it shows the image.
But if I call and load data with c# code image are not on report.
I have try to create a demo. it may help u to understand the issue.
Thank You
Re: Image not load properly on report.
Posted: Mon Feb 17, 2014 11:32 am
by Alex K.
Hello,
Please check your code. In your code you do not load report. You create a empty report, pass data and show empty report.
Thank you.
Re: Image not load properly on report.
Posted: Tue Feb 18, 2014 5:25 am
by roomy
Yes, I need to describe more about issue. I have the code line report.Load(TemplatePath); in my code and I find images on my report pdf.
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
StiReport report = new StiReport();
DataSet ds = new DataSet();
report.Load(@"D:\testPrj\Test.mrt");
report.Dictionary.Clear();
DataTable dt = new DataTable("Test");
dt.Columns.Add("ID");
dt.Columns.Add("ImagePath");
DataRow dr ;
dr= dt.NewRow();
dr["ID"] = "1";
dr["ImagePath"] = @"D:\testPrj\Test.jpg";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["ID"] = "2";
dr["ImagePath"] = @"D:\testPrj\Test1.jpg";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["ID"] = "3";
dr["ImagePath"] = @"D:\testPrj\Test2.jpg";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
report.RegData(ds);
report.Dictionary.Synchronize();
report.Compile();
report.Render();
report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, @"D:\testPrj\Test.pdf");
}
- Test.mrt
- (6.85 KiB) Downloaded 320 times
But if I try the same code in my actual project which get the server path for image like (\\192.160.90.1\\User\\[ImageName]) it does not work.
dataSet.ReadXml(DataFilePath);
report.Load(templatePath);
report.Dictionary.Clear();
report.RegData("New Connection", "new", dataSet);
report.Dictionary.Synchronize();
report.Compile();
report.Render();
report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, ServerPath);
Re: Image not load properly on report.
Posted: Tue Feb 18, 2014 6:46 am
by Alex K.
Hello,
If you run your project on the server, that the path to image gets from the server. This image should be placed on the server in the "D:\testPrj" folder.
Re: Image not load properly on report.
Posted: Tue Feb 18, 2014 7:58 am
by roomy
I am not able to load server images on stimulsoft report, there is any path related issue??
problem with server relative paths for images??
Re: Image not load properly on report.
Posted: Tue Feb 18, 2014 10:46 am
by Alex K.
Hello,
Well, actually, that's right. If you run the report on the server then the paths are taken on the server.
Re: Image not load properly on report.
Posted: Tue Feb 18, 2014 12:17 pm
by roomy
Thanks to confirm this.
Then How can i link my dynamicly created images with reports and these image files are exist outside the application folder on server.
Re: Image not load properly on report.
Posted: Wed Feb 19, 2014 11:08 am
by HighAley
Hello.
roomy wrote:Then How can i link my dynamicly created images with reports and these image files are exist outside the application folder on server.
You could try to add images to DataSet as Byte Array and register this DataSet in your report.
Also you should set the Data Column property of the Image component instead of the Image URL.
Thank you.
Re: Image not load properly on report.
Posted: Thu Feb 20, 2014 9:51 am
by roomy
Thanks Aleksey.
Re: Image not load properly on report.
Posted: Thu Feb 20, 2014 11:50 am
by HighAley
Hello.
We are always glad to help you.
Let us know if you need any additional help.
Thank you.