Page 1 of 1

Add custom image to Ranorex report

Posted: Tue Aug 04, 2009 12:19 pm
by Test Monkey
Hi,

I would like to add an external screen shot to the report. The BMP file is stored in the same directory as the report and now it should be shown in the report. Unfortunally the report does not allow plain html code in the report, so what can I do to include an external image?

Thanks for the help.
Report.Log(ReportLevel.Info,"ScreenShot","<img src='" + " pathToImage + "'/>");
will result in

Code: Select all

<message time="2009/08/04 13:07:07.025" level="INFO" category="ScreenShot">
<![CDATA[<img src='D:\pathToProject\bin\Debug\image.bmp'/>]]><br/>
</message>

Re: Add custom image to Ranorex report

Posted: Tue Aug 04, 2009 12:35 pm
by Support Team
Hi,
there`s already a forum post about this issue:
http://www.ranorex.com/forum/report-bitmap-t947.html

Regards,
Christian
Ranorex Support Team

Re: Add custom image to Ranorex report

Posted: Tue Aug 04, 2009 1:13 pm
by Test Monkey
Sorry, I have missed that post. Thanks for the link.

:?: Another question:
Is there a possibility to inject html code like links in the report, e.g. to referr to other files?

Re: Add custom image to Ranorex report

Posted: Wed Aug 05, 2009 8:55 am
by Support Team
Hi,
at the moment, still no.
But we have added that issue to our feature request list.

Regards,
Christian
Support Team

Re: Add custom image to Ranorex report

Posted: Wed Aug 05, 2009 10:56 am
by Support Team
Hello!

As a workaround for now you can also append your html code in the report file like that:
string logFileName = "Test.rxlog";
Report.Setup(ReportLevel.Info, logFileName, true);
string fileName= logFileName + ".tmp";  
File.AppendAllText (fileName, "<message level='INFO' category='User'><a href='MyPic.bmp'><img src='MyPic.bmp' alt='Screenshot'/></a></message>");
As long as the Report.End method isn`t called, the report is written to a ".tmp" file. That's why you need to append the ".tmp" to your log file name if you want to access the current log file.

Regards,
Mhosen
Support Team

Re: Add custom image to Ranorex report

Posted: Wed Feb 25, 2015 11:28 am
by Troels
Has this feature been implemented yet in Ranorex version 5.3.0, or should I still use the workaround ?

Re: Add custom image to Ranorex report

Posted: Thu Feb 26, 2015 11:41 am
by Support Team
Hi Troels,

You can use the following method to Report a link which refers to a file.
Report.Link(@"C:\PATHTOFILE\FILE.EXTENSION");
This method was introduced with Ranorex 5.3. Please find more information about this version in our release notes.

Regards,
Markus (S)

Re: Add custom image to Ranorex report

Posted: Thu Feb 26, 2015 11:53 am
by Troels
Actually I just found out that this command did what I was looking for

Code: Select all

Report.LogData(ReportLevel.Info,"Wave capture", Ranorex.Imaging.Load(image.png));