Set report image from image variable type

Stimulsoft Reports.JS discussion
Post Reply
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Set report image from image variable type

Post by mrapi »

Hi
In .Net 4 I can set image from image variable type, like that:

Code: Select all

Dim wRp As New StiReport
wRp("wImg") = Image.FromFile(path+ "img.jpg")
now I need the same but in js(using v.2020.4.2),tried

Code: Select all

 this.report.dictionary.variables.getByName('wImg').valueObject = Stimulsoft.System.IO.Http.getFile("img.jpg", true); //file exists in wwwroot
there is no error in console but no image is shown
thanks
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set report image from image variable type

Post by HighAley »

Hello.

Please, try to specify the full URL.

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Set report image from image variable type

Post by mrapi »

Hi,not working with full URL
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set report image from image variable type

Post by HighAley »

Hello,

What is the type of the variable?
Please, try to add the resource file instead.

Code: Select all

var fileContent = Stimulsoft.System.IO.File.getFile("../reports/Stimulsoft.ttf", true);
var resource = new Stimulsoft.Report.Dictionary.StiResource("Stimulsoft", "Stimulsoft font", false, Stimulsoft.Report.Dictionary.StiResourceType.FontTtf, fileContent);
report.dictionary.resources.add(resource);
Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Set report image from image variable type

Post by mrapi »

seems that way works:

Code: Select all

 const fileContent = Stimulsoft.System.IO.Http.getFile("imgs/stampMail.jpg", true); // path exists in wwwroot
          const resource = new Stimulsoft.Report.Dictionary.StiResource("stampMail", "stampMail", false, Stimulsoft.Report.Dictionary.StiResourceType.Image, fileContent);
          this.report.dictionary.resources.add(resource);

          const stiImage = this.report.getComponentByName("Image3");
          stiImage.imageURL = "resource://stampMail" 
thanks
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set report image from image variable type

Post by HighAley »

Hello.

We are always glad to help you.

Thank you.
Post Reply