Results 1 to 5 of 5

Thread: [RESOLVED] formatting rtf text

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Resolved [RESOLVED] formatting rtf text

    how can i reformat this rtf (keeping the original formatting), so the resulting formatted text will be (either):

    toUpper
    toLower
    sentence case
    proper case
    toggle case - toggle upper + lower case

    heres the rtf:

    Code:
    {\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}{\f1\fnil\fcharset0 Comic Sans MS;}}
    
    {\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}
    
    \viewkind4\uc1\pard\qj\f0\fs17 here's a few \b sen\cf1 ten\cf0 ces\b0  of text to test the \b\i capabilities \b0\i0 of my new code. \cf2 hopefully\cf0  the enhancements \f1\fs30 i've made will work\f0\fs17  as intended. this first test is a test of the textalign\b\i  \ul\b0\i0 justify\ulnone  feature, which (after testing) works as intended.\par
    
    }

  2. #2

  3. #3

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: formatting rtf text

    Quote Originally Posted by cicatrix View Post
    Do you insist on the low level? Wouldn't formatting with RichTextBox be easier?
    i'd prefer it to be low level because its faster that way. you're probably right but if anyone has any other ideas i'd appreciate hearing them

  4. #4
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: formatting rtf text

    Quote Originally Posted by .paul. View Post
    i'd prefer it to be low level because its faster that way. you're probably right but if anyone has any other ideas i'd appreciate hearing them
    Well, the truth is out there:
    http://www.microsoft.com/downloads/d...displaylang=en

    Besides, I'm not sure it'll be faster. You will be working with strings and this is slow (depending on the way you'd implement it though, but it'll be difficult to match richtextbox's speed);

  5. #5

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: formatting rtf text

    Quote Originally Posted by cicatrix View Post
    Besides, I'm not sure it'll be faster. You will be working with strings and this is slow (depending on the way you'd implement it though, but it'll be difficult to match richtextbox's speed);
    it would've been faster because i had a selectionchanged handler for the rtb + the only way to keep the formatting when working with the selectedtext is to select + change 1 character at a time, before moving on to the next character, which made it really slow. but i put an ignoreselectionchanged property in there + it's fast enough now. thanks for the advice.

    edit: initially i parsed the rtf but it's too complicated to do a thorough job

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width