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: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • Due to internal controls and regulations, the amount of long term archival data is increasing every year. Since magnetic tape does not need to be periodically operated or connected to a power source, there will be no data loss because of performance degradation due to the drive actuator. Read this white paper to learn about a series of tests that determined magnetic tape is a reliable long-term storage solution for up to 30 years.

Most Popular Programming Stories

More for Developers

RSS Feeds