home *** CD-ROM | disk | FTP | other *** search
/ WordPerfect for Linux Bible / WP4LinuxBible.iso / sdk / wpc / docs / wp42ff.txt < prev    next >
Encoding:
Text File  |  1999-06-25  |  21.0 KB  |  438 lines

  1.                         WordPerfect File Information
  2.               Copyright 1984,1985,1986 WordPerfect Corporation
  3.                                  Version 4.2
  4.  
  5. File Structure
  6.  
  7. WordPerfect files are ASCII files.  The text is neither encrypted nor
  8. compacted.  WordPerfect files do not contain a ^Z as an end of file
  9. character.  If a program places a ^Z and pads to the end of the block with
  10. garbage, then WordPerfect may crash (padding with nulls or ^Z's is OK).
  11.  
  12. Formatting or function codes are embedded as they occur in the text.  No
  13. code is used for beginning of file, or end of file.  When creating
  14. WordPerfect files from other programs, keep in mind that 1) the initial WP
  15. margin settings are usually 10 and 74 and it is best to keep the line length
  16. 65 characters or less unless you change the margin settings and 2) it is
  17. best not to pad with spaces.
  18.  
  19. Function Codes
  20.  
  21. All function codes listed below are represented as base-8 (octal) numbers. 
  22. Angle brackets are not actually a part of the function codes.  They are
  23. simply used to indicate that the enclosed number is a single-byte code
  24. unless clearly stated otherwise.  Square brackets are similarly not part of
  25. the code but are simply used to clarify the notation.
  26.  
  27. Where multiple byte data is indicated within angle brackets, the data is
  28. treated as a binary string.  Wherever an "old value" is indicated, a binary
  29. zero can be used.  WordPerfect will automatically take care of updating the
  30. "old value" locations.  On output, the "old value" can be ignored.
  31.  
  32. Multiple-Byte Functions
  33.  
  34. The code for multiple-byte functions (those above 300) always appears
  35. twice--the first occurrence is the "open gate," and a second occurrence is
  36. the "closing gate."  These functions present a special problem, because some
  37. of the functions have a variable length.  The length of each function is
  38. listed at the left margin.  Those functions whose length is indicated by a
  39. -1 have a variable length.  In the case of variable-length, multiple-byte
  40. function, a program should scan for the "closing gate."  For other multiple-
  41. byte functions, a program should simply skip over the number of bytes indi-
  42. cated.
  43.  
  44. Additional Notes
  45.  
  46. There is no beginning of field or beginning of record code in WordPerfect
  47. secondary merge files.  The end of field separator is a ^R followed by a
  48. Hard Return (Line Feed), and the end of record separator is a  followed by
  49. a Hard Return (Line Feed).
  50.  
  51. For a spelling or grammar check, special care needs to be taken to allow for
  52. the various types of hyphenation function codes (251-256), and for the hard
  53. space (240). 1     011 09   Tab
  54. 1     012 0a   Hard new line
  55. 1     013 0b   Soft new page
  56. 1     014 0c   Hard new page
  57. 1     015 0d   Soft new line
  58.  
  59. 1     200 80   No-op (always deleted)
  60. 1     201 81   Turn right justification on
  61. 1     202 82   Turn right justification off
  62. 1     203 83   End of centered text
  63. 1     204 84   End of aligned or flushed text
  64. 1     205 85   Used as a temp starting pt for math calc
  65. 1     206 86   Center page from top to bottom
  66. 1     207 87   Begin col mode
  67. 1     210 88   End col mode (at top of page)
  68. 1     211 89   Tab after the right margin
  69. 1     212 8a   Widow/orphan on
  70. 1     213 8b   Widow/orphan off
  71. 1     214 8c   Hard end of line & soft end of page
  72. 1     215 8d   Footnote # (appears only inside of footnotes)
  73. 1     216 8e   Reserved
  74. 1     217 8f   Reserved
  75. 1     220 90   Red line on
  76. 1     221 91   Red line off
  77. 1     222 92   Strike out on
  78. 1     223 93   Strike out off
  79. 1     224 94   Underline on
  80. 1     225 95   Underline off
  81. 1     226 96   Reverse video on (reserved)
  82. 1     227 97   Reverse video off (reserved)
  83. 1     230 98   Table of contents placeholder
  84. 1     231 99   Overstrike
  85. 1     232 9a   Cancel hyphenation of following word
  86. 1     233 9b   End of generated text
  87. 1     234 9c   Bold off
  88. 1     235 9d   Bold on
  89. 1     236 9e   Hyphenation off
  90. 1     237 9f   Hyphenation on
  91. 1     240 a0   Hard space
  92. 1     241 a1   Do subtotal
  93. 1     242 a2   Subtotal entry
  94. 1     243 a3   Do total
  95. 1     244 a4   Total entry
  96. 1     245 a5   Do grand total
  97. 1     246 a6   Math calculation column
  98. 1     247 a7   Begin math mode
  99. 1     250 a8   End math mode
  100. 1     251 a9   Hard hyphen in line
  101. 1     252 aa   Hard hyphen at end of line
  102. 1     253 ab   Hard hyphen at end of page
  103. 1     254 ac   Soft hyphen
  104. 1     255 ad   Soft hyphen at end of line
  105. 1     256 ae   Soft hyphen at end of page
  106. 1     257 af   End of text cols & end of line
  107. 1     260 b0   End of text cols & end of page
  108. 1     261 b1   negative number (N) for math mode
  109. 1     262 b2   italics on (not implemented in IBM PC version)
  110. 1     263 b3   italics off (not implemented in IBM PC version)
  111. 1     264 b4   shadow on (not implemented in IBM PC version)
  112. 1     265 b5   shadow off (not implemented in IBM PC version)
  113. 1     266 b6   outline on (not implemented in IBM PC version)
  114. 1     267 b7   outline off (not implemented in IBM PC version)
  115. 1     274 bc   Superscript
  116. 1     275 bd   Subscript
  117. 1     276 be   Advance 1/2 line up
  118. 1     277 bf   Advance 1/2 line down
  119.  
  120. 6     300 c0   Margin reset
  121.           <300><old left mar><old right mar>
  122.                <new left mar><new right mar><300>
  123. 4     301 c1   Spacing reset - values stored in half line values
  124.           <301><old spacing><new spacing><301>
  125. 3     302 c2   Left margin release
  126.           <302><# of spaces to go left><302>
  127. 5     303 c3   Center the following text
  128.           <303><type of center><center col #><starting col #><303>
  129.                -text- <203>
  130.           Type = 0 for centering between margins
  131.                = 1 for centering around current column
  132. 5     304 c4   Align or flush right
  133.           <304><align char><align col #><starting col #><304> -text- <204>
  134.           If align char = 12 (new line) then this is a flush right and the
  135.                align col # is the right margin; otherwise, the align col #
  136.                is the next tab stop.
  137.           If the high bit of the align character is set, then this is dot
  138.                leader align or dot leader flush right.
  139. 6     305 c5   Reset hyphenation zone (Hotzone)
  140.           <305><old left hzone><old right hzone>
  141.                 <new left hzone><new right hzone><305>
  142. 4     306 c6   Set page number position
  143.           <306><old pos code><new pos code><306>
  144.           Code:    0 = None         1 = Top Left    2 = Top Center
  145.                    3 = Top Right    4 = Top L & R   5 = Bottom Left
  146.                    6 = Bot Center   7 = Bot Right   8 = Bottom L & R
  147. 6     307 c7   Set page number
  148.           <307><old # high order><old # low order>
  149.                 <new # high order><new # low order><307>
  150.           Only low order 15 bits determine the page number.
  151.           If high bit is set, style is Roman, otherwise Arabic.
  152. 8     310 c8   Set page # col positions
  153.           <310><old left><old cen><old right>
  154.                 <new left><new cen><new right><310>
  155. 42    311 c9   Set tabs (used in 2.2-4.1, 4.2 and later uses 361)
  156.           <311><old tab table (20. Bytes)><new tab table (20. Bytes)><311>
  157.           Each bit represents one position counting from bit 0 to bit 159
  158. 3     312 ca   Conditional end of page
  159.           <312><number of single spaced lines not to be broken><312>
  160. 6     313 cb   Set pitch and/or font
  161.           <313><old pitch><old font><new pitch><new font><313>
  162.           If pitch is negative, then it is proportional.
  163. 4     314 cc   Set temporary margin (indent)
  164.           <314><old tmar><new tmar><314>
  165. 3     315 cd   End of temporary margin (used in versions before 2.2)
  166.           <315><temp marg><315>
  167. 4     316 ce   Set top margin (values are in half lines)
  168.           <316><old top marg><new top marg><316>
  169. 3     317 cf   Suppress page characteristics
  170.           <317><supress code><317>
  171.           Code: (any or all bits may be inclusive or'ed together)
  172.              1 = all suppressed
  173.              2 = pg #'s suppressed
  174.              4 = pg # moved to bottom
  175.             10 = all headers suppressed
  176.             20 = header a suppressed
  177.             40 = header b suppressed
  178.            100 = footer a suppressed
  179.            200 = footer b suppressed
  180. 6     320 d0   Set form length
  181.           <320><old form length><old # of text lines>
  182.                 <new form length><new # of text lines><320>
  183.           Form length is stored as a number of 6 lpi lines
  184.           Number of text lines is stored in half-lines
  185. -1    321 d1   Header/footer
  186.           <321><old def byte><# 1/2 lines used by old header/footer><377>
  187.                 <377><lmar><rmar> -text- <377><# of 1/2 lines><def><321>
  188.           Type (low-order 2 bits)       Occurrence (high-order 6 bits)
  189.                0 = header a                 0 = never
  190.                1 = header b                 1 = all pages
  191.                2 = footer a                 2 = odd pages
  192.                3 = footer b                 4 = even pages
  193.           Note that the low-order two bits of the old def byte must be   
  194. correct
  195. -1    322 d2   Footnote (used in 2.2-3.0, 4.0 and later uses 342)
  196.           <322><fn #><# of half lines><377><lmar><rmar> -text- <322>
  197. 4     323 d3   Set footnote # (used in 2.2-3.0, 4.0 and later uses 344)
  198.           <323><old #><new #><323>
  199. 4     324 d4   Advance to half-line # (stored in half-line values)
  200.           <324><old line #><adv to 1/2 line #><324>
  201. 4     325 d5   Set lines per inch (only 6 or 8 lpi is valid)
  202.           <325><old lpi code><new lpi code><325>
  203. 6     326 d6   Set extended tabs
  204.           <326><old start><old increment><new start><new increment><326>
  205.           Starting column position must be at least 160
  206. -1    327 d7   Define math columns
  207.           <327><Old Col. Def (24 Bytes)>
  208.                    [<Old Calc 0>]<0>[<Old Calc 1>]<0>
  209.                    [<Old Calc 2>]<0>[<Old Calc 3>]<0><377>
  210.                <New Col. Def (24 Bytes)>
  211.                    [<New Calc 0>]<0>[<New Calc 1>]<0>
  212.                    [<New Calc 2>]<0>[<New Calc 3>]<0><327>
  213. 4     330 d8   Set alignment character
  214.           <330><old char><new char><330>
  215. 4     331 d9   Set left margin release (# of columns to go left)
  216.           <331><old #><new #><331> (used in 2.2-3.0, not used in 4.0)
  217. 4     332 da   Set underline mode
  218.           <332><old mode><new mode><332>
  219.                0 = normal underlining
  220.                1 = double underlining
  221.                2 = single underlining continuous
  222.                3 = double continuous
  223. 4     333 db   Set sheet feeder bin number
  224.           <333><old #><new #><333>
  225.           Number is stored as one less than the bin number
  226.                (bin #1 = 0, etc.)
  227. -1    334 dc   End of page function (WordPerfect inserts this--changes each
  228.                version)
  229.           <334><# of 1/2 lines at end of page, low 7 bits><high 7 bits>
  230.                <# of 1/2 lines used for footnotes>
  231.                <# of pages used for footnotes>
  232.                <# footnotes on this page><ceop flag><suppress code><334>
  233.           If eop for last col on page then after <suppress>
  234.                comes 23 more bytes:
  235.                <# of 1/2 lines for col 1><# of 1/2 lines for col 2>
  236.                <# of 1/2 lines for col 3>...<# of 1/2 lines for col 23>
  237.                <line # of col on (0 if none on this page)>
  238. 24    335 dd   Define columns (used in 2.2-4.1, 4.2 and later uses 363)
  239.           <335><old#cols><l1><r1><l2><r2><l3><r3><l4><r4><l5><r5>
  240.                 <new#cols><l1><r1><l2><r2><l3><r3><l4><r4><l5><r5><335>
  241.           # cols:  low-order 7 bits = number
  242.                    high-order 1 bit = 1 if parallel columns (for 4.1)
  243. 4     336 de   End of temp marg
  244.           <336><old left tmar><old right tmar><336>
  245. -1    337 df   Invisible characters (embedded printer command)
  246.           <337><7-bit text><337>
  247.           If character is >=277, then it is represented as <277><char-277>
  248. 4     340 e0   L/R temporary margin
  249.           Old format (pre 4.0):
  250.                <340><New right tmar><new left tmar><340>
  251.           New format (4.0):
  252.                <240><0><Difference between old and new left margin><340>
  253. 3     341 e1   Extended character
  254.           <341><character><341>
  255. -1    342 e2   New footnote/endnote (4.0 and later)
  256.           <342><def><a><b><c><d><old ftnln><# ln pg 1><# ln pg 2>...
  257.                <# Ln pg n><# pgs><377><lmar><rmar> - text - <342>
  258.           Def: Bit 0: 0 = use numbers, 1 = use chars
  259.                Bit 1: 0 = footnote, 1 = endnote
  260.           a,b: If def bit 0 = 0, then a,b = footnote/endnote #
  261.                If def bit 0 = 1, then a = # of chars, b = char
  262.           c,d: Number of lines in foot/end note
  263.           Note:  a,b and c,d are 14 bit numbers split into 7-bit bytes, high
  264.                    order byte first
  265.           Note:  For endnotes, there is just a null between <d> & <377>
  266. 150   343 e3   Footnote information (options) function
  267.           <343><old values 74 bytes><new values 74 bytes><343>
  268.           Byte Meaning
  269.            1       spacing in footnotes
  270.            2       spacing between footnotes
  271.            3       number of lines to keep together
  272.            4       flag byte (bits: b ln en ft n)
  273.                         n: 1 if numbering starts on each page
  274.                    en & ft:    0 = use numbers
  275.                            1 = use characters
  276.                            2 = use letters
  277.                        ln: 0 = no line separator
  278.                            1 = 2" line
  279.                            2 = line from left to right margin
  280.                            3 = 2" line & "Footnote continued" message
  281.                         b: 0 = footnotes after text
  282.                            1 = footnotes at bottom of page
  283.           5        # of chars used in place of ftn #'s
  284.           6-10 chars used in place of ftn #'s (null terminated if < 5)
  285.           11       # of displayable chars in string for footnote-text
  286.           12-26    string for footnote-text
  287.           27       # of displayable chars in string for endnote-text
  288.           28-42    string for endnote-text
  289.           43       # of displayable chars in string for footnote-note
  290.           44-58    string for footnote-note
  291.           59       # of displayable chars in string for endnote-note
  292.           60-74    string for endnote-note
  293. 6     344 e4   New set footnote # (4.0 and later)
  294.           <344><old # high><old # low><new # high><new # low><344>
  295.           Footnote numbers are 14 bit numbers split into 7-bit bytes, high
  296.                order byte first
  297. 23    345 e5   Paragraph number definition
  298.                (used in 2.2-4.1, 4.2 and later uses 356)
  299.           <345><old 7 level numbers><old 7 def bytes>
  300.                <new 7 def bytes><345>
  301.           Def byte = two nibbles:
  302.                Numbering style (low nibble) Punctuation (high nibble)
  303.                0 = caps Roman               0 = nothing
  304.                1 = l.c. Roman               1 = "." after number
  305.                2 = caps letter          2 = ")" after number
  306.                3 = l.c. letter          3 = "(" before, ")" after
  307.                4 = Arabic
  308.                5 = Arabic with previous levels separated by "."
  309. 11    346 e6   Paragraph number (used in 2.2-4.1, 4.2 and later uses 357)
  310.           <346><new level #><def byte><old 7 numbers><346>
  311.           Level # is 0 for first level, 1 for 2nd, etc.
  312. 3     347 e7   Begin marked text
  313.           <347><def,info><347> - text - <350><def,info><350>
  314.                Definition (high nibble)     Information (low nibble)
  315.                0 = table of contents        level (0-4)
  316.                2 = list                     list # (0-4)
  317. 3     350 e8   End marked text
  318.           <350><def,info><350>
  319.           Def, info same as for mark (347)
  320. -1    351 e9   Define marked text
  321.           <351><def,info><5 bytes definition><concordance file name><351>
  322.           Def, info byte:
  323.                Definition (high nibble)     Information (low nibble)
  324.                0 = table of contents        level (0-4)
  325.                1 = index                    concordance file flag
  326.                2 = list                     list # (0-4)
  327.                3 = ToA                      ToA section # (0-15)
  328.  
  329.           For Index the low nibble of the def, info byte is:
  330.                    0 = no concordance file
  331.                    1 = concordance file name included in function
  332.           For ToC, 5 Definition bytes represent the five levels
  333.           For index and lists only first definition byte is significant
  334.                Definition bytes for ToC, index, and lists:
  335.                    0 = no page numbers
  336.                    1 = page # after text, preceded by two spaces
  337.                    2 = page # after text, in parentheses, preceded by one
  338.                        space
  339.                    3 = page # flush right
  340.                    4 = page # flush right with dot leader
  341.           For ToA, just first def byte is significant
  342.                Def byte=xxxBxxDU
  343.                    B=1 if blank line should be inserted between authorities
  344.                    D=1 if dot leader before page numbers
  345.                    U=1 if underlining allowed
  346. -1    352 ea   Define index mark
  347.           <352><index heading><0><subheading><352>
  348. 32    353 eb   Date/Time function
  349.           <353><30 byte, null terminated format string><353>
  350. 4     354 ec   Block Protect
  351.           <354><Def><# of 1/2 lines in block><354>
  352.           Def  = 0 for Block Protect On
  353.                = 1 for Block Protect Off
  354. -1    355 ed   Table of Authorities
  355.           <355><Section Number><0>short form<0>full form<355>
  356.                Section Number = 0-15 or 32
  357.                0 thru 15 are valid section numbers
  358.                a section number of 32 is used to indicate that the function
  359.                contains only a short form and no full form
  360. 44    356 ee   Paragraph Number Definition (new)
  361.           <356><old 7 level numbers (words)><old 7 def bytes>
  362.                <new 7 def bytes><7 starting level #'s (words)><356>
  363.           each def byte = two nibbles
  364.           low nibble = numbering style      high nibble = punctuation    
  365.           ----------                    -----------
  366.           0 = caps roman                0 = nothing
  367.           1 = l.c. roman                1 = "." After number
  368.           2 = caps letter               2 = ")" after number
  369.           3 = l.c. letter               3 = "(" before, ")" after
  370.           4 = arabic
  371.           5 = arabic with previous levels separated by "."
  372. 18    357 ef   Paragraph Number (new)
  373.           <357><new level #><def byte><old 7 numbers (words)><357>
  374.                 level # is 0 for first level, 1 for 2nd, etc.
  375. 6     360 f0   Line Numbering
  376.           <360><Old Interval><Old Position>
  377.                <New Interval><New Position><360>
  378.           interval = STR00000:
  379.                bit 7 (S) = Status (1 = line numbering on)
  380.                bit 6 (T) = Number only Text lines (1 = on)
  381.                bit 5 (R) = Restart numbering on each page (1 = on)
  382.                00000 = line numbering interval (0-30)
  383.           position =   distance from left edge of paper to right edge of
  384.                        line number in 10ths of an inch 
  385. 106   361 f1   Tab Reset
  386.           <361><old tab table (32 bytes)><old type table (20 bytes)>
  387.                <new tab table (32 bytes)><new type table (20 bytes)><361>
  388.                Each bit in tab table represents one position counting bit 0
  389.                    to 250.
  390.                    Each nibble in type table is the type of the
  391.                        corresponding tab, ie. the 5th nibble is the type for
  392.                        the 5th bit set, up to 40 tabs, the rest are assumed
  393.                        type 0.
  394.                Types:  0 = Normal left justified tab
  395.                        1 = Centered tab
  396.                        2 = Right justified tab
  397.                        3 = Decimal aligned tab
  398.                        4 = Left justified tab with a dot leader
  399.                        5 = not used
  400.                        6 = Right justified with a dot leader
  401.                        7 = Decimal aligned with a dot leader
  402. -1    362 f2   Comment/Summary
  403.           <362><Def><old ufcur><# Lines><0> - Text - <362>
  404.           Def: Bit 0=0 if comment
  405.                     =1 if document summary, all text in following format:
  406.           Date Of Creation <HRt> Author <HRt> Typist <HRt> Comments
  407. 100   363 f3   Define columns (length is 24*2*2+4)
  408.           <363><old#cols><l1><r1><l2><r2>...<l24><r24>
  409.                 <new#cols><l1><r1><l2><r2>...<l24><r24><363>
  410.           # cols:  low-order 7 bits = number
  411.                    high-order 1 bit = 1 if parallel columns
  412.  
  413. 4     364 f4   Point size (not implemented in IBM PC version)
  414.           <364><old size><new size><364>
  415.           size is in points (1/72 inch)
  416.  
  417. -1    365 f5   Picture
  418.           for Mac: 8 bytes for rectangle
  419.                    4 bytes for type (PICT)
  420.                    2 bytes for indentifier
  421.           perhaps also def byte to indicate whether it takes up space or
  422.           overlays existing text; perhaps size in half line (maybe a 0 size
  423.           is sufficient to indicate it overlays existing text).
  424.  
  425. 5     366 f6   Different display character when hyphenated
  426.           <366><def byte><char when inline><char when hyphenated><366>
  427.           bits in def byte:
  428.                bit 0 = 0 if no hyphenation next to function
  429.                      = 1 if hyphenation happens next to function
  430.                bit 1 = 0 if this function is after the hyphenation
  431.                      = 1 if this function preceeds the hyphenation
  432.           if a char is a null, then nothing is displayed for it.
  433.           examples:  papaatje = pa-pa-<366><1><"a"><0><366>tje   
  434.                      dineetje = di-ne<366><3><"e"><"r"><366>-tje  
  435.  
  436. -1    367 f7   Leading (for Mac)
  437.  
  438.