I want to hide a text field using jasper report so when i will view it in html i wont see its content, but the problem is that it has to be there (proggram JAWS has to read it) so i can't use "printWhenExpression". I tried to use width properties to hide it but so far i have no effect.
<textField>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
If I understood correctly, you need to keep the shape of the box as if the content was here, but you want the content to disappear.
It's true that printWhenExpression
will make the whole item disappear.
You can either :
Use a parent item such as a frame to be around the textField, so printWhenExpression
is true on the text fields, then the frame will still be here to keep its place.
<frame>
<reportElement x="0" y="0" width="200" height="200" uuid="25b397bf-e718-43ab-8641-4f7c7932253f"/>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="4e8ea258-88f0-4220-a350-448da63390d1">
<printWhenExpression><![CDATA[the_condition]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</frame>
Use a java condition in your text field. If the condition is false, the text will disappear but the text field frame will still be displayed.
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="4e8ea258-88f0-4220-a350-448da63390d1">
<printWhenExpression><![CDATA[the_condition]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[my_condition ? $V{PAGE_NUMBER} : ""]]></textFieldExpression>
</textField>