BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi
I used the code as below.
<div class="row">
<div class="col-xl-12">
<ejs-documenteditorcontainer id="container" layoutType="Continuous" enableLocalPaste="true" documentEditorSettings="true" enableToolbar=true height="810px">
</ejs-documenteditorcontainer>
</div>
</div>
<script>
var documenteditor;
var container;
document.addEventListener('DOMContentLoaded', function () {
var documenteditorElement = document.getElementById("container");
container = documenteditorElement.ej2_instances[0];
documenteditor = container.documentEditor;
documenteditor.resize();
var ajax = new XMLHttpRequest();
ajax.open('POST', 'Import', true);
ajax.onreadystatechange = function () {
if (ajax.readyState === 4) {
if (ajax.status === 200 || ajax.status === 304) {
// open SFDT text in document editor
documenteditor.open(ajax.responseText);
}
}
}
var JobNo = sessionStorage.getItem('JobKey');
var formData = new FormData();
formData.append('JobNo', JobNo);
ajax.send(formData);
});
<script>
public string Import(string JobNo)
{
if (!Directory.Exists(ConnectionInformation.BasePath + "\\Project_PDF\\" + JobNo))
{
Directory.CreateDirectory(ConnectionInformation.BasePath + "\\Project_PDF\\" + JobNo);
}
string filePath = ConnectionInformation.BasePath + "\\Project_PDF\\" + JobNo + "\\" + JobNo + ".docx";
EJ2DocumentEditor.WordDocument document = new EJ2DocumentEditor.WordDocument();
if (System.IO.File.Exists(filePath))
{
string sfdt = string.Empty;
using (FileStream inputStream1 = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite))
{
IFormFile formFile = new FormFile(inputStream1, 0, inputStream1.Length, "", JobNo + ".docx"); // converting MemoryStream to IFormFile
Stream stream = new MemoryStream();
formFile.CopyTo(stream);
stream.Position = 0;
document = EJ2DocumentEditor.WordDocument.Load(stream, EJ2DocumentEditor.FormatType.Docx);
sfdt = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
inputStream1.Dispose();
inputStream1.Close();
}
return sfdt;
}
else
{
return null;
}
}
Hi TaeWook,
We are unable to reproduce the reported issue. So, could you please provide us the input Word document which used at your end. Thereby, we will analyze further and provide you the appropriate solution at the earliest.
If you have any confidential data in your Word document, we recommend that you create a ticket with Syncfusion support.
To create a support ticket:
https://support.syncfusion.com/support/tickets/create
Regards,
Selvaprakash K