anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
528 stars 318 forks source link

How to add image (Logo) to the extent Report - 2.4 #209

Closed cybkishor closed 8 years ago

cybkishor commented 8 years ago

How to add image (Logo) to the extent Report - 2.4

cybkishor commented 8 years ago

i wanted to add the company logo to the report, please guide me.

cybkishor commented 8 years ago

Please suggest

anshooarora commented 8 years ago

You can use js in your config file to load the image and use styles to make it fit inside the headline area.

cybkishor commented 8 years ago

Still i am not able to see the image , can you please pass the sample code here , i have a demo tomorrow ..

On Tue, Dec 15, 2015 at 9:36 PM, Anshoo Arora notifications@github.com wrote:

You can use js in your config file to load the image and use styles to make it fit inside the headline area.

— Reply to this email directly or view it on GitHub https://github.com/anshooarora/extentreports/issues/209#issuecomment-164809490 .

Regards, Kishorkumar Naik

cybkishor commented 8 years ago

i can see this

(#54) New feature request - User should have the option to add the Product Logo into extent report

Please suggest how to do this.

On Wed, Dec 16, 2015 at 4:16 AM, Kishor Naik cybkishor@gmail.com wrote:

Still i am not able to see the image , can you please pass the sample code here , i have a demo tomorrow ..

On Tue, Dec 15, 2015 at 9:36 PM, Anshoo Arora notifications@github.com wrote:

You can use js in your config file to load the image and use styles to make it fit inside the headline area.

— Reply to this email directly or view it on GitHub https://github.com/anshooarora/extentreports/issues/209#issuecomment-164809490 .

Regards, Kishorkumar Naik

Regards, Kishorkumar Naik

cybkishor commented 8 years ago

String css = ".report-name { padding-left: 10px; } .report-name > img { float: left;height: 90%;margin-left: 30px;margin-top: 2px;width: auto; }";

extent.config() .reportName("") .insertCustomStyles(css);

this does not work in 2.4

anshooarora commented 8 years ago

That is for the older versions.. but with 2.40, you can use the css string and paste it (without quotes) under the styles tag of configuration file. In the `reportName' tag, add path of your image:


<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
    <configuration>
        <!-- document encoding -->
        <encoding>UTF-8</encoding>

        <!-- title of the document -->
        <documentTitle>Custom</documentTitle>

        <!-- report name - displayed at top-nav -->
        <reportName>
            <![CDATA[
                <img src='your-image-path' />
            ]]>
        </reportName>

        <!-- report headline - displayed at top-nav, after reportHeadline -->
        <reportHeadline></reportHeadline>

        <!-- custom javascript -->
        <scripts>
            <![CDATA[
                $(document).ready(function() {

                });
            ]]>
        </scripts>

        <!-- custom styles -->
        <styles>
            <![CDATA[
                .report-name { padding-left: 10px; } .report-name > img { float: left;height: 90%;margin-left: 30px;margin-top: 2px;width: auto; }
            ]]>
        </styles>
    </configuration>
</extentreports>
Novatu commented 7 years ago

Hi anshoo ,

i used your above js code but still i couldnt see my logo in report .

please find the below xml file

<?xml version="1.0" encoding="UTF-8"?>

standard UTF-8 https RAFT_Report 2.0 ]]> Talent Recruit yyyy-MM-dd HH:mm:ss img { float: left;height: 90%;margin-left: 30px;margin-top: 2px;width: auto; } ]]>
Novatu commented 7 years ago

And also i want to make the black Background as a default for my report .

I used the above code but its not reflecting in output.

Could you please help me in these both issues.

savvyaxnjxn commented 7 years ago

@Novatu - I also like the 'dark' background as my default. I use an extent.xml config file as described here:

524 and #541

Other report config options are available if you search around or follow those links much as you appear to have already used in your own posted example although I don't have anything to help you with concerning your logo at this time - good luck!

RDNShakya commented 7 years ago

Hello Anshoo,

How can I add a logo (an image) to extend report version 3.0.2 ???

Thank you!

anshooarora commented 7 years ago

Yes, depending on where you want to place it, you can:

hemmarkit14 commented 7 years ago

Hi Anshoo,

I am not able to add company logo , have added js and image tag

Please find the below xml file

<?xml version="1.0" encoding="UTF-8"?>

dark UTF-8 https Sample CATS ExtentReports ]]> CATS TEST AUTOMATION yyyy-MM-dd HH:mm:ss img { float: left;height: 90%;margin-left: 120px;margin-top: 2px;width: auto; } ]]>

Please tell what else need's to be done

dsathishupm commented 7 years ago

HI ALL, here the code to hide and showing some text instead of ExtendReport link,

sathish

sathish2

add ur config file..

nirmalapsn214 commented 7 years ago

Hi Satish, The above response is quite interesting. Thank you! I have a requirement where the dashboard alone should be copy pasted into email body or attached to email and save the entire report along with screenshots to a network shared folder and provide that link in the email body.

I don't find a way to hide the log part or generate dashboard and logs separately. Could you please throw some light if you have any relevant info?