Image not load properly on report.

Stimulsoft Reports.NET discussion
Post Reply
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Image not load properly on report.

Post 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
testPrj.rar
(84.87 KiB) Downloaded 285 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Image not load properly on report.

Post 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.
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Re: Image not load properly on report.

Post 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);
Last edited by roomy on Tue Feb 18, 2014 7:35 am, edited 1 time in total.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Image not load properly on report.

Post 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.
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Re: Image not load properly on report.

Post 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??
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Image not load properly on report.

Post 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.
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Re: Image not load properly on report.

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Image not load properly on report.

Post 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.
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Re: Image not load properly on report.

Post by roomy »

Thanks Aleksey.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Image not load properly on report.

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply