Jump to content
We've recently updated our Privacy Statement, available here ×

why htmlcomponent on server looks different than in iReport?


carlogenohm

Recommended Posts

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):

 

NiceHtmlComponent.PNG.4017c80b38842b69faca08b9493ed509.PNG

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

NotNiceHtmlComponent.PNG.4cb29c24defc4975a3eb2a7e5a2ead9a.PNG

 

 

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

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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>
                 </td>
            <td>
                second row</td>
        </tr>
        <tr>
            <td>
                third row</td>
            <td>
                 </td>
        </tr>
    </tbody>
</table>
<p>
     </p>
 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...