We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Programmatically trigger "open" command from backstage

Thread ID:

Created:

Updated:

Platform:

Replies:

133065 Oct 6,2017 05:40 PM Oct 9,2017 03:20 AM JavaScript 1
loading
Tags: ejSpreadSheet
James Pham
Asked On October 6, 2017 05:40 PM

Hi, can you advise on how to programmatically trigger the "open" command from the spreadsheet's backstage? I understand there's an "import" method available,

<div id="Spreadsheet"></div> 
<script>
var excelObj = $("#Spreadsheet").data("ejSpreadsheet"); // Initialize the Spreadsheet object.
var importRequest = { Url:"http://staging.syncfusion.com:7777/ejSpreadsheet/Spreadsheet.xlsx" };
excelObj.import(importRequest); 
</script>
but I would like to take advantage of the file dialog that comes with the backstage open command so the user can import an excel file from the user's local filesystem.

Thanks in advance.

James


Sangeetha Priya Murugan [Syncfusion]
Replied On October 9, 2017 03:20 AM

Hi James Pham,   
 
Thank you for contacting Syncfusion Support. 
 
We have checked your query and your requirement for programmatically trigger the "FILE->Open" option can be achievable in Spreadsheet. Please refer the following code example.  
 
[HTML] 
 
 //…  
 
    <button id="fileImportBtn">File Import</button> 
    <div id="Spreadsheet"></div> 
  
 
[SCRIPT] 
  
$("#Spreadsheet").ejSpreadsheet({  
     //…     
});  
  
$("#fileImportBtn").click(function () { 
        var ssObj = $("#Spreadsheet").data("ejSpreadsheet"); 
         //Import File using ribbon action programmatically. 
         $("#" + ssObj._id + "_file .e-uploadinput").click(); 
}); 
  
 
For your convenience, we have prepared a sample to demonstrate this in JSPlayground.  
  
Regards   
Sangeetha Priya M  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;