问题
I want to align text for static text with html markup. I tried for p tag with both align and text-align property. Seems that both does not take effect.
<p align="right">Right 1</p> <p text-align:right>Right 2</p>
I know that jasper report supports very few of html tags according to http://community.jaspersoft.com/questions/539009/html-tags-supported-jasper-reports-v-371
Is is possible to achieve this on japser version 6.0.3?
Any help is greatly appreciated.
回答1:
Using <textField>
with <textElement markup="html"/>
you can only format how the text looks. (color,bold,underline ecc).
This feature is for producing styled text.
Quoting Teodord (jasper report staff)
The alignment is not among supported styling because it is not about how text characters look, but about how you lay them out. We cannot change the alignment of text within the same text field element.
However you could test the <hc:html>
component, this will render an image of you html.
Note: this is not correct html <p text-align:right>
it should be <p style='text-align:right'>
, but it will not make any difference.
来源:https://stackoverflow.com/questions/34080183/text-alignment-in-jasper-with-html-markup