⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wri.htm

📁 各种文件格式说明及程序描述
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>write file format</title>
<meta name="generator" content="microsoft frontpage 3.0">
</head>

<body background="../jpg/di1.JPG">

<p align="center"><font size="6" color="#0000ff">write file format</font></p>
<div align="center"><center>

<table border="0" width="88%">
<tr>
<td width="100%"><br>
<br>
this topic describes the binary file format used by microsoft write. a write binary file
contains information about file content, text <br>
and pictures (including object-linking-and-embedding, or ole, objects), and formatting. <br>
<br>
write-file header<br>
<br>
the write-file header describes the content of the file. it contains data, pointers to
subdivisions of the formatting section, and <br>
information about the length of the file. the file header has the following form: <br>
<br>
word&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0&nbsp;&nbsp;&nbsp; wident&nbsp;&nbsp;&nbsp; must be 0137061 octal (or 0137062 octal if
the file contains ole objects) <br>
1&nbsp;&nbsp;&nbsp; dty&nbsp;&nbsp;&nbsp; must be zero <br>
2&nbsp;&nbsp;&nbsp; wtool&nbsp;&nbsp;&nbsp; must be 0125400 octal <br>
3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reserved; must be zero <br>
4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reserved; must be zero <br>
5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reserved; must be zero <br>
6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reserved; must be zero <br>
7-8&nbsp;&nbsp;&nbsp; fcmac&nbsp;&nbsp;&nbsp; number of bytes of actual text plus 128, the
bytes in one sector (low-order word first) <br>
9&nbsp;&nbsp;&nbsp; pnpara&nbsp;&nbsp;&nbsp; page number for start of paragraph
information <br>
10&nbsp;&nbsp;&nbsp; pnfntb&nbsp;&nbsp;&nbsp; page number of footnote table (fntb) or
pnsep, if none <br>
11&nbsp;&nbsp;&nbsp; pnsep&nbsp;&nbsp;&nbsp; page number of section property (sep) or
pnsetb, if none <br>
<br>
12&nbsp;&nbsp;&nbsp; pnsetb&nbsp;&nbsp;&nbsp; page number of section table (setb) or
pnpgtb, if none <br>
13&nbsp;&nbsp;&nbsp; pnpgtb&nbsp;&nbsp;&nbsp; page number of page table (pgtb) or pnffntb,
if none <br>
14&nbsp;&nbsp;&nbsp; pnffntb&nbsp;&nbsp;&nbsp; page number of font face-name table (ffntb)
or pnmac, if none <br>
15-47&nbsp;&nbsp;&nbsp; szssht&nbsp;&nbsp;&nbsp; reserved for microsoft word compatibility
<br>
48&nbsp;&nbsp;&nbsp; pnmac&nbsp;&nbsp;&nbsp; count of pages in whole file (last page
number plus 1) <br>
<br>
in the preceding list, a &quot;page number&quot; means an offset in 128-byte blocks from
the start of the file. for example, if pnpara equals <br>
10, the paragraph information is at offset 10*128 = 1280 in the file. <br>
the starting page number of character information (pnchar) is not stored but is
computable, as follows: <br>
pnchar = (fcmac + 127) / 128 <br>
examining the value of word 48 of the header is a good way to distinguish write files from
microsoft word files. if pnmac equals <br>
zero, the file originated in word. any other value identifies a write file. <br>
<br>
text and pictures<br>
<br>
after the header comes information about text and pictures. this information constitutes a
separate section of the file. <br>
<br>
text<br>
<br>
the text of the write file starts at word 64 (page 1). write uses the windows character
set (except for the pictures in the file) as <br>
well as the following special characters: <br>
<br>
&nbsp;&nbsp;&nbsp; ascii character codes 13, 10 (carriage return, linefeed) for paragraph
ends. no other occurrences of these two characters are <br>
allowed. <br>
<br>
&nbsp;&nbsp;&nbsp; ascii character code 12 for explicit page breaks. <br>
<br>
&nbsp;&nbsp;&nbsp; ascii character code 9 (normal) for tab characters. <br>
<br>
other line-break or wordwrap information is not stored. <br>
<br>
pictures<br>
<br>
pictures (including ole objects) are stored as a sequence of bytes in the text stream.
these bytes can be identified as picture <br>
information by examining their paragraph formatting. one picture is exactly one paragraph.
paragraphs that are pictures have a <br>
special bit set in their paragraph property (pap) structure. for more information on the
pap structure, see section 8.3, <br>
&quot;formatting.&quot; <br>
each picture consists of a descriptive header followed by the data that makes up the
picture. the header for ole objects is <br>
different from the one used for pictures. the picture header has the following form: <br>
<br>
byte&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0-7&nbsp;&nbsp;&nbsp; mfp&nbsp;&nbsp;&nbsp; windows metafilepict structure (hmf member
undefined) <br>
8-9&nbsp;&nbsp;&nbsp; dxaoffset&nbsp;&nbsp;&nbsp; offset of picture from left margin, in
twips (1/1440 inch) <br>
10-11&nbsp;&nbsp;&nbsp; dxasize&nbsp;&nbsp;&nbsp; horizontal size, in twips <br>
12-13&nbsp;&nbsp;&nbsp; dyasize&nbsp;&nbsp;&nbsp; vertical size, in twips <br>
14-15&nbsp;&nbsp;&nbsp; cboldsize&nbsp;&nbsp;&nbsp; number of following bytes (actual
metafile or bitmap bits); set to zero <br>
16-29&nbsp;&nbsp;&nbsp; bm&nbsp;&nbsp;&nbsp; additional information for bitmaps only <br>
30-31&nbsp;&nbsp;&nbsp; cbheader&nbsp;&nbsp;&nbsp; number of bytes in this header <br>
32-35&nbsp;&nbsp;&nbsp; cbsize&nbsp;&nbsp;&nbsp; number of following bytes (actual
metafile or bitmap bits), replacing cboldsize for new files <br>
<br>
36-37&nbsp;&nbsp;&nbsp; mx&nbsp;&nbsp;&nbsp; scaling factor (x) <br>
38-39&nbsp;&nbsp;&nbsp; my&nbsp;&nbsp;&nbsp; scaling factor (y) <br>
40?&nbsp;&nbsp;&nbsp; cbheader&nbsp;&nbsp;&nbsp; picture contents, through
cbheader+cbsize? <br>
<br>
the mm member (bytes 0-1) of the metafilepict structure specifies the mapping mode used to
draw the picture. the last set <br>
of bytes will be bitmap bits if the value of the mm member is 0xe3. this is a special
value used only in write. otherwise, the bytes <br>
will be metafile contents. <br>
if the picture has never been rescaled with the size picture command in write, the scaling
factors in each direction will be 1000 <br>
(decimal). if the picture has been resized, the scaling factor will be the percentage of
the original size that the picture is now, relative <br>
to 1000 (100 per cent). <br>
for information about the metafilepict structure and bitmaps, see the microsoft windows
guide to programming and the <br>
microsoft windows programmer's reference, volumes 1 and 3. <br>
<br>
the descriptive header for ole objects is similar to the one used for pictures. the ole
object header has the following form: <br>
<br>
byte&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0-1&nbsp;&nbsp;&nbsp; mm&nbsp;&nbsp;&nbsp; must be 0xe4 <br>
2-5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not used <br>
6-7&nbsp;&nbsp;&nbsp; objecttype&nbsp;&nbsp;&nbsp; type: 1=static, 2=embedded, 3=link <br>
8-9&nbsp;&nbsp;&nbsp; dxaoffset&nbsp;&nbsp;&nbsp; offset of picture from left margin, in
twips (1/1440 inch) <br>
10-11&nbsp;&nbsp;&nbsp; dxasize&nbsp;&nbsp;&nbsp; horizontal size, in twips <br>
12-13&nbsp;&nbsp;&nbsp; dyasize&nbsp;&nbsp;&nbsp; vertical size, in twips <br>
14-15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not used <br>
16-19&nbsp;&nbsp;&nbsp; dwdatasize&nbsp;&nbsp;&nbsp; number of bytes in the object data
that follows the header <br>
20-23&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not used <br>
24-27&nbsp;&nbsp;&nbsp; dwobjnum&nbsp;&nbsp;&nbsp; hexadecimal number that, when converted
to an 8-digit string, represents the object's unique <br>
name <br>
28-29&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not used <br>
30-31&nbsp;&nbsp;&nbsp; cbheader&nbsp;&nbsp;&nbsp; number of bytes in this header <br>
<br>
32-35&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not used <br>
36-37&nbsp;&nbsp;&nbsp; mx&nbsp;&nbsp;&nbsp; scaling factor (x) <br>
38-39&nbsp;&nbsp;&nbsp; my&nbsp;&nbsp;&nbsp; scaling factor (y) <br>
40?&nbsp;&nbsp;&nbsp; cbheader&nbsp;&nbsp;&nbsp; object contents, through
cbheader+dwdatasize? <br>
<br>
the scaling factors for ole objects work the same way as they do with pictures. <br>
<br>
formatting<br>
<br>
write files contain both character and paragraph formatting information. there can be no
gaps in either; each must begin with the <br>
first text character (byte 128) and continue through the last. the format descriptors
(fods) for the first and last paragraph must, <br>
therefore, have the value of fclim equal to the value of fcmac, as defined in the header
section. <br>
there is a difference between paragraph and character fods. a character fod may describe
any number of consecutive <br>
characters with the same formatting. however, there must be exactly one paragraph fod for
each text paragraph. in either case, <br>
it is advisable to have multiple fods point to the same formatting properties (fprops) on
a given page because it saves <br>
space in the file. no fod may point off its page. <br>
<br>
characters and paragraphs<br>
<br>
both the character and paragraph sections are structured as a set of pages. each page
contains an array of fods and a group <br>
of fprops, both of which are described later in this section. following is the format of a
page: <br>
<br>
byte&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0-3&nbsp;&nbsp;&nbsp; fcfirst&nbsp;&nbsp;&nbsp; byte number of first character covered by
this page of formatting information; equals 128 for first <br>
character in the text (low-order byte first) <br>
4杗&nbsp;&nbsp;&nbsp; rgfod&nbsp;&nbsp;&nbsp; array of fods <br>
n+1-126&nbsp;&nbsp;&nbsp; grpfprop&nbsp;&nbsp;&nbsp; group of fprops <br>
127&nbsp;&nbsp;&nbsp; cfod&nbsp;&nbsp;&nbsp; number of fods on this page <br>
<br>
an fod is fixed in size. it contains the byte offset to the corresponding fprop. following
is the structure of an fod: <br>
<br>
word&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0-1&nbsp;&nbsp;&nbsp; fclim&nbsp;&nbsp;&nbsp; byte number after last character covered by
this fod <br>
2&nbsp;&nbsp;&nbsp; bfprop&nbsp;&nbsp;&nbsp; byte offset from beginning of fod array to
corresponding fprop for these characters or this paragraph <br>
<br>
an fprop is variable in size. it contains the prefix for a character property (chp) or
paragraph property (pap), both of which are <br>
described later in this section. following is the structure of an fprop: <br>
<br>
byte&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0&nbsp;&nbsp;&nbsp; cch&nbsp;&nbsp;&nbsp; number of bytes in this fprop <br>
1杗&nbsp;&nbsp;&nbsp; rgchprop&nbsp;&nbsp;&nbsp; prefix for a chp (for characters) or a
pap (for paragraphs) sufficient to include all bits that differ from <br>
the default chp or pap <br>
<br>
following is the format of a chp: <br>
<br>
byte&nbsp;&nbsp;&nbsp; bit&nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; description<br>
<br>
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reserved; ignored by
write <br>
1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; fbold&nbsp;&nbsp;&nbsp; bold characters <br>
&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; fitalic&nbsp;&nbsp;&nbsp; italic characters <br>
&nbsp;&nbsp;&nbsp; 2-7&nbsp;&nbsp;&nbsp; ftc&nbsp;&nbsp;&nbsp; font code (low bits); index
into the ffntb <br>
2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hps&nbsp;&nbsp;&nbsp; size of font, in half
points (standard is 24) <br>
3&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; fuline&nbsp;&nbsp;&nbsp; underlined characters <br>
&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; fstrike&nbsp;&nbsp;&nbsp; reserved; ignored by

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -