"Unsupported Media Type" error when saving excel file

Hello everybody.

I am trying to implement javascript spreadsheet component in my project. I am testing and have gotten file opening to work but have not gotten file save function to work.

I implemented the WebAPI according to what is indicated in https://ej2.syncfusion.com/javascript/documentation/spreadsheet/open-save/#server-configuration.

But when I select the option to save Excel file I get the following error. "Unsupported Media Type". Using my own WebAPI, while if I use the WebAPI https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save everything works fine

I appreciate you can help me, greetings


1 Reply

SP Sangeetha Priya Murugan Syncfusion Team June 28, 2021 10:19 AM UTC

Hi Reinaldo, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and we would let you know that we would suggest you to use the FromForm property as like as below, for save action to resolve this issue in your end. For your convenience, we have prepared the sample that refer the CORE WEB API. Please find the below links. 
 
[HttpPost] 
        [Route("Open")] 
        public IActionResult Open(IFormCollection openRequest) 
        { 
            OpenRequest open = new OpenRequest(); 
            open.File = openRequest.Files[0]; 
            return Content(Workbook.Open(open)); 
        } 
 
 
        [Route("Save")] 
        public IActionResult Save([FromForm]SaveSettings saveSettings) 
        { 
            return Workbook.Save(saveSettings); 
        } 
 
 
 
Note: launch the service first and then open the stack blitz sample for open/save action. 
 
Could you please check the above details and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


Loader.
Up arrow icon