2005 IR Help Posted August 20, 2006 Share Posted August 20, 2006 By: Lokesh Javaji - ljavaji Urgent:Problem with extra space in text field 2004-01-08 04:37 Hi , I have defined a report where in a line i have a static text followed by a dynamic content as This is to inform you Mr.$F{FIRST_NAME} $F{LAST_NAME} that you have beeen ....... Now my problem is at the time of designing this report, i have left the maximum of 10 space width for each field.While at the time of data merge, first name and last name values are only 5 characters each. So what happen is after printing the firstname jasper leaves 5 spaces and the starts printing the last name. Is there any way to avoid/truncate the extra 5 spaces of the first name and make the last name being printed immediately next to first name. can u pls provide any tips to achieve this... Thanks in advance. By: Tobias Gaekle - ike987 RE: Urgent:Problem with extra space in text f 2004-01-08 08:20 if i understand you right, you want something like this: <textFieldExpression> <![CDATA["This is to inform you Mr. " + $F{FIRST_NAME}.trim() + " " + $F{LAST_NAME}.trim() + " that you have been...."]]> </textFieldExpression> By: Robby Raj - charuravi RE: Urgent:Problem with extra space in text field 2004-01-08 23:41 They way you fromat is correct but in the First name if we streach the element to fit 15 characters and the in merge we get only 5 Characters it shows trailing spaces. example "This is to inform you Mr. Ravi Varadarajan that your salary will be $ 4000.00 on an annual basis" Should look like "This is to inform you Mr. Ravi Varadarajan that your salary will be $ 4000.00 on an annual basis" This is really URGENT if you see above we are loosing the offset. We just have few day for our produciton release and I would really appreciate if any one can help on this regards By: Teodor Danciu - teodord RE: Urgent:Problem with extra space in text f 2004-01-09 00:00 Hi, I really don't see why the solution proposed by Tobias does not work for you. It performs the trim() on each field and concatenates them as expected. It should not generate any gap. Have you tested it? Thank you, Teodor By: Lokesh Javaji - ljavaji RE: Urgent:Problem with extra space in text field 2004-01-09 05:53 Hi , may be i didnt explain my problem correctly. In my report, I have a static text followed by two dynamic fields text fields first_name and last_name. like This is to inform you Mr. First_name Last_name static text db field db_field 1 2 3 so i have 3 elements in my line. now i have left the maximum of 10 space width for first name and last name in the report .While at the time of data merge, first name and last name values are only 5 characters each. So what happen is after printing the firstname jasper leaves 5 spaces and the starts printing the last name. something like this This is to inform you Mr. Javai lokes i want lokesh to come near to javai. like This is to inform you Mr. Javai lokes hope i have explained myself clearly... is there a solution to avoid this extra spacing... any help is very much appriciated. Thanks. By: Teodor Danciu - teodord RE: Urgent:Problem with extra space in text f 2004-01-09 06:08 Hi, As you can see, the solution suggested by Tobias uses only one text field and it is the only solution if you want to eliminate the space. But if you want the name to have a different style from the rest of the text (let's say bold), then this is not yet possible in JasperReports. This functionality will be added in the future. Thank you, Teodor 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