Modify Ranorex Report Format

Ask general questions here.
vikram_u_k
Posts: 15
Joined: Tue Mar 15, 2016 12:16 pm

Modify Ranorex Report Format

Post by vikram_u_k » Wed Mar 30, 2016 8:26 am

Hi All,
the Link lists the changes in the StyleSheet for PDF reports.
http://www.ranorex.com/blog/ranorex-rep ... onversion/

it is required to add the User/Logged In User name in the PDF file.

Could any pointers be added on how to add this Information into the ReportToPDF() method.

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Modify Ranorex Report Format

Post by Martin » Wed Mar 30, 2016 2:13 pm

Code: Select all

string Username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
or

Code: Select all

string Username = Environment.UserName;
If you're on a network the 1st one will return also the network name (e.g NetworkName\UserName)
Second one will return only the username.

From there on do what ever you like with the string value.

Edit: Also it seems that report files already contain the username by default in the "activity" tag (in .data file) so it's more or less displaying it.

You can achive this by adding the following code to the RanorexReport5.xsl or any other custom stylesheet:

Code: Select all

<td>
          <i class="field">
            User name <b>
              <xsl:value-of select="@user"/>
            </b>
          </i>
        </td>

User avatar
RobinHood42
Posts: 239
Joined: Fri Jan 09, 2015 3:24 pm

Re: Modify Ranorex Report Format

Post by RobinHood42 » Thu Mar 31, 2016 1:07 pm

Hi guys,

I'm afraid that you mixed something up here. It is not possible to log custom fields to the Ranorex PDF report. I guess if you want to add that as a feature request, you should contact [email protected] directly.

Hope this helps,
Robin