Add custom image to Ranorex report

Ask general questions here.
Test Monkey
Posts: 2
Joined: Mon Aug 03, 2009 3:13 pm
Location: Austria

Add custom image to Ranorex report

Post by Test Monkey » Tue Aug 04, 2009 12:19 pm

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>

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Add custom image to Ranorex report

Post by Support Team » Tue Aug 04, 2009 12:35 pm

Hi,
there`s already a forum post about this issue:
http://www.ranorex.com/forum/report-bitmap-t947.html

Regards,
Christian
Ranorex Support Team

Test Monkey
Posts: 2
Joined: Mon Aug 03, 2009 3:13 pm
Location: Austria

Re: Add custom image to Ranorex report

Post by Test Monkey » Tue Aug 04, 2009 1:13 pm

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?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Add custom image to Ranorex report

Post by Support Team » Wed Aug 05, 2009 8:55 am

Hi,
at the moment, still no.
But we have added that issue to our feature request list.

Regards,
Christian
Support Team

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Add custom image to Ranorex report

Post by Support Team » Wed Aug 05, 2009 10:56 am

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

Troels
Posts: 2
Joined: Wed Feb 25, 2015 11:22 am

Re: Add custom image to Ranorex report

Post by Troels » Wed Feb 25, 2015 11:28 am

Has this feature been implemented yet in Ranorex version 5.3.0, or should I still use the workaround ?
Best Regards
Troels Madsen

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Add custom image to Ranorex report

Post by Support Team » Thu Feb 26, 2015 11:41 am

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)

Troels
Posts: 2
Joined: Wed Feb 25, 2015 11:22 am

Re: Add custom image to Ranorex report

Post by Troels » Thu Feb 26, 2015 11:53 am

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));
Best Regards
Troels Madsen