Link to home
Create AccountLog in
Avatar of sulzener
sulzenerFlag for United States of America

asked on

Is it possible to manipulating a RTF file??

I'm desiring to convert a PC app over to CF8.  The current application will create a nicely formatted  outlined RTF file based upon drop-down selections.  It starts with a base RTF template and then additional text is added (based on drop-downs) to build the final document.  I am wondering if it is possible to manipulate an RTF document using CF8 and maintain the formatting?  If so, can some point me in the right direction?  IF not, do you have any suggestions how to accomplish.  I'd like to save alot of work by using the existing RTF if possible.  Thanks.
Avatar of duncancumming
Flag of United Kingdom of Great Britain and Northern Ireland image

you may want to look at the Apache POI project
Avatar of sulzener


Thanks.  Seems pretty complicated to me.  Hopefully someone will have an easier suggestions.  I would probably have to pay someone to help me do this.  I am not sure if this is appropriate or not.  But if this is my only option, do you know of anyone who I could pay to help me implement this using CF?
Avatar of _agx_
When you say "PC app", what exactly is used for the current process?
I'm guessing the executable is in VB6.  I have access to the tables and RTF templates because they are in an MS access (MDB) which I have access to.  The program was written before my time and it's now desired to have system done in CF.  It seems pretty basic because I can follow the logic by running the app and looking at the tables.  Hope this makes sense.  I've never really manipulated RTFs before.  I can tell PC app is passing/replacing data in the RTF based on selections.
I'm not familiar with the format for RTF documents.  Can you show us some of the VB code that manipulates the RTF?
I'm trying to figure out what the former programmer did and then basically duplicate in ColdFusion.  He and the source are no longer available.  Here is a simple example of what the system does.  Maybe this will help someone point me towards the best approach.  The ultimate goal is to build a document that can be emailed based upon selected criteria.  This document needs to be editable.  Cannot be a PDF.  

<!--- MainSample.RTF --->
Prepared for on @APPNAME@, located at @APPADDRESS@, in @APPCITY@, @APPSTATE@.
<!--- TitlePage.TXT --->
\pard\plain \qc \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \f27\fs28\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f0\fs28 Created for: \par }{\b\f0\fs28 @APPNAME@ \par }{\f0\fs28 @APPADDRESS@ \par @APPCITY@, @APPSTATE@ @APPZIPCODE@ \par }

Open in new window

After rethinking what I just wrote:  It might be better to store the RTF and TEXT data in tables.  Then create the document via HTML.  The only thing left to do is to be able to email the application and have it editable.  Preferably in a DOC or RTF format.  This is where I am totally stumped.  Any ideas?
Avatar of _agx_
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
That sounds like a great plan.  I will try a sample and see if it works.  I'll let you know.  Thanks.
agx, Many, many thanks.  That worked perfectly.  I cant believe how easy that was.  You have absolutely no idea how happy I am.  Thanks a million.
I am so appreciative of your help.  Thanks again.
I am glad it worked out.  It is always, nice when a task turns out to be far simpler than you think ;-)