Skip to main content

DocumentEditor

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

The Document Editor component is used to create, edit, view, and print Word documents in web applications. All the user interactions and editing operations that run purely in the client-side provides much faster editing experience to the users.

public class DocumentEditor : ej2Base

The control wraps the EJ2 DocumentEditorContainer component. The serviceUrl option is set by the control when the widget is created or updated, replacing any value assigned in the options.

The client side wrapper of the widget defines two functions that can be invoked from the server using Call and CallAsync: openFile(sfdt) opens a document in the Syncfusion SFDT format, and getDocument() returns the current document in the DOCX format encoded as a base64 data URL.

Example:

The following example opens a document and then retrieves the edited document from the browser.

// sfdt is a string that contains a document in the SFDT format.
this.documentEditor1.Call("openFile", sfdt);

// returns "data:{mime type};base64,{content of the DOCX file}".
string dataUrl = await this.documentEditor1.CallAsync("getDocument");
byte[] docx = Convert.FromBase64String(dataUrl.Substring(dataUrl.IndexOf("base64,") + 7));

Constructors​

Instance member DocumentEditor()​

Constructs a new instance of the DocumentEditor class.

Example:

The following example creates a document editor and configures it through the Options object.

var editor = new DocumentEditor();
editor.Options.enableToolbar = true;
editor.Options.showPropertiesPane = false;
editor.Dock = DockStyle.Fill;
this.Controls.Add(editor);

Instance member DocumentEditor(options)​

Constructs a new instance of the DocumentEditor class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a document editor that tracks the changes made by the current user.

var editor = new DocumentEditor(new
{
enableToolbar = true,
enableTrackChanges = true,
currentUser = "Nancy Davolio"
});
editor.Dock = DockStyle.Fill;
this.Controls.Add(editor);

Implements​