Before I used a button for saving the data on word editor but now we want to save data when the user changes the value in the word file.
So one kind of future that the user wants to saves the data while they updating the documents. So is there any event that exists in the word editor which calls while the user updates anything in documents. ? so using that I can able to save the updated data.
On the Same Page, I have multiple SfDocumentEditorContainer as pre-given sample code and for achieving the above features I used the below ContentChanged method but it works sometimes and sometimes giving an error that object reference not set. Can you please guide us is there any way to achieve the above features which we want? Thanks.
public async void OnDocumentChange(Syncfusion.Blazor.DocumentEditor.ContainerContentChangeEventArgs args, int position)
{
try
{
DocumentEditorModule editor = containerList[position].GetDocumentEditor();
string base64Data = await editor.SaveAsBlob(FormatType.Docx);
byte[] data = Convert.FromBase64String(base64Data);
ReviewAnswers[0].Answer = data;
await SaveOnChange(ReviewAnswers[position]);
}
catch (Exception ex)
{
throw;
}
}
// Sample Code
@for (var i = 0; i < ReviewAnswers.Count; i++)
{
var position = i;
<SfDocumentEditorContainer Height="670px" Width="1250px" @ref="containerList[position]" EnableToolbar=true ToolbarItems="@ToolbarItemsWord">
<DocumentEditorContainerEvents Created="@(e =>OnLoad(e,position))" OnToolbarClick="@(e =>onItemClick(e,position))" ContentChanged="@(e =>OnDocumentChange(e,position))"></DocumentEditorContainerEvents>
</SfDocumentEditorContainer>
}