views:

156

answers:

3

Simple situation. I'm trying to write my own blog with a minor twist. Part of the blog will be controlled from a client application instead of a web interface. Basically, I'm still in the design phase and haven't written a single line of code. But I'm trying to combine several techniques into an interesting exercise in software development. Thus I want a client application which I can use to write articles in, which can then upload the article through a web service to the server. (The client would be Delphi 2007/WIN32 and the service is ASP.NET/C# with SQL Server.)

The article itself would be stored in RTF format, including images. This would be in a local database on the client, which would also keep track of the article's status. Once uploaded, it will keep the article synchronised with the version on the server. Technical details are just boring and as said before, still in a design phase...

But I do need a good solution to convert the article from RTF in the database to HTML to be displayed in the blog. I have two options:

  1. Upload both the RTF and HTML from the client, with the client doing the convertion from RTF to HTML.
  2. Upload just the RTF and let it convert on demand on the server. (Or convert on the server when the RTF is uploaded.)

Option 1 would need a Delphi/WIN32 solution to convert it while option 2 would need a .NET solution for the conversion. I don't want an RTF editor for .NET but need a good option to use in Delphi 2007. And I need something to convert an RTF to HTML, which would keep (almost) all formatting and which would include all images from the text. This could be both in .NET or Delphi.

So, the following questions:

  • Is there a good, free RTF editor for Delphi which can handle images?
  • Is there a good RTF-to-HTML converter for Delphi or C# which can keep as much of it's formatting intact as possible, including images?
+1  A: 

Some good suggestions for .Net: http://stackoverflow.com/questions/439301/convert-rtf-to-html

Mircea Grelus
+1  A: 

Since you provided so much background about why you are doing it, I am going to provide some feedback on the whole plan. This may not be an answer to your question directly though. Sorry.

You might consider looking at Windows Liver Writer for the client. If you just implement an API it supports then it can do all the editing.

Also, I would suggest skipping RTF all together. Converting from RTF to HTML will loose some formatting, and typically create sub-optimal HTML. Creating an RTF with the sole intent of converting to HTML is a less than optimal solution.

Instead keep it HTML for the round trip. If you must use RTF, then limit the RTF formatting to the HTML formatting you want to support. That way the conversion will be more accurate. Then convert as soon as possible, providing a preview for the poster. Since it won't always convert accurately you want the poster to see any of the conversion oddities before they make them public. That way they can fix them before they are embarrassed.

Jim McKeeth
I prefer to keep them as RTF because it would allow me to open the document in Word or other document reader. Basically, I want the system to publish documents, but it would display those documents as HTML. Losing some formatting is no problem since it's a one-way conversion. But the RTF is practical to allow visitors to download the original document.
Workshop Alex
+1  A: 

You'd better take a look at TRichEditWB component in EmbeddedWeb component pack. The whole pack is open-source:

http://www.bsalsa.com/forum/forumdisplay.php?f=29

You can add image, and even controls like buttons and checkboxes to TRichEditWB. It also can hilight HTML and XML code, and recognize URLs automatically.

vcldeveloper
Unfortunately, I need the documents primarily as RTF. The HTML is just so people can read them online.
Workshop Alex