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. Image for the cookie policy date

What Spreadsheet is used in the examples?

Hello,

I am trying to understand the code samples for the Spreadsheet function, but there is an important part that I don't understand. In the controllers, code such as Spreadsheet.Open() and Spreadsheet.Save() is used, for example:

public string Import(ImportRequest importRequest)
        {
            return Spreadsheet.Open(importRequest);
        }
However, when I try to use this code, it does not work, with a message that the Spreadsheet class from Syncfusion.XlsIO needs a generic type.
Am I supposed to get the Spreadsheet class from somewhere else? If not, is the example out of date or otherwise incorrect?

1 Reply

SI Silambarasan I Syncfusion Team May 12, 2017 08:50 AM UTC

Hi Zach, 
 
Thank you for using Syncfusion products. 
 
We have checked with the reported issue and we are unable to reproduce it in our end. We suspect that the cause of your issue might be the missing dependencies in your project. So, we would like to suggest you to ensure the packages ‘Syncfusion.EJ.AspNet.Core’ (Control core functionality) and ‘Syncfusion.EJ.Export’(Import Export functionality) are installed in your project.  After added it, please ensure the following code example. 
HOMECONTROLLER.CS 
using Syncfusion.JavaScript.Models; 
using Syncfusion.JavaScript; 
using Syncfusion.EJ.Export; 
 
//... 
 
public string Import(ImportRequest importRequest) 
{ 
    return Spreadsheet.Open(importRequest); 
} 
public ActionResult ExcelExport(string sheetModel, string sheetData, string password) 
{ 
    return Spreadsheet.Save(sheetModel, sheetData, "sample", ExportFormat.XLSX); 
} 
public ActionResult CsvExport(string sheetModel, string sheetData, string password) 
{ 
    return Spreadsheet.Save(sheetModel, sheetData, "sample", ExportFormat.CSV); 
} 
 
 
INDEX.CSHTML 
 
<ej-spread-sheet id="Spreadsheet"> 
    <e-scroll-settings height="560"></e-scroll-settings> 
    <e-import-settings import-mapper="Home/Import"></e-import-settings> 
    <e-export-settings excel-url="Home/ExcelExport" 
                        csv-url="Home/CsvExport" 
                        pdf-url="http://js.syncfusion.com/ejservices/api/Spreadsheet/PdfExport"></e-export-settings> 
</ej-spread-sheet> 
 
 
For your convenience, we have modified the provided sample in forum#130390 and the same can be downloaded from the below link, 
 
Also, please refer the below help documentation link for about Spreadsheet dependencies and nugget packages installation information. 
 
Regards, 
Silambarasan 


Loader.
Up arrow icon