why htmlcomponent on server looks different than in iReport?

Hello.

I want to generate a report with an html component.

If I compile it in iReport, the html component looks nice

(Description is a static text field; the html component is what you see in the right hand side):

 

BUT, if i compile from my server application, the html component appears all shrinked in the top left corner of the field:

 

 

The server application refers to the libraries:

jasperreports-4.7.1.jar

jasperreports-fonts-4.7.1.jar

htmlcomponent.jar

 

Can someone help on this?

Thank you!

Carlo

carlogenohm's picture
Joined: May 15 2012 - 5:18am
Last seen: 1 year 1 month ago

3 Answers:

Check the output with Firebug. I think that it may be related on the CSS and Styles that are in the server.

Can you share the HTML that you are using insife the HTML component? 

marianol's picture
16194
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 7 months ago
About Firebug. While developing, I am running the application in the eclipse environment. And the report is exported to a pdf. could I check the CSS or styles directly from Eclipse?
carlogenohm - 10 years 6 months ago
Ok That changes everything..... I assumed that you where exporting as HTML from your server app. If it's a PDF is should be exactly the same as the PDF that iReport Exported, are you using ireport 4.7.1?
marianol - 10 years 6 months ago
Hi, no, I was using iReport 4.5.1 Now I checked that: - if I use iReport 4.7.1, I obtain in the preview the "wrong version", as in the export to pdf java application - so I went back to iReport 4.5.1, where the preview is correct. - but if i use jasper libraries 4.5.1 (also htmlcomponent.jar compiled from the 4.5.1 package) again i get the wrong result. Summarizing: - 4.7,1 gives wrong result in both iReport and Java application - 4.5.1 gives good result in iReport, wrong result in Java application
carlogenohm - 10 years 6 months ago

Thanks for the fast answer!

This is the html component:

<p>
    <strong>Rich text</strong></p>
<p>
    Description<br />
    <br />
    <strong>Bold text</strong><br />
    <br />
    <u>Underlined text</u><br />
    <br />
    Super<sup>script</sup></p>
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
    <tbody>
        <tr>
            <td>
                first column</td>
            <td>
                second col</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                second row</td>
        </tr>
        <tr>
            <td>
                third row</td>
            <td>
                &nbsp;</td>
        </tr>
    </tbody>
</table>
<p>
    &nbsp;</p>
 

carlogenohm's picture
Joined: May 15 2012 - 5:18am
Last seen: 1 year 1 month ago

Jasper Server Overrides a lot of the standard HTML tags (like p , table, etc) via CSS to use their own fonts, widths, etc.
Check with Firebug on your browser and you will see the current styles that get applied to your table.

Just a quick looks at the CSS on Jasperserver you can see that the main font type and size has been overridden in theme.css:

body, textarea, .body, .title > .path, input, select {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
font-weight:normal;
line-height:1.182em;
}

To get the output you want you will need to use your own CSS styles in the HTML.

marianol - 10 years 4 months ago

Reposting my comment as an answer since the comment got scrambled:

 

Jasper Server Overrides a lot of the standard HTML  tags (like <p> , <table>, etc) via CSS to use their own fonts, widths, etc. 
Check with Firebug on your browser and you will see the current styles that get applied to your table. 
 
Just a quick looks at the CSS on Jasperserver you can see that the main font type and size has been overridden in theme.css:
 
body, textarea, .body, .title > .path, input, select {
  font-family:Verdana, Arial, Helvetica, sans-serif;
  font-size:11px;
  font-weight:normal;
  line-height:1.182em;
}
 
To get the output you want you will need to use your own CSS styles in the HTML.
marianol's picture
16194
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 7 months ago

It does not work in iReport neither: submitted a bug, issue 2656

carlogenohm - 10 years 4 months ago
Feedback