Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Programming Languages (http://www.programmingforums.org/forum38.html)
-   -   RTF Codes (http://www.programmingforums.org/showthread.php?t=14909)

Ghost Jan 10th, 2008 2:54 AM

RTF Codes
 
So I'm developing an app that will take some data out of an sql database and format it into a nice RTF Document. Anyone know of any good tools or resources for RTF? This will be my first project with it and any tips or advice would be great, thank you.

Links I have found and used:
http://search.cpan.org/~sburke/RTF-W...F/Cookbook.pod
http://www.biblioscape.com/rtf15_spec.htm

I'd be interested if there are any Wizards or Generators that will help me speed up the RTF Template process. Thank you.

Sane Jan 10th, 2008 7:48 AM

Re: RTF Codes
 
What language are you using? PHP? In the past I've found user-written libraries in PHP for creating RTF documents from HTML, and vice-versa.

Ghost Jan 10th, 2008 7:09 PM

Re: RTF Codes
 
VB.Net it is a WinForm based on the 3.5 Framework

Sane Jan 10th, 2008 8:22 PM

Re: RTF Codes
 
Hmm... well if your presentation is limited to only one specific template, it would be very (very) simple (and worth your time), to do the following:
  • In a word processor, create a file identical to your program's desired output
  • Any values that are subject to change, replace with a unique identifier. For example, "January 10, 2008" might become "<Date>" and "Financial Report" might become "<Title>"
  • Save as .rtf
  • Open in a hex editor and see how these identifiers appear in the raw file
  • Chances are, they are still in tact, and at most the "<" and ">" were replaced with something else.

In VB.net, simply:
  • Read in the file
  • Search and replace the identifiers with their matching values
  • Save as .rtf

Then, if you ever need to change the template... just open up the .rtf file in a word processor again, and change around the template.

That's my solution. Hope it at least stimulates some ideas.

SydneyMcConnell Jan 11th, 2008 8:21 AM

Re: RTF Codes
 
Is there any reason you're using rtf, in particular?

Sane Jan 11th, 2008 10:04 AM

Re: RTF Codes
 
I presume because he needs to deliver something in a hard-copy format. HTML could do the job, but it's not always the same feel for a user/client as a familiar word document.

SydneyMcConnell Jan 11th, 2008 10:55 AM

Re: RTF Codes
 
I was going to suggest that he uses XML, especially if it's in hard-copy format.
Even so, I'm pretty sure word can open and convert and XML document that's been formatted with an XSLT Stylesheet.

Sane Jan 11th, 2008 11:05 AM

Re: RTF Codes
 
Would someone who's not so computer savvy know what to do with an XML file? I certainly know my mother wouldn't. :)

SydneyMcConnell Jan 11th, 2008 5:08 PM

Re: RTF Codes
 
Touche.

However, wouldn't he be able to use the ActiveX controls that come with Office to write the output to a formatted Word Document?

Also, to me it almost seems like he's talking about doing reporting.

What exactly is this application for? Is it a single business app, or is it for a part of a system or something?

Ghost Jan 12th, 2008 4:37 AM

Re: RTF Codes
 
RTF is a nice format for printed documents.

I'm using XML to Save the Data, XSLT to Format the RTF Document File. And the application is for taking data from an SQL DB and Creating basically a book version of a website with a single click. It isnt going to do everything for the printed book, but it will have the bulk of it.

@Sane, thank you for the advice, I'll look into that tomorrow.


All times are GMT -5. The time now is 2:39 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC