×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    8

    How to read line by line from rich text editor

    I am working with rich text editor on symbian 9.3 and trying to get text line by line.
    Could you give me some suggestions?
    Thanks and regards

  2. #2
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: How to read line by line from rich text editor

    try this code
    Code:
    void AddToHeaderWindowL( const TDesC& aText )
        {
        // Append aText to header window with line break
        CRichText* text = iHeaderWindow->RichText();
    
    	text->InsertL(text->DocumentLength(), aText);
    	text->InsertL(text->DocumentLength(), CEditableText::ELineBreak);
    	
    	
    	
    	
    	//TFontSpec fontspec = LatinBold19()->FontSpecInTwips();
    	//color
    	
    	//TFontSpec fontspec = LatinPlain12()->FontSpecInTwips();
    	//TCharFormat cf( fontspec.iTypeface.iName, fontspec.iHeight );
    	TCharFormat cf;
    	
    	
    	// Set up the text color and strikethrough properties
    	cf.iFontPresentation.iTextColor = KRgbWhite;
    	cf.iFontPresentation.iStrikethrough = EStrikethroughOn;
    	// Create character format mask	
    	TCharFormatMask cmask;
    	// The text color and strikethrough need to be changed
    	cmask.SetAttrib(EAttColor);
    	//cmask.SetAttrib(EAttFontTypeface);
    	//cmask.SetAttrib(EAttFontHeight);
    	
    	text->ApplyCharFormatL(cf, cmask, 0, text->DocumentLength());
    	
    	
    	
    	iHeaderWindow->HandleTextChangedL();
        
    	
    	
        }
    
    void ResetL( const TDesC& aText )
        {
       
    
        iHeaderWindow->Text()->Reset();
        iHeaderWindow->HandleTextChangedL();
        iHeaderWindow->SetCursorPosL( 0, EFalse );
    
      
    
       // iHeaderWindow->SetFocus( EFalse );
       
        }

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: How to read line by line from rich text editor

    What do you mean on "get text line by line"?
    - if it is a question about missing line breaks, the Unicode line break character is the solution, the CEditableText::ELineBreak (0x2028) appearing in the suggested code
    - if you want to get information about visible lines on the screen, CTextLayout may help in that, it has methods like XyPosToDocPosL and GetLineNumber.

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    8

    Re: How to read line by line from rich text editor

    It means "I want to read line by line from the begining to the ending of a rich text editor".
    For example: there are three lines of text in the rich text editor:
    line 1
    line 2
    line 3

    at the first time, I read "line 1" and store it in a descriptor
    at the second time, I read "line 2" and store it in another descriptor
    ...

    Is there any function helps to do that?

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: How to read line by line from rich text editor

    FindDocPosL and TTmLineInfo seem to be an usable combination. There may be a better method for getting TTmLineInfo-s directly, but I have not find such.

Similar Threads

  1. Appending Text Line By Line In RichText Editor
    By devdattac in forum Symbian
    Replies: 2
    Last Post: 2008-12-17, 05:38
  2. Replies: 5
    Last Post: 2008-09-23, 09:39
  3. How to read text file line by line?
    By aluzi in forum Symbian
    Replies: 12
    Last Post: 2008-03-25, 13:06
  4. How to read the data line by line?
    By Sneha1 in forum Open C/C++
    Replies: 3
    Last Post: 2007-12-10, 10:37
  5. Read text file line by line
    By fdelvalle in forum Symbian
    Replies: 5
    Last Post: 2007-01-31, 09:48

Posting Permissions

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