none
RTF to Plain Text Using CLR Stored Procedure? RRS feed

  • Question

  • All,
     
    For reasons that are perhaps too involved to describe here, I have the need to convert RTF content into plain text in a stored procedure.

    I know that OLE Automation can be used to instantiate a RICHTEXT.RichtextCtrl object and use it to perform the translation. This seems like a bit of a hack to me. After all, this really isn't a VB6 application and it doesn't really need any display capability.

    Given that SQL Server 2005 introduced CLR Integration, I was sure that my solution existed somewhere in the .Net libraries. I've researched up and down and cannot find anything provided by Microsoft that simply converts RTF to plain text. The standard trick to accomplish this in .Net applications of all types is apparently to instantiate a RichTextBox control. That's suspiciously like the OLE Automation trick, but the point is moot - System.Windows.Forms is not available in SQL Server.

    I'm not really thrilled about writing something to parse RTF and render it in plain text. Does anyone know of a class that is accessible through SQL Server's .Net Framework that will do this trick?

    Thanks in advance,
    Chris
    Tuesday, February 10, 2009 9:20 PM

Answers

  • I think this is the only .Net Framework way to do this. If you want to implement this in .Net anyway by doing your own parser, feel free to come back with the parser on Codeplex to help others having the same problem. There are also some code samples outside already doing parsing. maybe you can take advantage of them and leveraging your development effort with them.

    Jens K. Suessmeyer
    Wednesday, February 11, 2009 6:57 PM
    Moderator