8 Replies Latest reply: Feb 27, 2013 12:26 PM by Gustavo Bustos RSS

    Displaying CLOB column content with markup

    AmandaWalsh
      I have a table with a CLOB type column, and I a using a n APEX form to input into this column using a Rich Text Editor.

      When I save the text and then re-open it again with the Rich Text Editor in the form, the markup (bold, spacing, etc) has successfully been saved and retrieved.

      I want to also create another page to show one record at a time (to users who I don't want to be able to edit the form), but I can't get the text to be displayed nicely with the markup.


      I have tried using a dynamic PL/SQL region as well as an item within a HTML region, but it always displays without the markup.

      How do I do this correctly?
        • 1. Re: Displaying CLOB column content with markup
          Prabodh
          Hi,
          I have a table with a CLOB type column, and I a using a n APEX form to input into this column using a Rich Text Editor.
          When I save the text and then re-open it again with the Rich Text Editor in the form, the markup (bold, spacing, etc) has successfully been saved and retrieved.

          I want to also create another page to show one record at a time (to users who I don't want to be able to edit the form), but I can't get the text to be displayed nicely with the markup.

          I have tried using a dynamic PL/SQL region as well as an item within a HTML region, but it always displays without the markup.

          How do I do this correctly?>
          Apex Version?
          Not sure I have understood what exactly is nicely in your case.
          Try the following
          a. Create a Shared Components > Shortcut Type PL/SQL HTML. Retrieve you clob column into this Shortcut
          b. On the page create a HTML Region display Shortcut and add the Shortcut to it.

          Cheers,
          • 2. Re: Displaying CLOB column content with markup
            AmandaWalsh
            I am using APEX 4.2.

            I have a report with an link column. When I click the link, I am passing the ID of the record to an item on the next page.
            On this page I also want to retrieve a column from the same record, that is of CLOB type.

            I don't think a shortcut is a very elegant solution as the data in the CLOB column will be different for every record.

            To put it in context, the table stores "Help" data for the application. There are some admin users that have access to a form with a rich text field to input data into the clob, but then I have defined a separate page to display the details of a "help" record. But I can't seem to get the text to display from the clob column without the markup being stripped.

            Amanda.
            • 3. Re: Displaying CLOB column content with markup
              Prabodh
              I am using APEX 4.2.
              I have a report with an link column. When I click the link, I am passing the ID of the record to an item on the next page.
              On this page I also want to retrieve a column from the same record, that is of CLOB type.

              I don't think a shortcut is a very elegant solution as the data in the CLOB column will be different for every record.
              >
              You can use Page Item values in Session State in the Shortcut PL/SQL.
              You can achieve the same with HTML Region Type PL/SQL Anonymous Block that returns HTML.
              >
              To put it in context, the table stores "Help" data for the application. There are some admin users that have access to a form with a rich text field to input data into the clob, but then I have defined a separate page to display the details of a "help" record. But I can't seem to get the text to display from the clob column without the markup being stripped.
              >
              Do not put the clob value in Page Item, put it in a HTML Region
              Maybe it has more to do with your Region Template. Try No Template and Bracketed Region templates.

              Cheers,
              • 4. Re: Displaying CLOB column content with markup
                fac586
                Amanda Nixon wrote:
                I am using APEX 4.2.

                I have a report with an link column. When I click the link, I am passing the ID of the record to an item on the next page.
                On this page I also want to retrieve a column from the same record, that is of CLOB type.

                I don't think a shortcut is a very elegant solution as the data in the CLOB column will be different for every record.

                To put it in context, the table stores "Help" data for the application. There are some admin users that have access to a form with a rich text field to input data into the clob, but then I have defined a separate page to display the details of a "help" record. But I can't seem to get the text to display from the clob column without the markup being stripped.
                To get a Display Item to render as HTML, in the item definition page Security section set Escape special characters to No.

                For a report column, ensure the Display Text As report column attribute is Standard Report Column rather than the default Display as Text (escape special characters).
                • 5. Re: Displaying CLOB column content with markup
                  AmandaWalsh
                  I tried to edit definition page Security section set Escape special characters to No - thought this would be the key, but it still does not display correctly.

                  I have a partly-working solution.

                  I have created a Form on a Table with Report on my "HELP" table with the APEX wizard.

                  I have then modified the form page, and changed the Page Attributes to set the page as Read Only when the user is not an admin user.

                  This semi-works: text formatting and new lines are displayed, although the breaks are a bit off - for example when you use a numbered list, the number is on one line, then the text for that item is a little further down.
                  • 6. Re: Displaying CLOB column content with markup
                    AmandaWalsh
                    Also, have been switching between the different Rich-text editors.

                    The FCK Editor 2 seems to save HTML/CSS formatting that displays better in read-only mode that the CK Editor 3.

                    The change to FCK Editor makes it acceptable and something I can live with. Thanks for everyones help!
                    • 7. Re: Displaying CLOB column content with markup
                      Patrick Wolf-Oracle
                      Hi Amanda,

                      you shouldn't have to use the "Read Only" condition to achieve what you want. Maybe the easiest would be if you setup a simple example on apex.oracle.com and provide us the application#. That would allow us to have a look at the code and make the necessary modifications.

                      Regards
                      Patrick
                      -----------
                      My Blog: http://www.inside-oracle-apex.com
                      APEX Plug-Ins: http://apex.oracle.com/plugins
                      Twitter: http://www.twitter.com/patrickwolf
                      • 8. Re: Displaying CLOB column content with markup
                        Gustavo Bustos
                        Hi, I know that I´m a kind of late in this discussion, but I faced a similar problem exactly in now days and in a way to show my grateful to this specific forum conversation that gave me the light I was needing, I want to share my solution here.

                        My Problem:
                        I have a customizable "Help" text that could be seen in some pages of the application. It is edit from a special Help Management page throw a Rich Text Editor and it is related to the corresponding page. When the final user opens the specific page, the text has to be shown as it was edited in the Rich Text Editor.

                        My solution came in this way:
                        *1. Create the Shortcut: "Help_Text"*
                        DECLARE
                        CURSOR C_Help IS
                        select Concat(Concat('<div class="textRegion">',Help_Text),'</div>')
                        from Help_by_Page_Table
                        where app_id = :app_id
                        and page_id = :app_page_id;
                        vHelp_Text CLOB;
                        BEGIN
                        OPEN C_Help;
                        FETCH C_Help INTO vAyuda_Rapida;
                        CLOSE C_Help;
                        RETURN vHelp_Text;
                        END;
                        *2. In the desire page: Create a HTML Region(with shorcuts)*
                        Region_Source:"Help_Text"
                        *3. Job is done!*

                        I just have to add that I´m using the Standard Theme: Productivity Applications, the class "textRegion" is part of the classes defined in this theme.

                        Edited by: Gustavo Bustos on Feb 27, 2013 12:21 PM

                        Edited by: Gustavo Bustos on Feb 27, 2013 12:25 PM