views:

102

answers:

2

I have an existing application that has some parts of formatted text-blocks (standard formats such as bold, italic, unordered list, …) saved in the database. Currently these text-blocks are saved in a custom xml format. The editor is created with a WPF-RichtTextBox.

Since I have to make the editor more user-friendly and extend the application, and I know that in the future also SQL-Server Reporting Services and probably Silverlight must use this markup, I’m thinking about to change the format of the saved text-blocks. In the future there will be the following application-types that must interpret the markup:

  • WPF-Applications (with an editor)
  • HTML-Web-Application (maybe with an editor)
  • SQL-Server Reporting-Services
  • Silverlight (maybe with an editor)

I tend to use a subset of HTML. What would you use or advise and why? Maybe you also have a link to existing resources dealing with this topic?

Update

Currently, it seems that I will take HTML:

I plan to use a RichTextBox in the WPF-app als MainEditor. To convert I will use the microsoft sample converter from here. Does someone know if there is a newer version or has some remarks about pitfalls?

For silverlight I have looked at the silverlight RichTextBox: For all who plan to make something similar as I, be warned: The silverlight 4 RichTextBox seems not to be very powerfull (as far as I have seen). The simplest things such list-items with bullets must be done with a workaround. And it can not export in RichTextFormat! Don't count on this control without testing it.

For the HTML-site I will probably use CKEditor or TinyMce.

I thought also about using RTF as format, but because the silverlight RichtTextBox is does not support it, i will not use. For those who are interested in, here is a very interesting project for converting.

+2  A: 

I'm not qualified to answer with respect to WPF and Silverlight, but with respect to SSRS and web applications, a subset of HTML will treat you fine, though you'll want to use SSRS 2008 or later.

In SSRS 2008, displaying HTML requires a simple setting on a text box placeholder. You can see an example here: http://dinesql.blogspot.com/2010/05/reporting-services-2008-showing-html.html

In a web application, displaying HTML is super easy, though I recommend first sanitizing your output using the AntiXSS library (using the GetSafeHTMLFragment() method): http://wpl.codeplex.com/

kbrimington
+1 for the sanitizing and thanks for the answer. Indeed with the WebApp and the markup-feature of SSRS there are two output-types that use HTML as native format. This is one of the reasons, why I tend to html.
HCL
@HCL: I found this, just Googling around. It appears that it may provide an HTML-rendering solution within Silverlight. If this is as good as it looks, that gives you 3 of the 4 platforms using HTML snippets. http://blogs.msdn.com/b/delay/archive/2007/09/10/bringing-a-bit-of-html-to-silverlight-htmltextblock-makes-rich-text-display-easy.aspx
kbrimington
A: 

I plan to use a RichTextBox in the WPF-app als MainEditor. To convert I will use the microsoft sample converter from here. Does someone know if there is a newer version or has some remarks about pitfalls?

I don't know about the RichTextBox.

I have written a managed, WYSIWYM HTML edit control for .NET. It's specifically for [X]HTML, and described in some detail on its web site.

ChrisW