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

Read only text editor with export tools

Thread ID:

Created:

Updated:

Platform:

Replies:

143806 Apr 5,2019 11:18 AM UTC Apr 8,2019 03:43 PM UTC ASP.NET MVC 3
loading
Tags: RichTextEditor
Mihael
Asked On April 5, 2019 11:18 AM UTC

Sample code:

@{
    List<String> toolsList = new List<string>() { "importExport" };
    List<String> ImportExport = new List<string>() { "wordExport", "pdfExport" };
}
@{Html.EJ().RTE("rteSample").Width("100%").ContentTemplate(@<div>
    <p><b>Description:</b></p>
    <p>
        The Rich Text Editor (RTE) control is an easy to render in
        client side. Customer easy to edit the contents and get the HTML content for
        the displayed content. A rich text editor control provides users with a toolbar
        that helps them to apply rich text formats to the text entered in the text
        area.
    </p>
    <p>
        <b>
            Functional
            Specifications/Requirements:
        </b>
    </p>
    <ol>
        <li>
            <p>
                Provide
                the tool bar support, it’s also customizable.
            </p>
        </li>               
        <li>
            <p>
                Provide
                efficient public methods and client side events.
            </p>
        </li>
        <li>
            <p>
                Keyboard
                navigation support.
            </p>
        </li>
    </ol>
</div>).MinWidth("200px").MinHeight("500px").AllowEditing(false).ToolsList(toolsList).Tools(tool => tool.ImportExport(ImportExport))     
      .ExportToWordSettings(exportToWordSettings => exportToWordSettings.Url("Home/ExportToWord").FileName("WordExport"))
      .ExportToPdfSettings(exportToPdfSettings => exportToPdfSettings.Url("Home/ExportToPDF").FileName("PdfExport")).Render();}

How can I achieve to be able to export to word and pdf with AllowEditing(false), so i want read only text editor without import.
It works without AllowEditing(false) but then rte is editable.
Thanks


Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On April 8, 2019 01:02 PM UTC

Hi Mihael, 

Thanks for contacting Syncfusion support. 
  
We have validated your reported query on ejRTE. We have prepared an solution to achieve your requirement of having the text area of RTE as un editable. For your information, RTE’s content area is rendered with iframe element, by setting contentEditable attribute as false of the body element in the iframe, we can prevent editing in its container element. Please, refer the below code snippet to achieve you requirement. 

[index.cshtml] 
@{ 
    List<String> toolsList = new List<string>() { "importExport" }; 
    List<String> ImportExport = new List<string>() { "wordExport", "pdfExport" }; 
} 
@{ 
    Html.EJ().RTE("rteSample").Width("100%").ContentTemplate(@<div> 
    &lt;p&gt;The Rich Text Editor (RTE) control is an easy to render in 
    client side. Customer easy to edit the contents and get the HTML content for 
    the displayed content. A rich text editor control provides users with a toolbar 
    that helps them to apply rich text formats to the text entered in the text 
    area. &lt;/p&gt; 
</div>).MinWidth("200px").ToolsList(toolsList).Tools(tool => tool.ImportExport(ImportExport)) 
.ExportToWordSettings(exportToWordSettings => exportToWordSettings.Url("ExportToWord").FileName("WordExport")) 
.ExportToPdfSettings(exportToPdfSettings => exportToPdfSettings.Url("ExportToPDF").FileName("PdfExport")).Render(); 
} 
 
<script> 
    $(function () { 
        //setting the contentEditable as false to prevent editing in RTE text area by using RTE instance 
($($("#rteSample").ejRTE("instance").wrapper[0]).find("iframe"))[0].contentDocument.body.contentEditable = false; 
    }); 
</script> 
   

Please, let us know if you need any further assistance. 

Regards, 
Shameer Ali Baig S. 


Mihael
Replied On April 8, 2019 02:17 PM UTC

Thank you, works like a charm.

Prince Oliver [Syncfusion]
Replied On April 8, 2019 03:43 PM UTC

Hi Mihael, 

Most Welcome. We ae glad to help you. 

Regards, 
Prince 


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