Strip RTF tags

These four files will help you to convert the RTF contents of a CString to the plain text.

You have to do the following

Include the two header files and two .cpp files in your project and just call the function
convertRTF (CString csInput, CString & csout);
by passing the fist CString with the RTF content and get the output form the second parameter.

Due to the time constraint , I couldn't write the functions as fully object oriented. If some one feels that can be changed to the object orientated style it is welcome.

Download source - convertrtf.zip ??KB

Date Posted: 08/11/98


Comments

  • Thanks for the excellent code

    Posted by Fred on 10/15/2014 02:20pm

    Thank you to Sendil Rajkumar for the excellent RTF-to-text code, and to Gernot Schachner for the additional correction to the code. It is now indeed "many moons" since the code was first published, but it did exactly what I needed for a project I was just working on. And thanks to CodeGuru for making lots of "old" code still available for use even many years later. :-)

    Reply
  • Anyone know how to compile this code?

    Posted by Legacy on 07/29/2002 12:00am

    Originally posted by: Mike Pliam

    I really need to strip (rtf tags - that is), but cant figure out how to use this code. I've tried adding the four files to a CRichEditView sdi app, but it wont compile.

    Desparately seeking an answer. Thanks.

    Reply
  • MSDN Documentation

    Posted by Legacy on 09/27/2001 12:00am

    Originally posted by: John

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec_46.asp

    Copyright 1801

    Reply
  • Bug in the funcion ecRtfParse(FILE * fp )

    Posted by Legacy on 11/11/1998 12:00am

    Originally posted by: Gernot Schachner

    Thank you for the verry useful function to convert RTF-strings into Text-strings, but there is a  bug in it!
    
    

    The calculation of the decimal number from the hexadecimal number in the function ecRtfParse(FILE * fp ) is wrong!You must add 10 if the character is 'a' to 'f' or 'A' to 'F', see the code below!

    if (islower(ch))
    {
    if (ch < 'a' || ch > 'f')
    return ecInvalidHex;
    // old code !! b += (char) ch - 'a';
    b += (char) ch - 'a' + 10;
    }
    else
    {
    if (ch < 'A' || ch > 'F')
    return ecInvalidHex;
    // old code !! b += (char) ch - 'A';
    b += (char) ch - 'A' + 10;
    }

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • In support of their business continuity and disaster recovery plans, many midsized companies endeavor to avoid putting all their eggs in one basket. Understanding the critical role of last-mile connectivity and always available Internet access for their enterprises, savvy firms utilize redundant connections from multiple service providers. Despite the good intentions, their Internet connectivity risk may still be in a single basket. That is because internet service providers (ISPs) and competitive local …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds