Search results

Server side export in JavaScript DocumentEditor control

Sfdt to Docx export

Document editor supports server-side export of Syncfusion Document Text (.sfdt) to Doc, Docx, Rtf, Txt, WordML, Html formats using server-side helper Syncfusion.EJ2.DocumentEditor available in ASP.NET Core & ASP.NET MVC platform in the below nugets.

Please refer the following code example.

//API controller for the conversion.
public void ExportSFDT([FromBody]SaveParameter data)
    Stream document = WordDocument.Save(data.content, FormatType.Docx);
    FileStream file = new FileStream("sample.docx", FileMode.OpenOrCreate, FileAccess.ReadWrite);

public class SaveParameter
    public string content { get; set; }

Please refer the client side example to serialize the sfdt and send to the server.

import { DocumentEditor, FormatType, WordExport, SfdtExport } from '@syncfusion/ej2-documenteditor';

DocumentEditor.Inject(WordExport, SfdtExport);

let documenteditor: DocumentEditor = new DocumentEditor({ enableSfdtExport: true, enableWordExport: true, enableTextExport: true });


document.getElementById('export').addEventListener('click', () => {
    let http: XMLHttpRequest = new XMLHttpRequest();'POST', 'http://localhost:5000/api/documenteditor/ExportSFDT');
    http.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
    http.responseType = 'json';
    let sfdt: any = { content: documenteditor.serialize() };

DocumentEditor object is available in DocumentEditorContainer component(DocumentEditor packaged with toolbar, statusbar & properties pane) as documentEditor