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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display rtf in browser

Status
Not open for further replies.

spiral123

Programmer
Sep 9, 2002
73
CA
I need to display a rtf file online and have a user be able to append comments to that same file. I would like the file to be above the webroot level so the files can only be accessed through the asp page. Not sure where to start. Any help is appreciated.






 
"ASP page"?? You're in the wrong place, brother ;-)

But seriously... displaying an RTF in the brower may or may not be a piece of cake... depending on how the user's browser is set up. If it's set up to handle the RTF mime type (inline), then displaying the file in the browser would simply be a matter of linking to it.

Barring that, you'd need to send the file with a CFCONTENT header somehow. And being that the RTF format is pretty unique in it's markup... it's not going to simply be a matter of dumping it out in a .CFM page.

Regardless... the HUGE trick is going to be able to get whatever solution you build to save the file back to the server. In order to open it on the client's side, the browser is going to have to download it locally... saving is only going to affect that local copy. There isn't going to be a magic toolbar button or menu item that says "save back to server".

And then the OTHER big trick is going to be coming up with some sort of locking or change management, so that multiple users can't edit the file at once and run the risk of corrupting it, or at the very least overwrite one anothers revisions.

Why is it you're using an RTF? A multi-user database hooked up to a webform would seem to be a solution more suited to web deployment.




-Carl
 
actually I meant cfm page, I was palnning on displaying the contents of the rtf in a cfm page, then below that having a multiline textbox that appends the info from the textbox to the rtf. I am trying it this way because the user has 8546 rtfs that they need to show and edit and I thought this might be easier than transporting that information into the database, plus some of the info is letters that are sometimes 6 or 7 solid pages of text.
 
Well... what you'd need is a custom tag that's built to parse RTF markup tags (trust me... you really don't want to tackle that parser yourself). Charleste King has a nice one up at the Macromedia Developer Exchange if you're running under Windows. For others, you can go to the exchange and do a search ( for "rtf" and specify the "ColdFusion Exchange" only.

You basically have a .cfm page that does a CFFILE to read the rtf document, then run the result through one of these parsers to convert it to some displayable format (HTML or XHTML most likely) and output it to the browser. Then, when the user submits additions via your textbox, you'd want to append those to the original output, and convert it back to RTF (or just save as HTML or XML so you don't have to convert it again the next time).

Or you could set up a CFM that converts the RTF's when they're first uploaded to the server. That way they're primed and ready for you before their first use.


But what you'll find is, like almost everything else software-wise, that there's Microsoft's RTF format (save from Word, for example)... and then there's everyone elses ( They're compatible to a point... but begin diverging when you get into things like embedded graphics and some of the formatting stuff. So you need to figure out who's "RTF" you'll be working with. And expect a few glitches on the way.




-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top