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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set HTML content

Thread ID:

Created:

Updated:

Platform:

Replies:

148859 Nov 6,2019 02:19 PM UTC Nov 7,2019 09:09 AM UTC JavaScript - EJ 2 1
loading
Tags: DocumentEditor
S_Line
Asked On November 6, 2019 02:19 PM UTC

Hi, is there a possible to set a HTML content in DocumentEditor? Because, i have some of html content and i want to set in documenteditor and save in sfdt.

Thank you.

Suriya Murugan [Syncfusion]
Replied On November 7, 2019 09:09 AM UTC

Hi S_Line, 

Thank you for contacting the Syncfusion support. 

In DocumentEditor, you can open html file using Syncfusion DocIO library. So, we need to write server side WebAPI either in Asp.Net MVC or Core to achieve your requirement.  
  
To open html file, we need to use Syncfusion.DocIO library  to convert the stream to document editor internal structure. Then convert the internal structure to json. Finally, open that json in document editor.   
  
In documenteditor, you can open the html file using open() method or if you want to insert html content at current cursor position, use paste(sfdt) method. 
  
For better understanding , we have prepared the sample for your requirement. Front end in Typescript and back end in ASP.NET Core. 
  
In below sample, 
1.      Open Html button click will open the html file from server. 
2.      Insert Html will allow you to insert content at current cursor position. 
3.      You can change it based on your requirement. 
4.      Using Ctrl + S or save method , you can save the document as Sfdt. 
  
Sample link: 
 
  
  
Note: Front End sample is depending on WEP API to open the document. So, you need to run both front end sample and ASP.NET Core Web API sample simultaneously.    

Regards, 

Suriya M. 


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

Live Chat Icon For mobile
Live Chat Icon