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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically trigger "open" command from backstage

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 07:20 AM UTC

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;