Get blob data of spreadsheet on save

I'm using angular spreadsheet component and I want to get blob data of current active sheet on client side.

Here in this link https://ej2.syncfusion.com/angular/documentation/spreadsheet/open-save/#save it is mentioned that if I set needBlobData property of beforeSaveEventArgs to true, then I'll get the blob data but I'm not getting it. 

Please Clarify how to get blob data after this. If there is any other way to get blob data ( not Json data ) of current active sheet then please elaborate.

Here is my code

beforeSave(args: BeforeSaveEventArgs) {
args.needBlobData = true;
args.cancel = true;
console.log(args);
}

triggerSave() {
this.spreadsheetObj.save(
{url: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save',
fileName: "Sample", saveType: "Xlsx"});
}


5 Replies 1 reply marked as answer

SP Sangeetha Priya Murugan Syncfusion Team December 6, 2021 08:04 AM UTC

Hi Vivek, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported query and we would like to let you know that, we can be able to get the blob data of spreadsheet in saveComplete event, by setting isFullPost property as false in beforeSave event. 
 
 
  beforeSave(args: BeforeSaveEventArgs) { 
    args.needBlobData = true; 
    args.isFullPost = false; 
    console.log(args); 
  } 
  saveComplete(args) { 
    console.log(args.blobData); // returns blob data 
  } 
 
<ejs-spreadsheet 
    #default 
    [openUrl]="openUrl" 
    [saveUrl]="saveUrl" 
    (created)="created()" 
    (beforeSave)="beforeSave($event)" 
    (saveComplete)="saveComplete($event)" 
  > 
  </ejs-spreadsheet> 
 
For your convenience, we have prepared the sample based on our suggestion. Please find the link below.  
 
 
Could you please check the above details and get back to us, if you need any further assistance on this? 
 
Regards, 
Sangeetha M 


Marked as answer

VS Vivek Singhal replied to Sangeetha Priya Murugan December 7, 2021 06:35 AM UTC

Thanks Sangeetha. It worked perfectly.



SP Sangeetha Priya Murugan Syncfusion Team December 7, 2021 09:20 AM UTC

Hi Vivek, 
 
Thank you for your update. 
 
We are happy to hear that your issue has been resolved. Kindly get back to us if you need any further assistance. 
 
Regards, 
Sangeetha M 



VS Vivek Singhal replied to Sangeetha Priya Murugan December 7, 2021 09:59 AM UTC

Currently Getting this evaluation warning on generated File via the blob, "Created with a trial version of Syncfusion Essential XlsIO".

We're using Syncfusion Angular Spreadsheet component. We're gonna buy the package next week.

Will this warning be removed automatically after buying the syncfusion angular package? Or we'll have to buy the xlsIO package as well?

Also will the warning be removed on localhost as well??

The code I'm using for generating the file

saveComplete(args) {
const file = new File([args.blobData],
"sample", {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}); FileSaver.saveAs(file);
}


SP Sangeetha Priya Murugan Syncfusion Team December 8, 2021 11:46 AM UTC

Hi Vivek, 
 
Thank you for your patience. 
 
We have checked your reported requirement and we would like to let you know that we have used our ej2 services for demo purpose only. So we suggest you to use your local service for open/save functionality. For local service you need ASP.NET Core project as a backend for Open/Save functionality in your angular application. 
 
Create ASP.NET Core project and generate the license based on the below KB link. 
 
 
And include the licensed key in your project startup file as like in the below documentation link. 
 
 
The list of below dependencies are required to use the EJ2 Spreadsheet in your application.  
 
1. Syncfusion.EJ2  
 
2. Syncfusion.EJ2.Spreadsheet 
 
3. Syncfusion.Compression.Base 
 
4. Syncfusion.XlsIO.Base 
 
For more details Please refer the below links. 
 
 
For more details regarding the Open/Save server functionality. Please refer the below links. 
 
 
NOTE: Please use the trial license key to resolve this issue in your end until then you have purchased the package. 
 
Regards, 
Sangeetha M 


Loader.
Up arrow icon