How to save a spreadsheet

Hello,

I actually want to save a spreadsheet using the save() function not saveAsJson() because I want to convert the spreadsheet into stream and save in the backend this way.
I'm using Vue.Js for the frontend and ASPNet for the backend.

Thanks for your help,


4 Replies 1 reply marked as answer

GK Gayathri KarunaiAnandam Syncfusion Team February 15, 2021 12:43 PM UTC

Hi Omar, 

Thanks for contacting Syncfusion Support. 

We have checked your reported query, “How to save a spreadsheet”. We can save a spreadsheet by using controllers as demonstrated in the below code. You have to run the service and paste the localhost URL to the save method. When you click the save option, the file in controller is converted to stream by the below code and saved. 
Controller: 
public IActionResult Save(SaveSettings saveSettings) 
        { 
             
            Stream dataStream = Workbook.Save<Stream>(saveSettings); //convert into stream 
            dataStream.Position = 0; 
         // your code here  
}  
 

Could you please check the above code snippet and get back to us, if you need any further assistance?  

Regards, 
Gayathri K 


Marked as answer

OM Omar February 16, 2021 09:50 AM UTC

Hi Gayathri,

I actually have the saving functionality same as you proposed beforehand.
Okay, my point is to pass the spreadsheet as stream from the frontend to the backend.
as it's the case with the "DocumentEditor" component, I use a function called saveAsBlob() which is responsible for converting the document blob of data. which happens very fast.

Whereas in the "Spreadsheet" component it's taking too much time
Is there something similar to that in the spreadsheet component because it's so slow actually while loading or saving the spreadsheet
and when debugging I found out that this line taking a lot of time.:
var stream = Workbook.Save<Stream>(saveSettings);


Thanks,


OM Omar February 16, 2021 12:47 PM UTC

Opening documents is also very slow, if there's a way to open files from stream it's be much faster than using:
Workbook.Open(OpenRequest);


GK Gayathri KarunaiAnandam Syncfusion Team February 17, 2021 12:52 PM UTC

Hi Omar, 

We checked your reported query. We would let you know that we have provided the Knowledge base solution for both ASP.NET MVC and ASP.NET Core, which explains the way to save and retrieve the Spreadsheet data as a byte array from saved JSON in the Database. Please refer to the below link. 
 
KB link: 
 
If you are still facing the issue, please share the below details to check further. 
 
·        Please share the imported file you are using. 
·        If possible, please share the video of the issue. 
·        Please share the customization codes you are using. 
 
Could you please check the above links and get back to us with the above requested information, based on that we will check and provide you a better solution quickly. 
 
Regards, 
Gayathri K 


Loader.
Up arrow icon