1 2 Previous Next 15 Replies Latest reply: Jun 20, 2012 8:30 AM by DanieleT RSS

    Interactive Report: how can I display carriage returns?

    DanieleT
      Hello everybody.

      Here is my problem: I created a table containing a field COMMENT varchar2(4000) and using APEX 4.1 I built an interactive report on it.

      Users can fill the field COMMENT with sentences on different rows, ex:
      " this is the first line
      this is the second line

      this is the third line"

      This is correctly managed in the FORM, where I defined the field COMMENT as 'Text Area', but in the REPORT I wasn't able to set it in a way which permits to see it whit the carriage returns: the content is displayed on one row only : "this is the first linethis is the second linethis is the third line".
      I tried and set all the possible field types, but I found no ways to display the content exactly as it is (with carriage returns).
      Obviously I cannot use HTML
      , since I cannot ask users to digit it when inserting their text.

      Could someone suggest me how to reach this result? In need to use the interactive report because the searching/filtering tool is fundamental.

      Thanks in advance,
      Daniele
        • 1. Re: Interactive Report: how can I display carriage returns?
          Prabodh
          Hi,

          Here is one way.
          a. Replace the CR+LF in the report query with <br />
          REPLACE(COLUMN_NAME, CHR(13)||CHR(10),'<br />') 
          b. Change the Column type to Standard Report Column, otherwise you will see the br tag in the column.

          Regards,
          • 2. Re: Interactive Report: how can I display carriage returns?
            fac586
            >

            Please update your forum profile with a real handle instead of "user9211286".
            Here is my problem: I created a table containing a field COMMENT varchar2(4000) and using APEX 4.1 I built an interactive report on it.

            Users can fill the field COMMENT with sentences on different rows, ex:
            " this is the first line
            this is the second line

            this is the third line"

            This is correctly managed in the FORM, where I defined the field COMMENT as 'Text Area', but in the REPORT I wasn't able to set it in a way which permits to see it whit the carriage returns: the content is displayed on one row only : "this is the first linethis is the second linethis is the third line".
            I tried and set all the possible field types, but I found no ways to display the content exactly as it is (with carriage returns).
            Obviously I cannot use HTML
            , since I cannot ask users to digit it when inserting their text.

            Could someone suggest me how to reach this result? In need to use the interactive report because the searching/filtering tool is fundamental.
            Use a CSS style sheet with attribute selectors. Put this in the page HTML Header, replacing the <tt>T_EMP_NAME</tt> etc selectors with the actual <tt>id</tt> attributes of your column headers:
            <style type="text/css">
            .apexir_WORKSHEET_DATA td[headers="T_EMP_NAME"] {
              white-space: pre;
            }
            </style>
            Interactive Report Control Break disregards HTML Header style.
            • 3. Re: Interactive Report: how can I display carriage returns?
              VC
              Prabodh wrote:
              Hi,

              Here is one way.
              a. Replace the CR+LF in the report query with &lt;br /&gt;
              REPLACE(COLUMN_NAME, CHR(13)||CHR(10),'<br />') 
              b. Change the Column type to Standard Report Column, otherwise you will see the br tag in the column.
              Please be aware that using this approach will cause the HTML code to appear in the CSV file when exported
              • 4. Re: Interactive Report: how can I display carriage returns?
                DanieleT
                Thank you for your add on. In fact I need to produce a CSV output file, hence I cannot use this solution.

                Daniele
                • 5. Re: Interactive Report: how can I display carriage returns?
                  DanieleT
                  Hi,

                  I tried your suggestion applying it to all the report (I have 3 fields to be managed the same way). I tested it by changing the color, just to prove it works fine:

                  <style type="text/css">
                  .apexir_WORKSHEET_DATA td {color:red}
                  </style>

                  It works fine!

                  If I type the following, instead, it doesn't work: nothing changes (I use IE-7). Should I do something more?

                  <style type="text/css">
                  .apexir_WORKSHEET_DATA td[headers="ERI_COMMENTS"] {
                  color: red;
                  }
                  </style>

                  Anyway, lets suppose to apply it to all the fields: what is the right command for forcing APEX to display the content of a field accordingly to text carriage returns? in your example you wrote 'white-space: pre' but I think this is not my case.

                  PS: I already updated my handle in my profile, but it is not yet applied maybe I need to sign out and in again.

                  Thanks,
                  Daniele
                  • 6. Re: Interactive Report: how can I display carriage returns?
                    fac586
                    user9211286 wrote:
                    Hi,

                    I tried your suggestion applying it to all the report (I have 3 fields to be managed the same way). I tested it by changing the color, just to prove it works fine:
                    <style type="text/css">
                    .apexir_WORKSHEET_DATA td {color:red}
                    </style>
                    It works fine!

                    If I type the following, instead, it doesn't work: nothing changes (I use IE-7). Should I do something more?
                    <style type="text/css">
                    .apexir_WORKSHEET_DATA td[headers="ERI_COMMENTS"] {
                    color: red;
                    }
                    </style>
                    What theme are you using? IE7 will not support attribute selectors in quirks-mode legacy themes.
                    Anyway, lets suppose to apply it to all the fields: what is the right command for forcing APEX to display the content of a field accordingly to text carriage returns? in your example you wrote 'white-space: pre' but I think this is not my case.
                    Why not?

                    http://reference.sitepoint.com/css/white-space

                    You may find that the <tt>pre-line</tt> or <tt>pre-wrap</tt> settings fit your requirements better. It depends on the contents of your text and how you want it displayed.
                    • 7. Re: Interactive Report: how can I display carriage returns?
                      DanieleT
                      Here I am again,

                      I just was studying the WEB page you suggested and I tried with options pre-line and pre-wrap, but nothing changed.
                      Then I noted the bowser compatibility (...). I repeated my tests with 'white-space:pre' using Mozilla and Safari: great! It works fine there!

                      This theorically solves my problem, but my company adopts IE7 as a standard (we're going to upgrade to IE8 within one year) so, before closing successfully this thread, I have the last question: is there a way to obtain the same results with IE7?
                      The theme I'm using is '10. Sand', with two levels tabs.

                      Thanks,
                      Daniele
                      • 8. Re: Interactive Report: how can I display carriage returns?
                        fac586
                        user9211286 wrote:
                        Here I am again,

                        I just was studying the WEB page you suggested and I tried with options pre-line and pre-wrap, but nothing changed.
                        Then I noted the bowser compatibility (...). I repeated my tests with 'white-space:pre' using Mozilla and Safari: great! It works fine there!

                        This theorically solves my problem, but my company adopts IE7 as a standard (we're going to upgrade to IE8 within one year) so, before closing successfully this thread, I have the last question: is there a way to obtain the same results with IE7?
                        The theme I'm using is '10. Sand', with two levels tabs.
                        Sadly that's just about the quirkiest of the Quirks-mode themes. No support for CSS attribute selectors in Quirks-mode IE, so use jQuery instead.

                        Create a Dynamic Action to apply the CSS when the IR is refreshed.

                        When

                        Event: After Refresh
                        Selection Type: Region
                        Region: IR // whatever your region is

                        True Actions

                        Action: Execute JavaScript Code
                        Fire On Page Load: Yes
                        $('.apexir_WORKSHEET_DATA td[headers="ERI_COMMENTS"]').css('white-space', 'pre');  
                        • 9. Re: Interactive Report: how can I display carriage returns?
                          DanieleT
                          Unfortunately your last suggestion doesn't solve the problem: it works fine with FireFox and Safari, but not with IE7, where I tested all the options and saw different behaviours specifying 'normal', 'nowrap' and 'pre', but none returning data as I need.
                          I found it interesting and useful, anyway.

                          I'm going to close this thread, since your suggestions gave me the possibility to find a solution to my problem, even if it is required to use another bowser. I think that I will be able to obtain my users using them instead of IE7 when working with my application.

                          Thank you again for you precious and fast support.

                          Daniele
                          • 10. Re: Interactive Report: how can I display carriage returns?
                            fac586
                            user9211286 wrote:
                            Unfortunately your last suggestion doesn't solve the problem: it works fine with FireFox and Safari, but not with IE7, where I tested all the options and saw different behaviours specifying 'normal', 'nowrap' and 'pre', but none returning data as I need.
                            If you can reproduce this in a test case on apex.oracle.com we can take a look at it.
                            • 11. Re: Interactive Report: how can I display carriage returns?
                              DanieleT
                              OK: I created a simple example on apex.oracle.com.

                              I created table 'terragnid_test_cr' with fields:
                              - 'ID' number(3)
                              - 'COMMENTS' varchar2(4000)

                              I built an application ('43446') with an interactive report (REPORT+FORM).
                              Then I created a Dynamic Action following your indication in page REPORT(page 1).

                              I run the application and inserted the following value in the text area of the FORM (page 2):

                              "This is the first row
                              This is the second row

                              This is the third row after a white line
                              This is a long row 012345678901234567890123456789012345678901234567890"

                              and that is how I want it to be displayed in the REPORT page as well.

                              I developed and tested using IE7: the result is that in the REPORT page the value of field COMMENT is all in one row : "This is the first row This is the second row This is the third row after a white line This is a long row 012345678901234567890123456789012345678901234567890".

                              Running the same test with FireFox, instead, the avalue appears correctly (as digited) with the carriage returns as they were digited by the user (me).

                              My workspace is 'terragnid_ws'. Let me know if you need username and/or password or other info for connecting and use my application.

                              Thanks,
                              Daniele
                              • 12. Re: Interactive Report: how can I display carriage returns?
                                fac586
                                user9211286 wrote:
                                OK: I created a simple example on apex.oracle.com.
                                Thanks for making the effort.
                                My workspace is 'terragnid_ws'. Let me know if you need username and/or password or other info for connecting and use my application.
                                Yes, I need some credentials to do so.
                                • 13. Re: Interactive Report: how can I display carriage returns?
                                  DanieleT
                                  Here are the credentials to my APEX application:

                                  Workspace: terragnid_ws
                                  Login: daniele.terragni@ericsson.com
                                  Password: Milano68
                                  Application: TestPR (43446)

                                  Thanks,
                                  Daniele
                                  • 14. Re: Interactive Report: how can I display carriage returns?
                                    fac586
                                    IE7 not only doesn't support attribute selectors in Quirks mode, white-space: preit doesn't support <tt>white-space: pre</tt> in Quirks mode either.

                                    I created a new page template with a DOCTYPE to trigger Standards mode rendering. This looks OK in IE and makes the <tt>white-space: pre</tt> work in all browsers. Unfortunately it causes the layout to break in Firefox (and probably everything else...)

                                    Any chance you could switch to a Standards mode theme?
                                    1 2 Previous Next