Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RTF in Webpages Using PHP

Status
Not open for further replies.

CajunCenturion

Programmer
Mar 4, 2002
11,381
US
In our application, we need to render an RTF document within a defined area on a webpage, as well as in some cases, provide the ability to modify the RTF document, again within the edit box area. We're looking into various ways to accomplish this, and any and all advice is welcome.

Is it possible to embed the MS Rich Text Box control, or some similar control, into a PHP page?

Any suggestions?
Thanks


--------------
Good Luck
To get the most from your Tek-Tips experience, please read
FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Do you want actual Rich Text format such as:
Code:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fswiss\fprq2\fcharset0 Calibri;}}
{\colortbl ;\red255\green0\blue0;}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20 This\cf1  file \cf0 is rch\b  text  \b0\i\f1 format\b\i0\f0\par
}

Or do you just want a control that provides rich text functionality, but returns the rich text formatting as HTML tags? For instance:

Code:
This <span style="color: rgb(255, 0, 0);">file</span> is rch <span style="font-weight: bold;">text </span><span style="font-family: Courier New,Courier,mono;">format</span><br>









----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
The text field in the database will have the actual RTF text as shown in your first code box. We'll need that properly rendered on the webpage.

We're currently using the TE Edit control from Subsystems, Inc in our desktop apps. We absolutely must keep that functionality. If that means we have to go the .Net route, then so be it, but that is not our first choice. We'd rather be able to provide that functionality in a PHP driven environment.

--------------
Good Luck
To get the most from your Tek-Tips experience, please read
FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I know of now such control, though there are a few scripts that can parse the RTF file and turn it into web friendly HTML.

You could then display and edit it in any WEB html editor, and once submitted parse the html back into RTF format.

Check these results if that is a viable option:


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
@CC

you have not quite answered Phil's question.

the display of the information on the web page is one thing (and solvable).
what Phil was asking was about the mods. When you modify the data are you looking for a web-rendered editor with buttons for bold/italics etc or just a textarea where your users can enter and change raw rtf?

I would be hesitant about using translation software as the translations are sometimes imperfect and thus the next time you edit in the desktop strange inconsistencies may crop up. If you go a translation route then test thoroughly.

rendering rtf on the web is no problem.
 
I'm sorry for not being clear.

==> When you modify the data are you looking for a web-rendered editor with buttons for bold/italics etc. ...
Yes. Unfortunately, we can't expect our users to have even a minimal working knowledge of RTF commands. We need the functionality found in the control that I referenced in my post of 17 Feb 10 17:29. That same control provides a rendered display.

I don't know if that control can used from within PHP, but we're looking into it. Or whether or not some other control can be used, or if there is a PHP function library that can be found or purchased.

--------------
Good Luck
To get the most from your Tek-Tips experience, please read
FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
there are plenty of php libraries that can convert html or bbcode from and to rtf.
but i think that there may also be javascript and/or flash controls that will output 'natively' into rtf.

having given my caveat above, i'm actually not too concerned as rtf is such a limited language set anyway.

and i guess we know that it can be done because google docs talks rtf

if i have a moment later i will search through my archives to see whether i have used something in the past that might fit. memory says that i might.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top