Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RTF Format in Web Text Editor

Is there a text editor on the web that supports input from RTF-formatted documents?

I know it is a bit of an odd request for webdev, but I need to read RTF documents from the database and edit them in a web-based text editor and store it back in RTF. Before I invest too heavily in a conversion tool, I thought I would ask if any of the many web text editors supported RTF. My research is showing that they don't.

Additionally, since this is an MVC 4.6 application, would it be a huge effort to write a two-way RTF-HTML conversion tool in C#?

Sample input that would be received by the editor: "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard This is some {\b bold} text.\par }"

like image 399
aiokos Avatar asked Aug 17 '16 17:08

aiokos


People also ask

How do I edit RTF files?

Edit RTF files online - it's the easiest way to edit RTF. User-friendly RTF WYSIWYG editor can be a simple online alternative to Microsoft Word and OpenOffice. Use it to work with RTF documents on the road through your laptop, mobile phone, tablet, and from anywhere you have an Internet connection.

What is the best free RTF editor for Windows?

WYSIWYG RTF Editor opens documents quickly and provides standard formatting options you might need in your work. It also supports a full-screen mode, designed for a distraction-free working experience. Our online writer is 100% free.

What is Rich Text Format (RTF)?

Introduced and documented by Microsoft, the Rich Text Format (RTF) represents a method of encoding formatted text and graphics for use within applications. The format facilitates cross-platform document exchange with other Microsoft Products, thus serving the purpose of interoperability.

What is a rich-text editor?

Rich-text editors, also known as online rich-text editors, are web components that allow users to edit and enter text within a web browser. Rich-text editors are used in numerous ways such as in enhancing your comment input form or as part of a web application that allows entry of user-generated and formatted content.


2 Answers

Quill is a rich text web editor.

Using the code from the quickstart you could enable it like this

Create the toolbar container

<div id="toolbar">
  <button class="ql-bold">Bold</button>
  <button class="ql-italic">Italic</button>
</div>

Create the editor container

<div id="editor">
  <div>Hello World!</div>
  <div>Some initial <b>bold</b> text</div>
  <div><br></div>
</div>

Include the Quill library

<script src="//cdn.quilljs.com/0.20.1/quill.js"></script>

Initialize Quill editor

<script>
  var quill = new Quill('#editor');
  quill.addModule('toolbar', { container: '#toolbar' });
</script>

Setting the editor text

editor.setText("RTF document ");

Getting the editor text

by default 0 will get everything in the editor

var text = editor.getText(0);

also see this Mozilla post which defines how to implement your own rich text editor.

like image 145
Wamadahama Avatar answered Sep 28 '22 22:09

Wamadahama


You could use Word to load the RTF file, then Save As HTML. Works but generates a pile of spurious MS- tags.

Or I've written a program (Visual Studio) that you can have if you want - it's a bit basic, doesn't deal with fonts, but converts most text formatting. Let me know if you're interested (I'd need to tidy it a bit - it's very old - a bit like me).

Though as I write this, I see that Wamadahama may have a better solution.

like image 21
Tony Duffill Avatar answered Sep 28 '22 23:09

Tony Duffill