Page 1 of 1

Set report image from image variable type

Posted: Fri Nov 27, 2020 5:27 pm
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

Re: Set report image from image variable type

Posted: Mon Nov 30, 2020 12:55 pm
by HighAley
Hello.

Please, try to specify the full URL.

Thank you.

Re: Set report image from image variable type

Posted: Mon Nov 30, 2020 2:37 pm
by mrapi
Hi,not working with full URL

Re: Set report image from image variable type

Posted: Thu Dec 03, 2020 8:07 am
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.

Re: Set report image from image variable type

Posted: Thu Dec 03, 2020 10:20 am
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

Re: Set report image from image variable type

Posted: Thu Dec 03, 2020 8:16 pm
by HighAley
Hello.

We are always glad to help you.

Thank you.