Error when loading image in data from ASP.NET Core

Hi Syncfusion Team,

I have an issue with the image in the data which I get from BE (I use ASP.NET Core).

BE codes:

await using var fileStream = await DownloadFileFromPath(documentPath.ToString());
var document = WordDocument.Load(fileStream, FormatType.Docx);
document.OptimizeSfdt = false;
var sfdtContent = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
return Ok(sfdtContent);

In the FE sides: I get the data and use the open() method to open the document by DocumentEditor.

Everything works perfectly, except the image.

Image_3680_1702051748689

I opened the network tab and I got this:

Image_7791_1702051896021

I figured out that the images is stored in the images array.

If i remove that image and post a new image by clicking the Images option in the toolbar, then I close the documentEditor; and when I re-open it, that error is disappeared.

Image_7273_1702052354339

Note that when I close the documentEditor, I send a post request to BE to save the content.

FE codes: 

const sfdt: any = { content: this.DEContainer.documentEditor.serialize() };
    this._editDocumentApi.saveDraftDocumentData(sfdt)
    .subscribe((response) => {console.log(response))

BE codes:

await _sfdtDocumentStorageService.SaveTaskSFDTDocument(model.Content, actionId, TenantId);

In this case, when I opened the network tab, I got this:
Image_5526_1702053836830

I think maybe if the image data is returned like this, the error will not be appeared.

So, How can I fix this error?

Please inform to me if you have any question.


Regrads,

Nguyen.


3 Replies

GS Gayathri Swetha Magesh Syncfusion Team December 12, 2023 11:06 AM UTC

Hi,

In response to your inquiry, we attempted to recreate the problem using the attached sample in the latest version. However, we were unable to replicate the issue as the image is displaying correctly. Please review the sample and if there are any modifications you would like us to make in order to recreate the problem, please make those changes and send us the modified sample.


Regards,
Gayathri Swetha


Attachment: Asp.NetCoreClient_70ce5859.zip


NH nguyen hoang phuong replied to Gayathri Swetha Magesh December 13, 2023 07:46 AM UTC

Hi,


Thanks for your support. My issue is solved in the latest version of ej2-angular-documenteditor.


Regards,

Nguyen



GS Gayathri Swetha Magesh Syncfusion Team December 14, 2023 03:53 AM UTC

Thanks for the update!


Loader.
Up arrow icon