Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Rich Text content in PDF using XSL FO and Oracle APEX

I am using Oracle APEX(22.1) for web Applications and APACHE-FOP(2.6) print server to generate PDF.
We have a functionality in Oracle APEX. Which is Users can create Templates using Rich Text Editor page item in Oracle APEX. Below is an example.
image.pngWe are storing that template in "Templates" table.
and Content is stored like below in Database.
image.png
I am working on preparing XSL-FO layout to display the content in PDF. I created a Report Query with "Select content from templates" and Below is Data XML for the report Query.

<?xml version="1.0" encoding="UTF-8"?>
<DOCUMENT>
<ROWSET>
   <ROW>
      <NAME>TEST</NAME>
      <DESCRIPTION><p><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Program Details:</strong></p>

<p><strong>Reimbursement for ABC Users:</strong></p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1-2 Students <em><strong>$300</strong></em>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3-5 Students <em><strong>$500</strong></em></p>

<p><strong>Hotels for ABC Users:</strong></p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1-2 Students <em><strong>$100</strong></em></p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3-5 Students <em><strong>$300</strong></em></p>

<p>&nbsp;</p>
</DESCRIPTION>
   </ROW>
</ROWSET>
</DOCUMENT>

Below is XSL-FO layout code. which is used in report Layouts.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" version="2.0">
   <xsl:template match="/">
      <fo:root>
         <fo:layout-master-set>
            <fo:simple-page-master master-name="A4" page-width="216mm" page-height="279mm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
               <fo:region-body margin="0.0cm" />
            </fo:simple-page-master>
         </fo:layout-master-set>
         <fo:page-sequence master-reference="A4">
            <fo:flow flow-name="xsl-region-body">
               <xsl:if test="DOCUMENT/REGION/ROWSET/ROW |  /DOCUMENT/ROWSET/ROW | /ROWSET/ROW">
                  <xsl:for-each select="DOCUMENT/REGION/ROWSET/ROW |  /DOCUMENT/ROWSET/ROW | /ROWSET/ROW">
                     <fo:block>
                        <xsl:value-of select="DESCRIPTION" />
                     </fo:block>
                  </xsl:for-each>
               </xsl:if>
            </fo:flow>
         </fo:page-sequence>
      </fo:root>
   </xsl:template>
</xsl:stylesheet>

Below is the OUTPUT.
image.pngBut this output is wrong. it is supposed to be displayed as User's entered in Rich text item. Please help me how to achieve this Using Oracle APEX and XSL-FO.

Comments

Post Details

Added on Jan 23 2023
1 comment
896 views