Sfdt format not correct when converted from word docx file

Hi, Im trying to use c# to convert word to sfdt text to parse into the sync fusion editor, but the format of the word file is in isint the same as what is shown when the sfdt text passed into the sync fusion editor.

Heres the code im using:

public async Task<string> GetFileAsSfdtText(string fileId)
{
try
{
var wordBytes = await GetFileAsWord(fileId);
await using var stream = new MemoryStream(wordBytes);
var sfdtDocument = WordDocument.Load(stream, FormatType.Docx);
var sfdtText = JsonConvert.SerializeObject(sfdtDocument);
sfdtDocument.Dispose();
return sfdtText;
}
catch (Exception ex)
{
_logger.LogError(ex, "Unable to convert file to SFDT text");
throw;
}
}


Is this being done the wrong way? if so do we need to pass anything in to keep the same format the word file has? Thanks


The sdft file when displayed on the sync fusion editor looks like this below



as seen the file doesnt have any padding to the left, the bullet points are missing and theres no spacing between words, no formatting is being kept. can anyone help with this? Thanks


1 Reply

SK Selvaprakash Karuppusamy Syncfusion Team June 6, 2023 12:06 PM UTC

Hi Hundeyin,


Could you please share the input Word document from your end so that we can validate the issue on our side?

If you have any confidential data in your Word document, we recommend that you create a ticket with Syncfusion support. 

To create a support ticket: https://support.syncfusion.com/support/tickets/create


Regards,

Selvaprakash K


Loader.
Up arrow icon