[英]Integrate SpreadJS in Oracle APEX
I am new to Oracle APEX, i am using apex version 21.1.0, i just want to upload excel file with password protected, so i have used Spread JS java script plugin, while i am trying to integrate i am getting this below error which attached in screenshot. I am new to Oracle APEX, i am using apex version 21.1.0, i just want to upload excel file with password protected, so i have used Spread JS java script plugin, while i am trying to integrate i am getting this below error which附在屏幕截图中。
I have a Oracle APEX form like below:我有一个 Oracle APEX 表格,如下所示:
I have created one region, and three page items我创建了一个区域和三个页面项
The page properties like below:页面属性如下:
I have added the below code in HTML Header我在 HTML Header 中添加了以下代码
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://www.grapecity.com/spreadjs/demos/en/purejs /node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script>
<script src="https://www.grapecity.com/spreadjs/demos/spread/source/js/FileSaver.js" type="text/javascript"></script>
<script src="https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-excelio/dist/gc.spread.excelio.min.js" type="text/javascript"></script>
<script src="https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets-charts/dist/gc.spread.sheets.charts.min.js" type="text/javascript"></script>
<script src="https://www.grapecity.com/spreadjs/demos/spread/source/js/license.js" type="text/javascript"></script>
<script src="https://www.grapecity.com/spreadjs/demos/spread/source/data/excel_data.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("append"), {calcOnDemand: true});
spread.fromJSON(jsonData);
var excelIo = new GC.Spread.Excel.IO();
document.getElementById('B43349412666678933129').onclick = function () {
var excelFile = document.getElementById("P2_UPLOAD_FILE").files[0];
var password = document.getElementById('P2_PASSWORD').value;
// here is excel IO API
excelIo.open(excelFile, function (json) {
var workbookObj = json;
spread.fromJSON(workbookObj);
}, function (e) {
// process error
alert(e.errorMessage);
if (e.errorCode === 2/*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) {
document.getElementById('P2_PASSWORD').onselect = null;
}
}, {password: password});
};
};
</script>
</head>
<body>
<div id="append"></div>
</body>
Please correct me if i am wrong or missed something.如果我错了或遗漏了什么,请纠正我。
Thanks,谢谢,
I am a Technical Engagement Engineer of GrapeCity supporting SpreadJS.我是支持 SpreadJS 的 GrapeCity 的技术参与工程师。 I wanted to note that SpreadJS, as of the current version (V14.1.0), it is not tested for or uses APEX software.
我想指出的是,SpreadJS,从当前版本(V14.1.0)开始,它没有经过测试或使用 APEX 软件。 If you experience any issues please report them to the SpreadJS team here: https://www.grapecity.com/my-account/my-support/
如果您遇到任何问题,请在此处向 SpreadJS 团队报告: https://www.grapecity.com/my-account/my-support/
I was able to integrate SpreadJS to an APEX application following these steps:我能够按照以下步骤将 SpreadJS 集成到 APEX 应用程序中:
Here are the necessary SpreadJS links:以下是必要的 SpreadJS 链接:
JS: JS:
https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js
https://www.grapecity.com/spreadjs/demos/spread/source/js/FileSaver.js https://www.grapecity.com/spreadjs/demos/spread/source/js/FileSaver.js
https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-excelio/dist/gc.spread.excelio.min.js https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-excelio/dist/gc.spread.excelio.min.js
https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets-charts/dist/gc.spread.sheets.charts.min.js https://www.grapecity.com/spreadjs/demos/en/purejs/node_modules/@grapecity/spread-sheets-charts/dist/gc.spread.sheets.charts.min.js
CSS: CSS:
A File Browser type named P1_UPLOAD_FILE名为P1_UPLOAD_FILE的文件浏览器类型
A Password type item named P1_PASSWORD名为P1_PASSWORD的密码类型项
A Button titled Import with the Static ID being import , the Static ID property can be found under the Advanced properties :一个名为 Import 的按钮,其 Static ID 为import , Static ID 属性可以在Advanced 属性下找到:
GC.Spread.Sheets.LicenseKey = "sjs-distribution key"; window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {calcOnDemand: true}); var excelIo = new GC.Spread.Excel.IO(); document.getElementById('import').onclick = function () { var excelFile = document.getElementById("P1_UPLOAD_FILE").files[0]; var password = document.getElementById('P1_PASSWORD').value; // here is excel IO API excelIo.open(excelFile, function (json) { var workbookObj = json; spread.fromJSON(workbookObj); }, function (e) { // process error alert(e.errorMessage); if (e.errorCode === 2/*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) { document.getElementById('password').onselect = null; } }, {password: password}); }; }
As I shared previously in my post, please keep in mind that SpreadJS has not been tested within an APEX application so there may be some unexpected behavior.正如我之前在帖子中所分享的,请记住,SpreadJS 尚未在 APEX 应用程序中进行测试,因此可能会出现一些意外行为。 Please reach out to SpreadJS's team if you encounter any issues!
如果您遇到任何问题,请联系 SpreadJS 的团队!
Best,最好的,
Mackenzie Albitz |麦肯齐阿尔比兹 | Technical Engagement Engineer at GrapeCity |
GrapeCity 技术参与工程师 | SpreadJS
传播JS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.