Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: how to make the auto wrap or linebreak successful

  1. #1
    Join Date
    Jun 2009
    Posts
    116

    Smile how to make the auto wrap or linebreak successful

    Hello Everyone,
    I use the pentaho report designer 3.0.0.A few days before I have ask some question but no one answer me. I have looked for solution the three days in the forum and I find the problem is not only bother me but also many other gays.
    Now I will describe the problem in detail. I sincerely hope someone can help one or we can find out the solution together.
    I find that the pentaho report designer can’t wrap automatically . In some other applications , excel for example , there is a property named auto wrap which can make the work wrap automatically and it is usefully for user to see data.
    But in the pentaho report designer , I can do nothing for the auto wrap . The report designer will only wrap if there is a blank .So it lead to two disfigurement . If there is a single word contain a lot letters , and its length is over the right border of the element(for example : Label ,Text Field, etc):,it will appear two situation . If there is no blank behind the single long word , we will see the .. replace of the letters over the right border . If there is a blank behind the long word , the report will show the long word totally , but the report show the long word in a line , so we can see the word cover the right border, it will be more awful if the element is arranged closely one by one ,so the long word in one element will cover the right border to another one , so the report will look very confusedly . I think if the customer see that will be very confused.
    In there days ,I have try many way to settle this problem ,but they all turn out to failure . Totally I try many method , I have set the property “ Trim Text Content” and “Dynamic Content” in the properties pane ,and it turn out to failure. I set the “Style Expressions” property in the properties pane , I add the expressions of the “text-wrap” and “white space-collapse”, I saw Taqua(Chief Reporting Bug Plante) answer to someone to set the 'white-space-collapse: preserve; text-wrap: suppress;' , but in the Edit Formula I can’t find the “preserve” and the “suppress” , I have write the “preserver” and the “suppress” myself ,it turn out to failure; I set the Edit Formula to be TRUE to replace the “preserver” and the “suppress” , also failed . I set the dynamic_height in the “Style Expressions” to be TRUE and have no influence.
    Now this problem has shriveled me , I am bothered by this for long times . In fact , I am very satisfy to the pentaho report designer , but if the problem can’t resolve I can’t do anymore in my work . Now I have only one resolution is that I must count the length of every element ,so that when the data near to the right border I will add a blank to the word to make it linebreak . It will cost a lot of times, and if I have change to another language ,I will do this work again .So I really need a good way to resolve this problem.
    If there anyone who can help me or have some advise to me ,you can leave the word , or you can send the email to me ,my email address is guoweia19850@gmail.com, or you can connect me with the msn , my msn id is guowei19850707@live.cn . I am expectant for the advise , it will very helpful for me , and thanks for every one look this article regardless you can give me the advise or not.

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Our linewrapping always wraps on Word-Boundaries and there is currently no way of changing that.

    Trim-Text-Content simply removes leading and trailing whitespace content, so that text appears properly aligned. The dynamic-height expands the height of the element to make space for more lines of text, when necessary. It does not alter the width of the element nor does it influence the breakability of text.

    Whitespace-collapse controls how whitespaces are treated. It does not apply to your problem, as you dont have any whitespaces that can be collapsed or removed or ignored. Text-Wrap similarly enables or disables autmatic text-wrapping. If set to no-wrap, the text will only wrap when the text contains a line-break character.

    File a JIRA case for this and we can solve the problem in the next release (Sugar).
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Jun 2009
    Posts
    116

    Default

    I sorry I understand what you say .But I am still puzzled.

    I know the pentaho report designer’s linewrapping always wrapps on word-Boundaries . But what should the report designer do if there is single long word which width expand the elements’ width . In my option , the letters over the elements’ width can be show in the next line. Just like the single long word in the Excel , when the word’s width expand the cell’s width , We will can’t see the letters over the element’s width ,but if I set the “auto wrap” property to be true , I will see the lettets over the element’s width in the next line. In the pentaho report designer , the single long word which width expand the element’s width cann’t show totally in the report ,or it will be show in a line ,so the word will cover the element’s border. I just want the same effect with the Excel , the single long word can be show in several lines accord to its width.

    I have look for the solution in the forum for several days , and I find there is many other people have the same problem for a long times.I think you were supposed to solve the problem already.

    Now I describe the problem , for example I arrange servel Text Field element side by side, I will input the data from my code, but the width of the Text Field is limited, So when the data contain the single long word there will be some problem. For example , the width of the Text Field is only equal to five letters.If the data from my code is “American” ,then I will see the content is the report will be “Ameri..”,if the data form my code is “American and Chinese” , I will see “American” show in the first line , “the” in the second line , “Chinese” in the third line ,but the Text field’s width is only equal to five letters ,so “American” and the “Chinese” will cover the border of the element. If these Text Field element all have the single long word , you can think about it what will happen ,so the data in a Text Field will extend to another Text Field one by one ,and the report will be confusion . And the Number Field is the same , if I arrange servel Number Field side by side , and every Number Field’s width is limit to equal to five digit number .But is the data in six digit number , for example “123456” , in the report I will see the data as “12345..” , I think it is unacceptable to the consumer.

    I saw that the Text-Wrap similarly enables or disables automatic text-wrappingI know there is the property Whitespace-collapse and Text-Wrap in the Style Expressions , but I don’t know how to set the property in the Style Expressions.Can anyone tell one how to write the property value?

    When I search for the text-wrap , I found the thread which title is the “How do I define a multiline field?” .In this thread Taqua(Chief Reporting Bug Plante) write down this

    Hi,
    the ordinary HTML/CSS rules apply: So if your text contains newlines, then these newlines get replaced by spaces unless you define a different behaviour in the styles.
    If you are lazy, then you can simply wrap your content-element into a <html
    re> element, else you would have to define the style of the content-element as "white-space: pre;" (which is a short-cut for 'white-space-collapse: preserve; text-wrap: suppress;').
    The specs for that behaviour can be found in the CSS3-drafts:
    http://www.w3.org/TR/2005/WD-css3-te...ace-processing
    Have fun,
    said Thomas


    So I try to set the property of the “white-space-collapse” and “text-wrap” , But I can’t find help docs how to set the Style Expressions .

    When you answer me ,you said that “Text-Wrap similarly enables or disables autmatic text-wrapping. If set to no-wrap, the text will only wrap when the text contains a line-break character.” . But can you tell me what will happen when I set property value contrary to the “no-wrap”, how do I set , If I set this value ,will be helpful for this problem ?I have set the value “yes” , “ok” , “support” , “true”, they are all not work . If someone know how to set the property please tell me how to do it ,or give me the help docs I will see it myself.

    I have a solution to this problem that Whether the data size in the element will be changed accorder to the element’s width, so I can see the entire single long word . If someone know how to set the property please tell me how to do it ,or give me the help docs I will see it myself.

    Otherwise , I still have a problem about the dynamic list report .For example , I want to make the report about the query , and I want the user can select the items he want to see .It means that I must read the tablemodel’s value , and dynamic generate the list of the report according to the tablemodel’s value . But from now on , I must design the report before input the data . I have saw some other report designer have the function that only design a element which design to read the tablemodel’s value , and I run my programme , it will read the tablemodel’s value one by one , and generate the report according to the tablemodel’s value . Can pentaho report designer support this function? If someone know how to realize this funtion please tell me how to do it ,or give me the help docs I will see it myself.

    Now in conclusion , I will summarize all of my question:

    1 whether if is possible to make the auto wrap by set the value of Text-Wrap.
    Taqua(Chief Reporting Bug Plante)said that “Text-Wrap similarly enables or disables autmatic text-wrapping. If set to no-wrap, the text will only wrap when the text contains a line-break character.”.But you just said how to make it disable automatic text-wrapping , But how should I do ,if I want Text-Wrap similarly enables automatic text-wrap, which value should I input.

    2 whether it is possible to make the data’s size of the element to change to adapt to element’s width . If it is possible , how to achieve it.

    3 whether it is possible to complete the dynamic list report . I want to read the tablemodel’s value , and generate the list according to the tablemodel’s value. If there is some method to accomplish this function , please help I am appreciate for you advise.

    I am waiting for the advise. Thanks for you to cost you time to answer my question.

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    We do always break on word-boundaries. You want to break inside a word on character-boundaries. This is something we dont do. A very long word with no spaces in between has no break-opportunities, and thus our algorithm does not break there.

    PRD-3.0 does not use the same algorithm in the design-view as we use when running the report. Therefore what you see in the designer is *not* what you get from the engine. PRD-3.5 (Citrus) fixed that and now shows you the text exactly as it will appear in the engine.

    The fact that on multi-line text words violate the boundaries of the elements is a bug. You should see "Ameri..." on the first, "and" on the second and "Chin.." on the third line.

    To your questions:

    1: Has absolutely nothing to do with your problem. To wrap or not to wrap is not related to "cut the content that would overflow". Give your elements enough space, or the engine cannot print the full text.

    2: No, as this is a highly expensive operation and would require a large amount of layout-recomputations. Whenever we encounter such auto-with elements, we would have to compute the full report layout for each permutation of these elements to find the optimum. This would by no means feasible. Aside of that, elements placed on a canvas area still have no relationship to each other, so the expanding element would not push away the elements next to them. At the end, you would either get overlapping elements or we would have to invent an shifting algorithm that is equally expensive and to no use for 99% of our users. Know your data and design your reports with enough space for your fields.

    3: You can use the engine's API to create a report-definition on the fly. There are demos for that in the classic-engine-demo project.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5
    Join Date
    Jun 2009
    Posts
    116

    Default

    Thank you for you advise . But I still have two problem.

    1 The first one is about the dynamic column report . Maybe I think you don’t understand what I said.I will describe the problem in detail . In the dynamic column report , the column in my report is not fixed , it will change according to my require .

    In the past , the structure of report generate by the pentaho report designer is stable . Because I know which column need to be display , so I just add the label in the report header beforehand , and add relevant Text Field or Number Field in the Item Band according to the label in the report header .It is easy for the pentaho report designer to do .

    But now , I have a problem of the dynamic column report .The data is in default table model is have n(unknow) column , and the design don’t know the number of column in the model . The number n(unknow) is change dynamic according to user require.

    I want to make the report base on query result , and the customer can select the result he want to see . For example , there is the data of first_name , last_name , country , city , age , sex , email in all .The user can select the data he want to see . If he select the first_name , last_name , the report will only contain two column , the one is the first_name ,the other one is the last_name.If he select the first_name , country , age , sex , the report will need to contain these four column .Now you may understand what I said , the column in the report is dynamic , and I can’t fix its structure .I have see some other report designer have this function like this. They just add one element in the report which is related to the tablemodel in the program . The element will automatic display the dynamic column .

    I just want to know does the pentaho report designer support this function . I think there will be many people have the some require . I want someone can tell one how can I achieve this.

    2 When I use the pentaho report designer , I find it only can be design the report in portrait mode. But if there is a lot of item column I want to show ,it will be more convenient in transverse mode .

    If it is possible to achieve transverse design the report in the pentaho report designer ? How can I realize this function.

    In conclusion , I have two question:
    1 how can I achieve the dynamic column;
    2 how can I achieve the transverse design;

    These days I am really appreciate for you help . They are very useful for me .I will wait for you advise.

  6. #6
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    For 1 there is the report-design-wizard, which does exactly that. If that wizard does not fit your needs, there is a full blown Java-API that you can use to define the report in whichever way you want. (In that case, of course, you have to provide the UI for selecting the datasource and column as well. From our side, we cannot forsee your requirements and thus cannot include code for that.)

    The report-designer *always* generates a fixed, non-dynamic report-definition. In Citrus there you can make this more dynamic via Report-PreProcessors, but even they involve Java-Coding (as somehow we have to translate the user's selection into a report-definition. And as there is no standard format for what goes in and what goes out, the challenge is up to you.)

    For 2: File->Page-Settings.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  7. #7
    Join Date
    Jun 2009
    Posts
    116

    Default

    Thank you for you advise .Now I know that for 1 it is impossible.But I think you may not understand for 2.
    I know set the page set property,but what I need is that I just want to design the report transverse mode in the pentaho report designer .It is more convenient for us to design .
    If it is possible for the pentaho report designer to this?

  8. #8
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Well, for 1:

    The Wizard allows you to select your fields and groups and to build a report based on that input. This is exactly the requirement as expressed by:

    I want to make the report base on query result , and the customer can select the result he want to see . For example , there is the data of first_name , last_name , country , city , age , sex , email in all .The user can select the data he want to see . If he select the first_name , last_name , the report will only contain two column , the one is the first_name ,the other one is the last_name.If he select the first_name , country , age , sex , the report will need to contain these four column .
    If you need something web-based, WAQR is a web-version of the Wizard. The Wizard can be embedded in your own application, so there is no need to have the report-designer sitting around.

    However, if you want to offer your users an UI that is different from what the wizard offers you have to code it. We do have a very rich API in the reporting engine that allows you to define any kind of Ad-Hoc reporting system you like and I can assure you it has been done many times before. There is nothing complicated about it other than getting the requirements right and getting someone to do it.


    For 2: The report-designer uses the page-format *you* define. So if you tell it to have a landscape-page-format, you will have more space available to place fields. And if you hit preview, you will see that.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  9. #9
    Join Date
    Jun 2009
    Posts
    116

    Default

    Thank you for your patient explain .

    For 1:

    Just as you said , in the past , we just code it ourselves , we just define the reporting system by the rich API in the reporting engine . But I will cost a lot of time , and now we heart that the pentaho report designer has been release, so in order to shorten the project exploitation cycle , we decide to use the pentaho report designer to generate our report to instead of the API. I am just in charge of this job in my company .

    I just design the report in the pentaho report designer 3.0.0 , then I publish to the local computer as a XML file .Then I input the data in my program , and use the function of “getReportDefinitionSource” to import the relevant XML file.

    In the past , My report was just fixed . It is means that I know how much column and which column need to be displayed ,So I just need to add the Label in the Page Header as the column name, and add the Text Field in the Item band just as the column data .For example , I know there are the data of first_name , last_name , country , city , age , sex , email need to shown , so I add the Label which names are first_name , last_name , country , city , age , sex , email, and I add the Text Field as the data of data of first_name , last_name , country , city , age , sex , email. Then I publish to the local computer as the name of “report.xml” . After that , I just set value of first_name , last_name , country , city , age , sex , email as the TableModel , and use the function of “getReportDefinitionSource” to import the relevant XML file.
    public URL getReportDefinitionSource() {
    return ObjectUtilities.getResourceRelative(“report.xml”,
    report.class);
    }

    It works very well when I want to generate the static report which report structure is stable.

    But now I just want the pentaho report designer to generate the dynamic column report template .It is said that I don’t clear how much column and which column I want to displayed . For example , I know there are the data of first_name , last_name , country , city , age , sex , email need to shown ,but which data need to shown is selected by the customer , so I can’t confirm how much column and which column need to be displayed , and o I can’t generate the report template by pentaho report designer with the previous method .In my opinion ,it is good that there is an element which have an unknown number “n” which is relevant to the TableModel , so when generate the report the element will display the data of TableModel which is the column need to shown selected by the user , after that I import the XML file in my program , and input the name of the selected column which need to be shown ,and the data of these columns , they are all input as the value of TableModel . For example , if I input the column name first_name , last_name , country as the TableModel value , so the element will automatically generate these three columns , if I input the column name country , age , so element will automatically generate these two columns.

    So I need to design the dynamic column report in the pentaho report designer , then publish to the local computer as the XML file , then input the TableModel in my program , and import the XML file in the program . If it is impossible, I have to define the reporting system by the rich API in the reporting engine .

    Regardless whether the dynamic column report will be successful or not , I am very thanks for you patient explain , it is useful for us .

    For 2:

    I am sorry I can’t find the page-format property in the pentaho report designer , there are “zoom to 50%”, “zoom to 100%”, “zoom to 200%”, “zoom to 300%” which can change the size of the designer .

    Although I can set the Page Setup to transverse when I generate the report in my program , but I think it is better that if I can set the report design mode to the transverse in the pentaho report designer, it is more convenient which the column is too much . Just like the Excel , in the page setting property , I can set orientation to be portrait or transverse . I hope the pentaho report designer will also have this function , in my opinion , it will be useful for the consumer.

    Can you tell where can I find the page-format property if it is really useful for me to make the design mode to be transverse.


  10. #10
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    In the old report-designer the Page-setup setting is hidden very well. Select the report in the structure tree and then you'll see an property called "Page format" in the properties-table below. There you can change the format to "Landscape".


    For 1: If you use the ancient codeline, then you wont have much luck when searching for easy solutions. Although the engine's API is sane, the old Report-Designer and old Report-Design-Wizard are not. Have a look at the Citrus codeline for a much simplified system.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.