IE8中jasper报告对齐问题的文本字段

时间:2013-01-04 08:52:22

标签: jasper-reports

我正在使用 iReport 创建 JR 报告,我想知道是否有办法为 IE8 。我已设置textAlignment="Left",但它不适用于 IE8 。现在在 IE8 中,它显示在文本字段总大小的中心。

我的文字字段位于其他任何属性页脚区域。它是 IE 的任何不同属性吗?是否存在任何其他属性,以便我的文本字段根据文本框中的总文本自动调整大小?

以下是我的代码:

  <textField isBlankWhenNull="true">
   <reportElement  x="0" y="0" width="413" height="30">
    <property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
    </reportElement>
    <box leftPadding="10"/>
    <textElement textAlignment="Left" verticalAlignment="Middle">
        <font size="12"/>
    </textElement>
    <textFieldExpression><![CDATA["Created By: "+ $P{CREATED_BY}]]></textFieldExpression>
 </textField>

1 个答案:

答案 0 :(得分:0)

我通过一些jquery技巧解决了ii。它不是一个确切的解决方案,但它适用于我 在jsp页面上更改jasper报告渲染。像这样的结构

<td>
 <p>
<span> Created By:
</span>
</p>
</td>

使用jquery我找到了“Created by”文本的特定范围。然后是span的父级,即

并将文本对齐属性保留为左。

<script type="text/javascript">
$(function(){
    $('span').each(function() {
           //alert($(this).html());
           if($(this).html().indexOf("Created By") == 0)
            {
            $(this).parent().css("text-align","left");
        }
        });
});
</script>