pbourban Posted April 23, 2010 Share Posted April 23, 2010 Hi, Is there a way to present informations in a report as explained below : short field name..................................short field valuemore longer field name......................more longer field value How do I generate the ..... , knowing that :- the size of the fields names can vary (internationalization is used to run the report in French or English)- the size of the field values can also of course vary- fields names have to be left aligned and fields values have to be right alignedSee the scan in attachment of what we expect.Thanks a lot for your replies.Post Edited by pbourban at 04/23/2010 14:37 Link to comment Share on other sites More sharing options...
pablodc Posted April 26, 2010 Share Posted April 26, 2010 Hi, The uggly and dirty way perhaps can be to create three fields: 1.) Description, i.e "Volume", aligned left in the container and type "solid", not transparent 2.) Value, i.e 600 m2 of the same type of #1 but aligned to the right 3.) a field with the wide of the container, transparent and locate above the fields #1 and #2 I have attached a example.Good luck Link to comment Share on other sites More sharing options...
slow Posted April 26, 2010 Share Posted April 26, 2010 which database do you use?I think the best way is using a string formatting function of your db when you retrieve your data...or a java function in a your library you put in the classpath that format string before you print it. Link to comment Share on other sites More sharing options...
pbourban Posted April 26, 2010 Author Share Posted April 26, 2010 Hi,Answering : The uggly and dirty way In my case this will not work as I'm do not know the size of the element values at design time. Some times the description will contain a short text, some times a longer text. Same tthing for the value. Thank's anyway... Post Edited by pbourban at 04/26/2010 11:22 Link to comment Share on other sites More sharing options...
pbourban Posted April 26, 2010 Author Share Posted April 26, 2010 We are using Postgresql.Values are of course retrieved from the DB, but descriptions come from resources files.Does your solution work even if the font used is not proportional? Post Edited by pbourban at 04/26/2010 11:33 Link to comment Share on other sites More sharing options...
slow Posted April 26, 2010 Share Posted April 26, 2010 If you work with font dimension information and with String coming from properties files then I think it's better work ad report level than a DB level...you should consider creating a Java class taht perform formatting of your strings before you put them in texfiled... anyway, the "dirty" solution it's still a (good) solution... :) Link to comment Share on other sites More sharing options...
slow Posted April 26, 2010 Share Posted April 26, 2010 ok... try this solution (it works in my test)create a java class like the code... export the class like a JAR library...import the library in your IREPORT... and set the texfiled (type String) expression like:MainString.getFormattedString($F{VALUE_L},$F{VALUE_R},80)where VALUE_L is the left value in your string... and so VALUE_R the rigth value... and 80 the max char length of your texfield String.and run your report. ____________________________________if it works... give me KARMA points please! : ) Code:import java.util.Arrays;public class MainString { public static String getFormattedString(String inputL,String inputR, int charLimit) { char[] array = new char[charLimit-inputL.length()-inputR.length()]; Arrays.fill(array, '.'); return inputL+new String(array)+inputR; } }Post Edited by slow at 04/26/2010 12:41 Link to comment Share on other sites More sharing options...
pbourban Posted April 26, 2010 Author Share Posted April 26, 2010 Hi.It work's but only if the pdf font used is a non-proportional or fixed-width font (for example Courrier) but unfortunately not with a proportional font (for example Helvetica). And as we expect to use, of course, proportional font …See samples to get the differences.Thanks’ any way but I’m afraid this is not possible with such a reporting tool…. Link to comment Share on other sites More sharing options...
slow Posted April 26, 2010 Share Posted April 26, 2010 I think if you want to manage properly the dimension of a texfield etc, you should work with iText... so you can control more and more details...uhm... I'm thinking about other tricks... but the "dirty" solution seems to be the best. Link to comment Share on other sites More sharing options...
pbourban Posted April 27, 2010 Author Share Posted April 27, 2010 Thank's for your advice, I was also thinking about replacing the all stuff by iText. Do you thing that we can obtain the same level of control with iTEXT than with XSL-FO/FOB ? Link to comment Share on other sites More sharing options...
slow Posted April 27, 2010 Share Posted April 27, 2010 I have worked with iText in old projects but I don't know the power of XSL-FO/FOB in detail... you should make some tests and make a comparison between them. 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