Want to implemnet the auto save features on word editor

We implemented a word editor in our APP using the SfDocumentEditorContaine but now we want one more advanced feature in this, we want that data autosave when the user enters in a word editor. Right now for data saving, users need to click on the Save button but now we want to save data automatically instead of clicking is this possible? if possible can you please share any samples?

We used below sample code for that

And for saving this word editor data we used the below code

public async void onItemClick(Syncfusion.Blazor.DocumentEditor.ClickEventArgs args, int position)

{

switch (args.Item.Id)

{

case "download":


SfDocumentEditor editordownlaod = containerList[position].DocumentEditor;

await editordownlaod.Save((string.Format("{0}-{1}",ID, "Summary")), FormatType.Docx);


break;


case "save":


SfDocumentEditor editor = containerList[position].DocumentEditor;

string base64Data = await editor.SaveAsBlob(FormatType.Docx);

byte[] data = Convert.FromBase64String(base64Data);


ReviewAnswers[0].Answer = data;

await SaveOnChange(ReviewAnswers[position]);


break;

}

}



2 Replies

KB Kurthis Banu Abdul Majeeth Syncfusion Team October 5, 2021 02:55 PM UTC

Hi karan, 

Currently, we are checking your query. We will check and update the further details on October 7,2021. 

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team October 7, 2021 06:24 AM UTC

Hi karan,  

We have cross checked your requirement. You implement the auto save functionality in your application like in our demo sample. 

Demo sample: 

Code snippet: 
 
<SfDocumentEditorContainer @ref="container" ID="editor" EnableToolbar="true" > 
 
        <DocumentEditorContainerEvents Created="OnCreated" ContentChanged="ContenChanged"></DocumentEditorContainerEvents> 
 
    </SfDocumentEditorContainer> 
 
 
@code { 
 
  public bool contentChanged = false; 
 
  public async void ContenChanged() 
   
 
        contentChanged = true; 
 
   
 
 
// using setInterval and save the document wherever you want using SaveAsBlob 
 
 
if (contentChanged) 
       
            //You can save the document as below 
            SfDocumentEditor editor = container.DocumentEditor; 
            string base64Data = await editor.SaveAsBlob(FormatType.Docx); 
            byte[] data = Convert.FromBase64String(base64Data); 
 
            contentChanged = false 
}} 
  
Regards, 
Kurthis Banu A. 


Loader.
Up arrow icon