Text Alignment in Jasper with HTML markup

試著忘記壹切 提交于 2019-12-11 00:53:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!