Pictures are stored in the text as \pict destinations: a few words that
say what kind of picture it is and how big, then the picture file itself, written as
hexadecimal digits or as raw bytes after \bin. Embedded and linked objects
are \object destinations that carry the object’s data and, for readers
that cannot use it, a ready-made result.
Pictures
<pict> = '{' \pict (<brdr>? & <shading>? & <picttype> & <pictsize> & <metafileinfo>?) <data> '}'
<picttype> = \emfblip | \pngblip | \jpegblip | \macpict | \pmmetafile | \wmetafile
| \dibitmap <bitmapinfo> | \wbitmap <bitmapinfo>
<bitmapinfo> = \wbmbitspixel & \wbmplanes & \wbmwidthbytes
<pictsize> = (\picw & \pich) \picwgoal? & \pichgoal? \picscalex? & \picscaley? & \picscaled?
& \piccropt? & \piccropb? & \piccropr? & \piccropl?
<metafileinfo> = \picbmp & \picbpp
<data> = (\bin #BDATA) | #SDATA
Word 97 and later write each picture twice: once for themselves inside
{\*\shppict {\pict …}}, usually as PNG, JPEG or EMF, and once for older
readers inside {\nonshppict {\pict …}}, usually as a Windows metafile,
which Word itself skips:
{\*\shppict {\pict \emfblip … }}{\nonshppict {\pict … }}
Picture type
| Control word | The data is |
|---|---|
\pict | Destination: a picture. |
\shppict | Destination: a Word 97–2000 picture, holding a \pict. |
\nonshppict | Destination: a copy of the picture for other readers, which Word does not read. |
\emfblip | An enhanced metafile (EMF). |
\pngblip | A PNG file. |
\jpegblip | A JPEG file. |
\macpict | A QuickDraw picture (PICT). |
\pmmetafileN | An OS/2 metafile; N is its unit type, see below. |
\wmetafileN | A Windows metafile (WMF, without the placeable header); N is its mapping mode (default 1), see below. |
\dibitmapN | A Windows device-independent bitmap: the BITMAPINFO structure followed by the pixels, as from GetDIBits. N must be 0. |
\wbitmapN | A Windows device-dependent bitmap, as from GetBitmapBits. N must be 0. This is the default when no type is given. |
The specification discourages \wbitmap and \dibitmap and
recommends putting bitmaps inside Windows metafiles instead.
Bitmap information
| Control word | Meaning |
|---|---|
\wbmbitspixelN | Bits per pixel on each plane: 1 (monochrome, default), 4 (16 colours), 8 (256 colours) or 24 (RGB). |
\wbmplanesN | Number of colour planes; must be 1. |
\wbmwidthbytesN | Bytes in each raster line. Must be even: N × 8 is the first multiple of 16 at or above \picw. |
Size, scaling and cropping
| Control word | Meaning |
|---|---|
\picwN | Width: the metafile’s xExt, or the width in pixels of a bitmap or QuickDraw picture. A long integer. |
\pichN | Height: the metafile’s yExt, or the height in pixels. A long integer. |
\picwgoalN | Width the picture should be shown at, in twips. |
\pichgoalN | Height the picture should be shown at, in twips. |
\picscalexN | Horizontal scale as a percentage (default 100). |
\picscaleyN | Vertical scale as a percentage (default 100). |
\picscaled | Scale the picture to fit its frame; \macpict only. |
\piccroptN | Crop from the top, in twips. Positive crops towards the centre; negative adds a blank border (default 0). |
\piccropbN | Crop from the bottom. |
\piccroplN | Crop from the left. |
\piccroprN | Crop from the right. |
\picprop | Destination: shape properties applied to an inline picture. |
\defshp | The inline picture is a WordArt shape. |
The size on the page is \picwgoal × \picscalex / 100 by
\pichgoal × \picscaley / 100, less the cropping.
Metafile information and data
| Control word | Meaning |
|---|---|
\picbmp | The metafile contains a bitmap. |
\picbppN | Bits per pixel of that bitmap, 1 to 32; 1, 4, 8 and 24 are recognised. |
\binN | The picture follows as N raw bytes. The only control word with a 32-bit parameter. Without it the picture is hexadecimal digits. |
\blipupiN | Units per inch of the picture, written for some image types. |
\blipuid | Destination: {\*\blipuid XXXX}, a 16-byte identifier of the image in hexadecimal. |
\bliptagN | A mostly unique identifier for the picture, a long integer. |
Hexadecimal data may be broken over lines anywhere, since line breaks are ignored.
Binary data must not be: a carriage return or line feed inside \bin data
is part of the picture. Only the one space that ends \binN is a delimiter;
any more spaces become picture data.
Windows metafile mapping modes
| N | Mapping mode | N | Mapping mode |
|---|---|---|---|
| 1 | MM_TEXT | 5 | MM_HIENGLISH |
| 2 | MM_LOMETRIC | 6 | MM_TWIPS |
| 3 | MM_HIMETRIC | 7 | MM_ISOTROPIC |
| 4 | MM_LOENGLISH | 8 | MM_ANISOTROPIC |
Word writes \wmetafile8, with \picw and \pich
in hundredths of a millimetre.
OS/2 metafile units
| N | Units | N | Units |
|---|---|---|---|
| 0x0004 | PU_ARBITRARY | 0x0014 | PU_LOENGLISH |
| 0x0008 | PU_PELS | 0x0018 | PU_HIENGLISH |
| 0x000C | PU_LOMETRIC | 0x001C | PU_TWIPS |
| 0x0010 | PU_HIMETRIC |
Example
A PNG picture 64 by 32 pixels, shown at 0.67 by 0.33 inch. The data is the PNG file
in hexadecimal: its signature 89 50 4E 47 0D 0A 1A 0A, then the
IHDR chunk, which starts with its length (13) and type:
{\*\shppict{\pict\pngblip\picw64\pich32\picwgoal960\pichgoal480
89504e470d0a1a0a0000000d4948445200000040000000200806000000…
…}}
00000040 and 00000020 in the IHDR are the
width and height, 64 and 32, matching \picw and \pich.
Objects
OLE embedded and linked objects, and Macintosh Edition Manager subscribers, are
objects. Each has optional information, a required data part, and an optional result:
ordinary RTF showing how the object last looked. Writers should always supply the
result, so that readers without the object’s program still show it. For OLE objects the
data is what OleSaveToStream writes.
<obj> = ('{' \object (<objtype> & <objmod>? & <objclass>? & <objname>? & <objtime>? & <objsize>?
& <rsltmod>?) <objdata> <result> '}') | <pubobject>
<objtype> = \objemb | \objlink | \objautlink | \objsub | \objpub | \objicemb | \objhtml | \objocx
<objmod> = \linkself? & \objlock? | \objupdate?
<objclass> = '{\*' \objclass #PCDATA '}'
<objname> = '{\*' \objname #PCDATA '}'
<objtime> = '{\*' \objtime <time> '}'
<rsltmod> = \rsltmerge? & <rslttype>?
<rslttype> = \rsltrtf | \rslttxt | \rsltpict | \rsltbmp | \rslthtml
<objsize> = \objsetsize? & \objalign? & \objtransy? & <objhw>? & \objcropt? & \objcropb? & \objcropl?
& \objcropr? & \objscalex? & \objscaley?
<objhw> = \objh & \objw
<objdata> = '{\*' \objdata (<objalias>? & <objsect>?) <data> '}'
<objalias> = '{\*' \objalias <data> '}'
<objsect> = '{\*' \objsect <data> '}'
<result> = '{' \result <para>+ '}'
Object type and information
| Control word | Meaning |
|---|---|
\object | Destination: an object. |
\objemb | OLE embedded object (the default type). |
\objlink | OLE link. |
\objautlink | OLE automatic link. |
\objsub | Macintosh Edition Manager subscriber. |
\objpub | Macintosh Edition Manager publisher. |
\objicemb | Word for the Macintosh Installable Command (IC) embedder. |
\objhtml | HTML control. |
\objocx | OLE control. |
\linkself | The object links to another part of the same document. |
\objlock | The object is locked against updates. |
\objupdate | Update the object before showing it. This overrides the size words, which should still be given sensible values. |
\objclass | Destination: the object’s class, such as Equation.3; use it instead of the class in the data. |
\objname | Destination: the object’s name. |
\objtime | Destination: when the object was last updated, as \yr, \mo and so on. |
\objattph | Placeholder for an attachment, written only when Word edits a mail message: it marks where the attachment goes but does not contain it. |
Size, position, cropping and scaling
| Control word | Meaning |
|---|---|
\objhN | Original height in twips. |
\objwN | Original width in twips. |
\objsetsize | Make the object’s server use the size given here. |
\objalignN | Distance from the object’s left edge that should line up on a tab stop; for Equation Editor equations. |
\objtransyN | Distance to move the object vertically from the baseline; for MathType equations. |
\objcroptN | Crop from the top, in twips. |
\objcropbN | Crop from the bottom. |
\objcroplN | Crop from the left. |
\objcroprN | Crop from the right. |
\objscalexN | Horizontal scale, per cent. |
\objscaleyN | Vertical scale, per cent. |
Data and result
| Control word | Meaning |
|---|---|
\objdata | Destination: the object’s data, in hexadecimal or after \bin. For OLE objects, the OLE 1 stream: a header with the class name followed by the native data. |
\objalias | Destination: the alias record of an Edition Manager publisher. |
\objsect | Destination: the section record of an Edition Manager publisher. |
\result | Destination: the object’s last result, as ordinary RTF (often a \pict). |
\rsltrtf | Make the result RTF if possible. |
\rsltpict | Make the result a Windows metafile or Macintosh PICT if possible. |
\rsltbmp | Make the result a bitmap if possible. |
\rslttxt | Make the result plain text if possible. |
\rslthtml | Make the result HTML if possible. |
\rsltmerge | Keep the current result’s formatting whenever a new result is made. |
{\object\objemb\objw2400\objh600{\*\objclass Equation.3}{\*\objdata 01050000020000000b000000…}
{\result {\pict\wmetafile8\picw4233\pich1058\picwgoal2400\pichgoal600 0100090000…}}}
The data starts with the OLE 1 stream header: version 01050000,
format 2 (embedded), then the length of the class name and the name.
Edition Manager publishers
Word for the Macintosh writes a publisher as a bookmark round the published range:
<pubobject> = '{\*' \bkmkstart \bkmkpub \pubauto? (<objalias>? & <objsect>) #PCDATA '}'
| Control word | Meaning |
|---|---|
\bkmkpub | The bookmark marks an Edition Manager publisher. |
\pubauto | Update every subscriber automatically whenever the publisher is edited. |