Hi All,
We are working on a requirement where in the User need to Directly Import the contents of a File to an APEX Text Area (Rich Text).
Process as Below :
- User will Browse and Select a File ( WORD / EXCEL / PDF)
- On Selection the content of the File need to be Read and Displayed as an EDITABLE TEXT in the APEX Page
- Should Retain the Source Document Format ( inclusive of Tables, Images that may be in the document)
We have tried the below approaches till now and facing the challenges:
1. Approach-1:
a. Import the file to a Temporary DB Table as an BLOB Content
b. Convert the BLOB to a CLOB
CREATE OR REPLACE FUNCTION APEX.blob_to_clob (blob_in IN BLOB)
RETURN CLOB
AS
v_clob CLOB;
v_varchar VARCHAR2(32767);
v_start PLS_INTEGER := 1;
v_buffer PLS_INTEGER := 32767;
BEGIN
DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
LOOP
v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));
DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
v_start := v_start + v_buffer;
END LOOP;
RETURN v_clob;
END blob_to_clob;
c. Content Showing up as SPL Characters and does not retain the format
2. Approach-2:
- a. Directly Copy-Paste the Content to the APEX Field - Rich Text Area . The Text Content gets saved with the formatting and able to retrieve as well.
b. It does not support the Copy of Images & also Does not save the images
Appreciate your Valuable Suggestions / pointers in this regard