Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page controller="uploadDataTosObject" apiVersion="36.0">
- [Code....]
- <apex:form>
- <script>
- function setVal(result)
- {
- document.getElementById("{!$Component.hdnField}").value =result;
- }
- </script>
- <apex:inputHidden id="hdnField" value="{!myblob}" />
- <apex:commandButton value="Post Page" action="{!post}" />
- </apex:form>
- <script>
- setVal();
- </script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.js">
- </script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"> </script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
- [Code...]
- function to_csv(workbook) {
- var result = [];
- workbook.SheetNames.forEach(function(sheetName) {
- var csv = X.utils.sheet_to_csv(workbook.Sheets[sheetName]);
- if(csv.length > 0){
- result.push("SHEET: " + sheetName);
- result.push("");
- result.push(csv);
- }
- });
- output = setval(result.join("n"));
- return result.join("n");
- }
- [Code...]
- </body>
- </apex:page>
- public with sharing class uploadDataTosObject {
- public String myblob {get; set;}
- public void post(){
- system.debug(myblob);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement