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

Left align JRHtmlExporter bug


martynhiemstra

Recommended Posts

Hi All

 

I have found what I beleive is to be a bug in the JRHtmlExporter. I can successfully generate html but I have discovered is that fields that have been aligned to the left in iReport aren't given the text-align: left tag. If I wrap the html output in a div like so:

 

<div style="text-align: center">

Report Html

</div>

 

then the fields that are normally aligned to the left are now aligned in the center. This is because the fields that should be aligned to the left haven't got an alignment and therefore the parent alignment is used, which is center.

 

Is there are a workaround? Has anybody else expierenced this behaviour.

 

Thanks in advance,

Martyn

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I was using jasperreport 1.3.0 but I have now switched to 1.3.3. In 1.3.3 the same situation arises.

 

 

Due to privacy information I cant show all my code but I can show you a table row where it's wrong.

<tr valign="top">

<td><img alt="" src="/images/px" style="width: 30px; height: 17px;"/></td>

<td colspan="16"><span style="font-family: Arial; font-size: 12.0px; font-weight: bold;">Monthly overview</span></td>

<td><img alt="" src="/images/px" style="width: 18px; height: 17px;"/></td>

<td colspan="29" style="text-align: right;"><span style="font-family: Arial; font-size: 12.0px; font-weight: bold;">MyName</span></td>

<td><img alt="" src="/images/px" style="width: 30px; height: 17px;"/></td>

</tr>

As you can see. Some table cells do have a text-align: right but there are no text-align: left even though the first cell that contains Monthly overview is aligned to the left

 

 

I am using Firefox 2.0.0.3 but I am absolutly sure that the problem lies in the text-align: left not being displayed.

 

 

A solution would be to always display the text-align: style tag. Even if it's left aligned. You simply never known how the parent is aligned and therefore it's best to always set the alignment. If I where to have this as css

td {

text-align: right;

}

then all the fields would be aligned right and not left, messing up the html view.

Post edited by: martynhiemstra, at: 2007/05/15 13:38

Link to comment
Share on other sites

I was curious to see the HTML as only <div style="text-align: center"> would not cause the behaviour.

 

If we follow your suggestion and explicitly set text-align:left, we'd have to do the same thing for all CSS properties for which we assume some defaults, as someone might do td {color: red; font-style: italic; text-decoration: underline;} and he'd end up with regular report texts showing as red italic underlined. Doing this would cause the size of the HTML expoorted report to grow considerably, and some users might not be happy with that, so we would need to make this configurable.

 

So, if think this is a bug, log it here so that we don't loose track of it.

 

In the meantime, you can use CSS selectors to override text-align for the report part of your HTML.

 

Regards,

Lucian

Link to comment
Share on other sites

Hi Lucian

 

Thanks for your information. Now that I have read your post I would like to retract my opinion that this is a bug. It's isnt a bug but like you suggested, adding a flag option might be a really good idea. In my case I could set the flag and it would always set the text-align tag.

 

I wont file a bug report but instead I'll file a future request.

 

Martyn Hiemstra

Link to comment
Share on other sites

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...