How to convert docx to SFDT in node.js?

Hello everyone,

I'm currently working on a Node.js project where I need to convert .docx files to Syncfusion's SFDT format using the Syncfusion Document Editor. I would also like to reverse the process, converting from SFDT back to .docx.

Does anyone happen to have experience with this, or can you provide a simple example showing how to achieve these conversions?

I've looked through the official Syncfusion documentation but have yet to find a clear example that fits my needs. Any help or pointers in the right direction would be greatly appreciated.


I really appreciate any help you can provide.


4 Replies

SK Selvaprakash Karuppusamy Syncfusion Team September 6, 2023 02:30 PM UTC

Hi Marcos, 


Document editor requires server-side interactions for the below operations.

  • Open file formats other than SFDT
  • Paste with formatting
  • Restrict editing
  • Spellcheck
  • Save as file formats other than SFDT and DOCX

You can deploy web APIs for server-side dependencies of Document Editor component in the following platforms only not in NodeJs.


Workaround solution: we have created the sample in node.js. In this sample, we have accessed our ASP.NET core web service APIs to convert the docx document to SFDT and sfdt to docx.

Please refer to the below UG to know about our supported platforms for the backend.

Web services in EJ2 JavaScript Document editor control | Syncfusion

EJ2-Document-Editor-Web-Services/ASP.NET Core/src/Controllers/DocumentEditorController.cs at master · SyncfusionExamples/EJ2-Document-Editor-Web-Services (github.com)

EJ2-Document-Editor-Web-Services/ASP.NET Core/src/Controllers/DocumentEditorController.cs at master · SyncfusionExamples/EJ2-Document-Editor-Web-Services (github.com)



Attachment: node_(3)_4aeda83f.zip


DS Dhanush Sekar Syncfusion Team July 25, 2024 02:53 PM UTC

Hi Umer,


We were unable to reproduce the reported issue. We have attached a video for your reference. Please cross-check that and let us know if there are any other issues or if you need further assistance.


Regards,

Dhanush S


Attachment: NodeJs_f5bcf052.zip


US Umer Saeed July 29, 2024 01:32 PM UTC

Got it. Thanks Dhanush. 

One more question. How do I feed this sfdt string that I got after conversion to my react document editor client side and open the document there?



DS Dhanush Sekar Syncfusion Team July 29, 2024 04:54 PM UTC

Hi Umer,


You have successfully converted the Word document into SFDT using Node.js with the demo service URL. As previously mentioned, the Document Editor requires server-side interactions for the following operations:


- Opening file formats other than SFDT

- Pasting with formatting

- Restricting editing

- Spell checking

- Saving as file formats other than SFDT and DOCX


For these additional services, a server-side dependency is necessary. Therefore, implementing them with Node.js and the demo service URL is not a viable solution. You will need a server to make web API calls for these services. The service URL provided is intended for demonstration purposes only; you will need to host your own web service for development.


Demo Service URL:

https://services.syncfusion.com/js/production/api/documenteditor/


Please refer to the below UG to know about our supported platforms for the backend.

Web services in EJ2 JavaScript Document editor control | Syncfusion

EJ2-Document-Editor-Web-Services/ASP.NET Core/src/Controllers/DocumentEditorController.cs at master · SyncfusionExamples/EJ2-Document-Editor-Web-Services (github.com)


Regards,

Dhanush S


Loader.
Up arrow icon