Pictures (including OLE objects) are stored as a sequence of bytes in the text stream. These bytes can be identified as picture information by examining their paragraph formatting. One picture is exactly one paragraph. Paragraphs that are pictures have a special bit set in their paragraph property (PAP) structure. For more information on the PAP structure, see Section 8.3, Formatting.
Each picture consists of a descriptive header followed by the data that makes up the picture. The header for OLE objects is different from the one used for pictures. The picture header has the following form:
Byte | Name | Description |
07 | mfp | Windows METAFILEPICT structure (hMF member undefined) |
89 | dxaOffset | Offset of picture from left margin, in twips (1/1440 inch) |
1011 | dxaSize | Horizontal size, in twips |
1213 | dyaSize | Vertical size, in twips |
1415 | cbOldSize | Number of following bytes (actual metafile or bitmap bits); set to zero |
1629 | bm | Additional information for bitmaps only |
3031 | cbHeader | Number of bytes in this header |
3235 | cbSize | Number of following bytes (actual metafile or bitmap bits), replacing cbOldSize for new files |
3637 | mx | Scaling factor (x) |
3839 | my | Scaling factor (y) |
40? | cbHeader | Picture contents, through cbHeader+cbSize1 |
The mm member (bytes 01) of the METAFILEPICT structure specifies the mapping mode used to draw the picture. The last set 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 will be metafile contents.
If the picture has never been rescaled with the Size Picture command in Write, the scaling factors in each direction will be 1000 (decimal). If the picture has been resized, the scaling factor will be the percentage of the original size that the picture is now, relative to 1000 (100 per cent).
For information about the METAFILEPICT structure and bitmaps, see the Microsoft Windows Guide to Programming and the Microsoft Windows Programmer's Reference, Volumes 1 and 3.
The descriptive header for OLE objects is similar to the one used for pictures. The OLE object header has the following form:
Byte | Name | Description |
01 | mm | Must be 0xE4 |
25 | Not used | |
67 | objectType | Type: 1=static, 2=embedded, 3=link |
89 | dxaOffset | Offset of picture from left margin, in twips (1/1440 inch) |
1011 | dxaSize | Horizontal size, in twips |
1213 | dyaSize | Vertical size, in twips |
1415 | Not used | |
1619 | dwDataSize | Number of bytes in the object data that follows the header |
2023 | Not used | |
2427 | dwObjNum | Hexadecimal number that, when converted to an 8-digit string, represents the object's unique name |
2829 | Not used | |
3031 | cbHeader | Number of bytes in this header |
3235 | Not used | |
3637 | mx | Scaling factor (x) |
3839 | my | Scaling factor (y) |
40? | cbHeader | Object contents, through cbHeader+dwDataSize1 |
The scaling factors for OLE objects work the same way as they do with pictures.