- Home
- Forum
- ASP.NET MVC - EJ 2
- Documenteditor not rendering
Documenteditor not rendering
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
SIGN IN To post a reply.
7 Replies
RT
Ramya Thirugnanam
Syncfusion Team
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
UN
Unknown
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
RT
Ramya Thirugnanam
Syncfusion Team
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
UN
Unknown
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;
}
RT
Ramya Thirugnanam
Syncfusion Team
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
CB
Christo Bosch
August 19, 2022 08:15 AM UTC
Good day,
am using document editor and it works fine on all browsers, However on the latest Firefox the font is not visible when typing. What is likely to be the cause of that and what can i do to fix that issue
Thanks
SM
Suriya Murugan
Syncfusion Team
August 24, 2022 05:02 AM UTC
Hi Christo,
Can you please share your document editor version and firefox version details with environment details?
If possible, please share simple sample to check this issue in our side?
Regards,
Suriya M.
SIGN IN To post a reply.
- 7 Replies
- 4 Participants
-
UN Unknown
- Mar 4, 2019 09:25 PM UTC
- Aug 24, 2022 05:02 AM UTC