How to ensure length of the String is fixed using jasper reports?

I've a String value and need to append a total at the end of the String...This String value is not consistent it may be 10 characters ot may wrap in mulitple lines but 

I've to append TOTAL at the end of the String value and this total should dsiplay at the end of the line irrespective of the lenght of the String value.

So for that in my logic..i'm checking single line lenght in report and subtracting String value length and appending Spaces and at the end appending Total.

ex:  int report lineLength= 360

String stringValue = "charge 1 charge 2 : 4000 charge3: 45455445"

int spaces = 360-stringValue.length();

for( i = 0; i< spaces : i++){

   stringValue.append(' ')



and printing this stringvalue in the report..but it seems to be not consistent in to achieve this?


redditp's picture
Joined: Aug 2 2013 - 7:58am
Last seen: 9 years 3 months ago

0 Answers:

No answers yet