We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Documenteditor not rendering

Thread ID:

Created:

Updated:

Platform:

Replies:

143095 Mar 4,2019 09:25 PM UTC Mar 12,2019 09:35 AM UTC ASP.NET MVC - EJ 2 5
loading
Tags: DocumentEditor
Roy van Es
Asked On March 4, 2019 09:25 PM UTC

DocumentEditorContainer is not showing. Other controls are not showing either. I don't get any errors, control is just not showing


cshtml file:
@Html.EJS().DocumentEditorContainer("container").EnableToolbar(true).Render()

layout file:
 @RenderSection("Scripts", false)

 <!-- Syncfusion Essential JS 2 ScriptManager -->
@Html.EJS().ScriptManager()

web.config:
<add key="UnobtrusiveJavaScriptEnabled" value="false" />

<add namespace="Syncfusion.EJ2"/>

js files:
ej2.min.js is loaded
material.css is loaded

Ramya Thirugnanam [Syncfusion]
Replied On March 5, 2019 05:18 AM UTC

Hi Roy,  
 
Thanks for contacting Syncfusion support.  
 
We are not able to reproduce the reported issue from our side. For your convenience, we have prepared a demo sample for DocumentEditor in ASP.NET MVC 5. Please find the sample from below link.  
 
 
Regards, 
Ramya T 


Roy van Es
Replied On March 5, 2019 09:51 AM UTC

Hello Ramya,

Thank you for the quick reply and the example.
I have looked at the example and when I run this example everything works well. But when trying to get it to work in our application it doesn't show anything. Also simple control like a datepicker isn't working. It is just adding empty tags like this

  <input id="MyFirstDatepicker">
  <documenteditor-container id="container" style="height: 1023px;"></documenteditor-container>
                            
The controls are added in a partial view, maybe this a problem?

Regards,

Roy

Ramya Thirugnanam [Syncfusion]
Replied On March 5, 2019 11:08 AM UTC

Hi Roy,   
 
Could you please provide us the simple sample or code example to replicate the reported issue or to represent your scenario?  This will help us to investigate on the reported issue and provide you the appropriate solution at earliest. 
 
Regards, 
Ramya T 


Roy van Es
Replied On March 11, 2019 08:40 PM UTC

Hello Ramya,

I'm sorry for my late reply. It wasn't possible to send the project as it is a part of a bigger project and the code can't be shared. I figured it out why it was not showing. Because it is loading within a partial view I had to add the following code to the partial view itself

<!-- Syncfusion Essential JS 2 ScriptManager -->
@Html.EJS().ScriptManager()

It is showing but I'm not possible to load a document yet. I added the following line of code in the view, like the example you send me.

@Html.EJS().DocumentEditorContainer("container").ServiceUrl("ap/DocumentEditor/Import").EnableToolbar(true).Render()

at application start we have the following routing in RegisterRoutes

 //ASP.NET Web API Route Config
            routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

And we have a controller

[RoutePrefix("api/documenteditor")]
    public class DocumentEditorController : ApiController
    {
        [HttpPost]
        [Route("Import")]
        public HttpResponseMessage Import()
        {
            if (HttpContext.Current.Request.Files.Count == 0)
                return null;

            HttpPostedFile file = HttpContext.Current.Request.Files[0];
            int index = file.FileName.LastIndexOf('.');
            string type = index > -1 && index < file.FileName.Length - 1 ?
                file.FileName.Substring(index) : ".docx";
            Stream stream = file.InputStream;
            stream.Position = 0;

            EJ2WordDocument document = EJ2WordDocument.Load(stream, GetFormatType(type.ToLower()));
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(document);
            document.Dispose();
            return new HttpResponseMessage() { Content = new StringContent(json) };
        }

        internal static Syncfusion.EJ2.DocumentEditor.FormatType GetFormatType(string format)
        {
            if (string.IsNullOrEmpty(format))
                throw new NotSupportedException("EJ2 DocumentEditor does not support this file format.");
            switch (format.ToLower())
            {
                case ".dotx":
                case ".docx":
                case ".docm":
                case ".dotm":
                    return Syncfusion.EJ2.DocumentEditor.FormatType.Docx;
                case ".dot":
                case ".doc":
                    return Syncfusion.EJ2.DocumentEditor.FormatType.Doc;
                case ".rtf":
                    return Syncfusion.EJ2.DocumentEditor.FormatType.Rtf;
                case ".txt":
                    return Syncfusion.EJ2.DocumentEditor.FormatType.Txt;
                case ".xml":
                    return Syncfusion.EJ2.DocumentEditor.FormatType.WordML;
                default:
                    throw new NotSupportedException("EJ2 DocumentEditor does not support this file format.");
            }
        }

        public string ImportWordDocument(Stream stream)
        {
            string sfdtText = "";
            EJ2WordDocument document = EJ2WordDocument.Load(stream, Syncfusion.EJ2.DocumentEditor.FormatType.Docx);
            sfdtText = Newtonsoft.Json.JsonConvert.SerializeObject(document);
            document.Dispose();
            return sfdtText;
        }


Ramya Thirugnanam [Syncfusion]
Replied On March 12, 2019 09:35 AM UTC

Hi Roy, 
We were unable to reproduce the reported issue.  A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates . 
 
Regards, 
Ramya T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;