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!

Export PLSQL dynamic content HTML table data into excel not working in Newer chrome version

Manjunath666Jul 24 2019 — edited Aug 12 2019

Hi,

We are using Application Express 18.1.0.00.45,

We developed a page with PLSQL dynamic content region where we have html table and we are using following javascript code to export table data into excel this code works perfectly in older chrome version like 67 and 68. but not able to export data into excel in New chrome version like 74 or 75.

We are using

HTML code for button and table

<button onclick="exportTableToExcel(''myTable'')">Export Data To Excel</button>

<table id="myTable">

- -  table data and content

</table>

Javascript function code

function exportTableToExcel(tableID, filename = ''){

   var downloadLink;

   var dataType = 'application/vnd.ms-excel';

   var tableSelect = document.getElementById(myTable);

   var tableHTML = tableSelect.outerHTML.replace(/ /g, '%20');

       filename = filename?filename+'.xls':'excel_data.xls';

       downloadLink = document.createElement("a");

        document.body.appendChild(downloadLink);

   if(navigator.msSaveOrOpenBlob){

        var blob = new Blob(['\ufeff', tableHTML], {

       type: dataType

  });

   navigator.msSaveOrOpenBlob( blob, filename);

  }else{

  downloadLink.href = 'data:' + dataType + ', ' + tableHTML;

  downloadLink.download = filename;

  downloadLink.click();

  }

}

Please suggest some other code which will compatible with newer versions of chrome or some other techniques to export HTML table data into excel in Oracle APEX.

Thanks in advance,

Manju

Comments
Post Details
Added on Jul 24 2019
8 comments
1,359 views