WordDocument.Save() not working as it used to

Hi. I was using version 19.3.0.45 of Syncfusion.EJ2.WordEditor.AspNet.Core and my code worked as I expected but when upgrading the package to anything higher I get a null reference exception.



"something" is a sftd string.

Thank you.


5 Replies

KB Kurthis Banu Abdul Majeeth Syncfusion Team November 24, 2021 11:26 AM UTC

Hi Prashan, 

We have cross checked your reported issue.We need some additional information for your reported issue. So, could you please share the input document which is used on your end?  

This will be more helpful to reproduce the same issue at our end. Thereby, we will proceed further on the reported issue and provide you the appropriate solution at the earliest.  

Note: If you have any confidential data in your document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.  

Regards, 
Kurthis Banu A. 



PR Prashan November 24, 2021 11:30 AM UTC

Hi Kurthis 


Thank you for responding. I've attached my sftd file zipped.


Kind regards,

Prashan



Attachment: myInput_ebea3638.7z


KB Kurthis Banu Abdul Majeeth Syncfusion Team November 25, 2021 02:33 PM UTC

Hi Prashan, 

## Load your sfdt into Document Editor and Save  

We have cross checked your reported problem. When we load the Sfdt into Document Editor and save the document as docx in server side,its working fine without any exceptions. For your reference we have provided the sample in below. 
 
Client-side sample: 

Server-side code snippet: 
        [AcceptVerbs("Post")] 
        [HttpPost] 
        [EnableCors("AllowAllOrigins")] 
        [Route("SaveDocument")] 
        public string SaveDocument([FromBody] SaveParameter data) 
        { 
            try 
            { 
                Stream document = WordDocument.Save(data.content, FormatType.Docx); 
                FileStream file = new FileStream("sample.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite); 
                document.CopyTo(file); 
                file.Close(); 
                document.Close(); 
 
                return "Sucess"; 
            } 
 
            catch(Exception e) 
            { 
                return (e.Message); 
            } 
             
 
        } 

## Direct Save (Without loading) 

We are facing issue in whenever save the document without loading into Document Editor. 
We would like to inform you, recently we have added some new features in latest versions. So, we suspected sfdt file structure might be as problem. We need some additional details and steps involved in generating the shared SFDT file. So, could share the steps to check your reported problem. 

Thereby, we will proceed further on the reported issue and provide you the appropriate solution at the earliest.  

Regards, 
Kurthis Banu A. 



PR Prashan November 26, 2021 11:50 AM UTC

Thank you for your response. I think you were right to suspect the sftd file. I investigated further and noticed that a package Syncfusion.EJ2.JavaScript was way out of date. Comparing what I had with the most recent, the sftd was alot different with the newer sftd  working correctly with  WordDocument.Save(). I think we could mark this as resolved. Thanks again.



KB Kurthis Banu Abdul Majeeth Syncfusion Team November 26, 2021 12:46 PM UTC

Hi Prashan, 

Thanks for your update. 

Regards, 
Kurthis Banu A. 


Loader.
Up arrow icon