RTF-Spec-1.7.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
® Microsoft® MS-DOS®, Windows®, Windows NT®, and Apple Macintosh Applications Version: RTF Version 1.7 Microsoft Technical Support Subject: Rich Text Format (RTF) Specification Specification 8/2001– Word 2002 RTF Specification Contents: 221 Pages Introduction .................................................................................................................................................33 RTF Syntax....................................................................................................................................................3 Conventions of an RTF Reader......................................................................................................................5 Formal Syntax................................................................................................................................................6 Contents of an RTF File.................................................................................................................................7 Header...................................................................................................................................................7 RTF Version ....................................................................................................................................8 Character Set..................................................................................................................................8 Unicode RTF ...................................................................................................................................8 Default Fonts.................................................................................................................................11 Font Table.....................................................................................................................................11 File Table ......................................................................................................................................15 Color Table....................................................................................................................................16 Style Sheet ...................................................................................................................................17 List Tables.....................................................................................................................................21 Paragraph Group Properties..........................................................................................................26 Track Changes (Revision Marks)....................................................................................................26 Generator......................................................................................................................................28 Document Area ....................................................................................................................................28 Information Group .........................................................................................................................28 Document Formatting Properties....................................................................................................31 Section Text..................................................................................................................................39 Paragraph Text .............................................................................................................................45 Character Text...............................................................................................................................75 Document Variables ......................................................................................................................88 Bookmarks ....................................................................................................................................89 Pictures.........................................................................................................................................89 Objects..........................................................................................................................................93 Drawing Objects ............................................................................................................................96 Word 97 through Word 2002 RTF for Drawing Objects (Shapes)..................................................102 Footnotes....................................................................................................................................128 Comments (Annotations) .............................................................................................................128 Fields ..........................................................................................................................................129 Form Fields..................................................................................................................................130 Index Entries...............................................................................................................................131 Table of Contents Entries............................................................................................................132 Bidirectional Language Support ..................................................................................................132 Far East Support .......................................................................................................................................134 Escaped Expressions.........................................................................................................................134 Microsoft Technical Support Rich Text Format (RTF) Specification Page 2 Character Set.....................................................................................................................................135 Character Mapping.............................................................................................................................135 Font Family.........................................................................................................................................135 Composite Fonts (Associated Fonts for International Runs) .........................................................135 New Far East Control Words Created by Word 6J ........................................................................136 New Far East Control Words Created by Asian Versions of Word 97............................................139 New Far East Control Words Created by Word 2000....................................................................142 Appendix A: Sample RTF Reader Application ............................................................................................143 How to Write an RTF Reader ..............................................................................................................143 A Sample RTF Reader Implementation...............................................................................................144 Rtfdecl.h and Rtfreadr.c...............................................................................................................144 Rtftype.h .....................................................................................................................................144 Rtfactn.c......................................................................................................................................146 Notes on Implementing Other RTF Features.......................................................................................147 Tabs and Other Control Sequences Terminating in a Fixed Control .............................................147 Borders and Other Control Sequences Beginning with a Fixed Control........................................147 Other Problem Areas in RTF...............................................................................................................147 Style Sheets................................................................................................................................147 Property Changes .......................................................................................................................147 Fields ..........................................................................................................................................148 Tables.........................................................................................................................................148 Rtfdecl.h......................................................................................................................................149 Rtftype.h .....................................................................................................................................150 Rtfreadr.c ....................................................................................................................................153 Makefile.......................................................................................................................................167 Appendix B: Index of RTF Control Words...................................................................................................168 Special Characters and A–B...............................................................................................................168