1. First create a page and create a region with (Type: Static Content).
2. Create a textarea type item. (Name: P21_CONTENT )
3. Then copy-pest the JavaScript code into Page >>JavaScript >>Function and Global Variable Declaration.
(function () {
var textFile = null,
makeTextFile = function (text) {
var data = new Blob([text], {type: 'text/plain'});
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
};
var create = document.getElementById('create'),
textbox = document.getElementById('P21_CONTENT');
var link = document.getElementById('downloadlink');
link.href = makeTextFile(textbox.value);
link.style.display = 'block';
})();
4. P21_CONTENT it is the CSS ID of P21_CONTENT of textarea item.
5. Create a button with Behavior>>Action>>Submit Page. And another one button for clearing the data of the textarea.
6. Then copy-pest the HTML code into the Region >> Source
<a download="info.txt" id="downloadlink" width="107"
height="10" ><b>Download</b></a>
JOB DONE...
Now you can see a page like this. Here you write any thing on the textarea and click on Generate Text button. Finally Click on Download link.
Demo:
1.
2.
If Not Working You One Please Comment or Contact With Me.
For any type of mistake Advance Sorry and Please inform me.
Very Nice!
ReplyDeleteThank You
DeleteHI, thanks for this, Qaium. Is it possible to perform step 6 in an APEX Button rather than in a link?
ReplyDeleteThis doesn't seem to work. It returns a NULL value from the element.
ReplyDeleteprofessionally Text file generated from Oracle table not typed on keyboard and generate Text file
ReplyDelete