Objective:

  • The Excel Upload Page in Oracle Apex Involves Excel Upload template design. Usually the templates will be stored in Shared Components Workspace File and through button click JavaScript call, the file get downloaded.
  • In this Document, We have different approach to template maintenance and downloaded the template using JavaScript.

 

Template Maintenance:

For Maintenance of template, Separate table is designed and template get stored as Blob content. Each template have template description describes the upload page name.

Table Script:

CREATE TABLE  “TJD_PON_TEMPLATE_MNT_TB”

(      “TMPLTE_ID” VARCHAR2(50),

“TMPLTE_DESC” VARCHAR2(100),

“BLOB_CONTENT” BLOB,

“MIME_TYPE” VARCHAR2(100),

“FILE_NAME” VARCHAR2(100),

“CREATED_BY” VARCHAR2(250),

“CREATED_DATETIME” TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP,

“UPDATED_BY” VARCHAR2(250),

“UPDATED_DATETIME” TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT “TJD_PON_TEMPLATE_MNT_PK” PRIMARY KEY (“TMPLTE_ID”)

 

)

/

Note: Design a Report with editable form for uploading the excel template file into the table.

Steps Involved:

Step1:

Create a page item and Button in the upload page.

Create a page item “P5_DOWNLOAD_TEMP” of “display only” type.

Settings:

Send on Page Submit: On

Based on: Output of pl/sql code

 

begin

sys.htp.p(‘<a id=”download_temp” href=”‘ || apex_util.get_blob_file_src(‘Blob Content item’,1) || ‘”>’||’Download</a>’);

end;

Note:

Blob Content Item should be referred from page designed for Excel template upload as shown in above screenshot.

Step 2:

Create Javascript function for downloading template and implement the code in page Function and Global Variable Declaration section.

Download Template Function:

function download_temp_fn() {

document.getElementById(“download_temp”).click();

}

Output:

 

Recommended Posts

Start typing and press Enter to search