h.leininger Posted September 6, 2021 Share Posted September 6, 2021 Hi,I have a table with a cell defined with text Alignment Right.I want to have "Left" text Alignment for this cell if it is the first Row of the table. Is this possible?extract of the XML:... <textField textAdjust="StretchHeight" evaluationTime="Auto"> <reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="78" height="26" uuid="54183d43-a1b4-4edd-bd56-8f8819c52b59"> <property name="com.jaspersoft.studio.unit.width" value="cm"/> </reportElement> <box padding="0"> <pen lineWidth="0.25"/> <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> <textElement textAlignment="Right" markup="styled"> <font fontName="Carlito" size="11"/> </textElement> <textFieldExpression><![CDATA[$F{proband}]]></textFieldExpression> </textField>...ThanksHelmut Leininger Link to comment Share on other sites More sharing options...
yama818 Posted September 6, 2021 Share Posted September 6, 2021 If your requirement is the following image, you can achieve it by using conditional style. The configuration procedure is as follows.1. Create a new Style (ex:Style1) --> In this case, set TextAlignment=Right. 2. Create a conditional style for Style1 (Expression:$V{COLUMN_COUNT} == 1) --> Here, set TextAlignment=Left. 3. Define 'Style1' for the text field style. * (Reference) style code <style name="Style1" hTextAlign="Right"> <conditionalStyle> <conditionExpression><![CDATA[$V{COLUMN_COUNT} == 1]]></conditionExpression> <style hTextAlign="Left"/> </conditionalStyle> </style> * (Reference) textField code <textField> <reportElement style="Style1" x="240" y="0" width="80" height="30" uuid="4440143f-b9f3-4e00-95d8-f429250bfe50"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="94e4996e-866d-42e7-b3c5-8507f14bf0f9"/> </reportElement> <box> <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> </box> <textElement verticalAlignment="Middle"> <font size="14"/> </textElement> <textFieldExpression><![CDATA[$F{seq}]]></textFieldExpression> </textField> I hope this is useful to you. Link to comment Share on other sites More sharing options...
h.leininger Posted September 7, 2021 Author Share Posted September 7, 2021 Awesome! Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now