split RTF formatting code help me urgently

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zawhtunnaing
    New Member
    • Feb 2007
    • 4

    split RTF formatting code help me urgently

    how can I split these rtf formatting code from string in C#?
    string exampleString ="
    . Point we hall invetigate in thi direction include:par par pntextpardplain fc1 aiaf0af20 fc0 f3f20lang2057la ngfe1033langnp2 057 lochaf3dbchaf0h ichf3 'b7tabpard qj fi-360li360ri0l360 lmult1widctlpar *pn pnlvlbltilvl0l1 pnrnot0pnf3pnta rt1pnindent360p nhang pntxtb 'b7faautol1rin0 lin360itap0para rid6227368 fc1 aiaf0 fc0 iinrid6227368 Automation of the earch and filtering proce through the ue of intelligent agentfc1 af0 fc0 inrid6227368 . Autonomou media-pecific agent can be ued to execute the actual earch and collaboratively filter the reult."

    help me urgently
  • sani723
    New Member
    • Feb 2007
    • 117

    #2
    You need to read and understand the rtf format, IIRC it's a markup format,
    if so you will need to parse the file. a RegEx may help you, but I think that you may need something different, like a parser ( a la LEX ).

    The Rich Text Format (RTF) Version 1.5 Specification is freely

    Comment

    • sani723
      New Member
      • Feb 2007
      • 117

      #3
      or directly read from RTF File

      System.IO.Strea mReader FReader =
      new System.IO.Strea mReader((System .Reflection.Ass embly.GetExecut ingAssembly().
      GetManifestReso urceStream("Lea rnAndEarn.Credi ts.rtf")));
      string str = FReader.ReadToE nd();
      FReader.Close() ;
      DedicationRichT extBox.Text = str;
      DedicationRichT extBox.Visible = true;

      Comment

      • sani723
        New Member
        • Feb 2007
        • 117

        #4
        this can surely help you, you can access directly the .rtf file and then format the output.

        Comment

        • zawhtunnaing
          New Member
          • Feb 2007
          • 4

          #5
          Thanks for helping me but I can't solve my prob above these.
          In my project,I open RTF file with StreamReader.
          use sr.ReadLine() and assign to string variable.
          At that time,I got RTF formatted string ,not the right text.
          that is my coding.
          StreamReader sr = new StreamReader(Ex ample.rtf,Encod ing.Default);
          string strWord = null;
          while ((strWord = sr.ReadLine()) != null)
          {
          // do something;
          }
          I want to replace or split if the readline string text is RTF formatting code.
          Otherwise I will take the string to do something.I wll read end of the RTF file.

          thanks alot you guys.
          help me please.

          Comment

          Working...