How to Deploy ASP.NET MVC DOCX Editor for Mobile

27 Aug 20261 minute to read

DOCX Editor component for Mobile

The DOCX Editor component is currently not responsive for mobile, and the editing functionalities are not supported in mobile browsers. However, it works properly as a document viewer in mobile browsers.

Hence, it is recommended to set the DOCX Editor component to read-only in mobile browsers by using the restrictEditing property in DocumentEditorContainer or the isReadOnly property in DocumentEditor, based on your requirement. Also, invoke the fitPage method with the FitPageWidth parameter in the document change event to display one full page by adjusting the zoom factor.

<div id="documenteditor" style="width:100%;height:100%">
    @Html.EJS().DocumentEditor("container").IsReadOnly(false).EnableEditor(true).EnablePrint(true).EnableSelection(true).EnableSfdtExport(true).DocumentChange("onDocumentChange").Render()
</div>
<script>
    function onDocumentChange() {
        var container = document.getElementById("container").ej2_instances[0];
        //To detect the device
        var isMobileDevice = /Android|Windows Phone|webOS/i.test(navigator.userAgent);

        if (isMobileDevice) {
            container.restrictEditing = true;
            setTimeout(() => {
                container.documentEditor.fitPage("FitPageWidth");
            }, 50);
        }
        else {
            container.restrictEditing = false;
        }
    }
</script>

NOTE

For more information, refer to the restrictEditing property in DocumentEditorContainer and the isReadOnly property in DocumentEditor to change the component to read-only mode.