Microsoft Corporation

May 1999

Summary: The Rich Text Format (RTF) Specification provides a format for text and graphics interchange that can be used with different output devices, operating environments, and operating systems. RTF uses the American National Standards Institute (ANSI), PC-8, Macintosh, or IBM PC character set to control the representation and formatting of a document, both on the screen and in print. With the RTF Specification, documents created under different operating systems and with different software applications can be transferred between those operating systems and applications. (248 printed pages)

Contents

Introduction
RTF Syntax
Conventions of an RTF Reader
Formal Syntax
Contents of an RTF File
   
Header
      
RTF Version
      
Character Set
      
Unicode RTF
      
Font Table
      
File Table
      
Color Table
      
Style Sheet
      
List Table
      
Track Changes (Revision Marks)
   
Document Area
      
Information Group
      
Document Formatting Properties
      
Section Text
      
Paragraph Text
      
Character Text
      
Document Variables
      
Bookmarks
      
Pictures
      
Objects
      
Drawing Objects
      
Word 97-2000 RTF for Drawing Objects (Shapes)
      
Footnotes
      
Comments (Annotations)
      
Fields
      
Form Fields
      
Index Entries
      
Table of Contents Entries
      
Bidirectional Language Support
Far East Support
   
Escaped Expressions
   
Character Set
   
Character Mapping
   
Font Family
      
Composite Fonts (Associated Fonts for International Runs)
      
New Far East Control Words Created by Word 6J
      
New Far East Control Words Created by Asian Versions of Word 97
      
New Far East Control Words Created by Word 2000
Appendix A: Sample RTF Reader Application
   
How to Write an RTF Reader
   
A Sample RTF Reader Implementation
      
Rtfdecl.h and Rtfreadr.c
      
Rtftype.h
      
Rtfactn.c
   
Notes on Implementing Other RTF Features
      
Tabs and Other Control Sequences Terminating in a Fixed Control
      
Borders and Other Control Sequences Beginning with a Fixed Control
   
Other Problem Areas in RTF
      
Style Sheets
      
Property Changes
      
Fields
      
Tables
      
Rtfdecl.h
      
Rtftype.h
      
Rtfreadr.c
      
Makefile
Appendix B: Index of RTF Control Words
Appendix C: Control Words Introduced by Other Microsoft Products
   
Pocket Word
   
Exchange (Used in RTF<>HTML Conversions)

posted @ 2006-06-05 03:21 热血男儿 阅读(299) 评论(0) 编辑

The Windows Forms RichTextBox control has numerous options for formatting the text it displays. You can format selected paragraphs as bulleted lists by setting the SelectionBullet property. You can also use the SelectionIndent, SelectionRightIndent, and SelectionHangingIndent properties to set the indentation of paragraphs relative to the left and right edges of the control, and the left edge of other lines of text.

To format a paragraph as a bulleted list

  • Set the SelectionBullet property to true.
    ' Visual Basic
        RichTextBox1.SelectionBullet = True
        // C#
        richTextBox1.SelectionBullet = true;
        // C++
        richTextBox1->SelectionBullet = true;

To indent a paragraph

  • Set the SelectionIndent property to an integer representing the distance in pixels between the left edge of the control and the left edge of the text.
  • Set the SelectionHangingIndent property to an integer representing the distance in pixels between the left edge of the first line of text in the paragraph and the left edge of subsequent lines in the same paragraph. The value of the SelectionHangingIndent property only applies to lines in a paragraph that have wrapped below the first line.
  • Set the SelectionRightIndent property to an integer representing the distance in pixels between the right edge of the control and the right edge of the text.
    ' Visual Basic
        RichTextBox1.SelectionIndent = 8
        RichTextBox1.SelectionHangingIndent = 3
        RichTextBox1.SelectionRightIndent = 12
        // C#
        richTextBox1.SelectionIndent = 8;
        richTextBox1.SelectionHangingIndent = 3;
        richTextBox1.SelectionRightIndent = 12;
        // C++
        richTextBox1->SelectionIndent = 8;
        richTextBox1->SelectionHangingIndent = 3;
        richTextBox1->SelectionRightIndent = 12;
    Note   All these properties affect any paragraphs that contain selected text, and also the text that is typed after the current insertion point. For example, when a user selects a word within a paragraph and then adjusts the indentation, the new settings will apply to the entire paragraph that contains that word, and also to any paragraphs subsequently entered after the selected paragraph. For information on selecting text programmatically, see TextBoxBase.Select Method.

See Also

RichTextBox Class | RichTextBox Control (Windows Forms) | Controls You Can Use on Windows Forms

posted @ 2006-06-05 03:12 热血男儿 阅读(239) 评论(0) 编辑

The Windows Forms RichTextBox control has numerous options for formatting the text it displays. You can make the selected characters bold, underlined, or italic, using the SelectionFont property. You can also use this property to change the size and typeface of the selected characters. The SelectionColor property allows you to change the selected characters' color.

To change the appearance of characters

  • Set the SelectionFont property to an appropriate font.

    To enable users to set the font family, size, and typeface in an application, you would typically use the FontDialog component. For an overview, see Introduction to the Windows Forms FontDialog Component.

  • Set the SelectionColor property to an appropriate color.

    To enable users to set the color in an application, you would typically use the ColorDialog component. For an overview, see Introduction to the Windows Forms ColorDialog Component.

    ' Visual Basic
        RichTextBox1.SelectionFont = New Font("Tahoma", 12, FontStyle.Bold)
        RichTextBox1.SelectionColor = System.Drawing.Color.Red
        // C#
        richTextBox1.SelectionFont = new Font("Tahoma", 12, FontStyle.Bold);
        richTextBox1.SelectionColor = System.Drawing.Color.Red;
        // C++
        richTextBox1->SelectionFont =
        new System::Drawing::Font("Tahoma", 12, FontStyle::Bold);
        richTextBox1->SelectionColor = System::Drawing::Color::Red;
    Note   These properties only affect selected text, or, if no text is selected, the text that is typed at the current location of the insertion point. For information on selecting text programmatically, see TextBoxBase.Select Method.

    See Also

    RichTextBox Class | RichTextBox Control (Windows Forms) | Controls You Can Use on Windows Forms

posted @ 2006-06-05 03:11 热血男儿 阅读(199) 评论(0) 编辑