====================================================================== DW0078: WORD PROCESSING FILE CONVERSION UTILITY ====================================================================== -------------------------------------------------------------------- | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY | | ACCOMPANY THIS DOCUMENT (collectively referred to as an | | Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY | | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO | | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | | PARTICULAR PURPOSE. The user assumes the entire risk as to the | | accuracy and the use of this Application Note. This Application | | Note may be copied and distributed subject to the following | | conditions: 1) All text must be copied without modification and | | all pages must be included; 2) If software is included, all files | | on the disk(s) must be copied without modification (the DOS | | utility DISKCOPY is appropriate for this purpose); 3) All | | components of this Application Note must be distributed together; | | and 4) This Application Note may not be distributed for profit. | | | | Copyright 1990-1994 Microsoft Corporation. All Rights Reserved. | | Microsoft and the Microsoft logo are registered trademarks of | | Microsoft Corporation. | -------------------------------------------------------------------- WPTOWP is a utility that converts Works, Word, RTF (Rich Text Format), and IBM DCA/RFT word processing documents to a different format. For example, WPTOWP converts a DCA/RFT document to a Word document and vice versa. RUNNING THE WPTOWP CONVERSION PROGRAM ------------------------------------- There are three ways to use the WPTOWP program: 1. You can run the conversion program from within Works 2.0: a. From the File menu of Works 2.0, choose Convert. b. Select the file to be converted and choose OK. c. Select the format and directory for the new file. d. Type the new filename and choose OK. 2. You can run the conversion program directly by typing "WPTOWP" (without the quotation marks) at the MS-DOS prompt and following the program instructions. To start the program, do the following: a. Change to the MS-DOS directory where WPTOWP.EXE resides. b. At the MS-DOS prompt, type WPTOWP and press ENTER to start the conversion program. After you start the WPTOWP program, follow the instructions and menu on the screen. The program prompts you for the input filename, output filename, type of conversion, and stylesheet if the conversion is Word to RTF or RTF to Word. 3. You can start the program at the MS-DOS prompt by typing "WPTOWP" followed by its parameters and pressing ENTER, as follows: WPTOWP infile outfile /filetype [/o] [/s=filename] [/n] [/q] For example: WPTOWP OLD.DOC NEW.DOC /rtf /o /s=TECH.STY /n /q infile is the input document filename or filenames. Multiple filenames are allowed through the use of MS-DOS wildcards (for example, *.DOC or LETTER?.DOC). outfile is the output document filename, or if multiple filenames were specified for infile, outfile is either the directory location for the newly converted documents, or it is a DOS wildcard specification. For example, if infile were *.DOC, a good outfile would be *.DCA if you were converting Word documents to DCA/RFT documents. /filetype is the type of conversion being performed. This can be /works for Works 2.00, /word for Word 5.00, /rtf for Rich Text Format, or /dca for IBM DCA/RFT. Earlier versions of Works and Word documents are read and converted by WPTOWP but not written -- that is to say, files cannot be converted to one of these formats. Rich Text Format (RTF) is primarily used for converting between Word for the Macintosh and Word for Windows. /o means the output file may overwrite an existing file of that name. /s means that a stylesheet of name filename is used in the Word to RTF conversion or attached in the RTF to Word conversion. This is explained further below in the section on conversion limitations. /n means "no merge," or don't attempt to translate merge documents (indicated by beginning and ending chevron characters) when converting from Word for DOS to RTF then to Word for Windows fields. /q means "quiet," or don't display any error messages. All of the slash (/) options (/filetype, /o, /s, /n, /q, and the DCA/RFT conversion options) can be put into a WPTOWP.INI file, a simple text file with one switch or command per line. The WPTOWP.INI file can also have comment lines, which are marked by the number sign (#) at the beginning of the line. This file should be located in the same directory or on the same floppy disk as the WPTOWP program file. CONVERSION INFORMATION AND LIMITATIONS -------------------------------------- This section explains certain limitations on conversions between documents formatted in the Works Word Processor, Word, and IBM DCA/RFT. All conversions to and from the Works Word Processor use RTF (Rich Text Format) as an intermediate format. For example, a conversion from Word for DOS to Works involves two steps: a conversion from Word to RTF and a conversion from RTF to Works. The intermediate RTF file is erased by the conversion program when it is no longer needed. You can explicitly convert to RTF from Works if you want to preserve the RTF file. An explicit conversion to RTF format is also the means by which files can be transferred to and from Word for the Macintosh. There is no "direct" conversion between Works and Macintosh Word file formats at this time. Converting Between Word and Works --------------------------------- When converting from Word to Works, the following conversion limitations apply: - Only the first header or footer is converted, and it must appear at the beginning of the Word division in order to be translated. - Works does not have different right and left headers. If one of the two is present in a Word document, it is preserved in the Works document. If both are present, the longer of the two, including formatting, is preserved. - The initial top and bottom margins in the Word document determine the Works document's top and bottom margins. This is also true for page size. - All styles are converted to Works as direct formatting. - Graphics are lost when converting to Works. - Side-by-side paragraphs in Word are converted to ordinary paragraphs in Works. - Text or graphics positioned with the Format Position command are vertically positioned in line when converted to Works. - Tables of contents and index entries are lost when converting to Works. However, the generated table of contents or index is preserved. - Glossary information and outline structure are lost when converting to Works. - When converting from Word to Works, only the first character of a user-defined footnote reference marker is converted. - Annotations in Word are converted to footnotes in Works. When converting from Works to Word, the following conversion limitations apply: - Headers and footers must appear at the beginning of the Works document in order to be converted. - Works for DOS allows part of a header to be flush left, part to be centered, and part to be flush right. This format is converted to a single paragraph in Word (because all headers are paragraphs in Word) with tabs separating the parts of the original header. - The &f code in headers and footers is lost when converting to Word. - Tab leaders for default tabs are lost when converting to Word. Conversion to and from Word --------------------------- - Headers and footers must appear at the beginning of the division in the Word document in order to be converted. - Paragraph shading is ignored. - Bold Word borders are translated to thick RTF borders. - Thick RTF borders become bold when converted into Word. - Stylesheet conversion from Word to RTF: The conversion looks for the stylesheet that was attached to the original document. If that stylesheet is found, the stylesheet information is converted in the RTF file. (Styles are stored with the document in RTF.) If the stylesheet is not found, you are prompted for the pathname of the stylesheet to attach. If you choose not to attach a stylesheet (or the stylesheet does not match the style information in the Word file), styled text in the original Word file becomes direct formatted text in the RTF file. - Stylesheet conversion from RTF to Word: The conversion prompts you to attach a stylesheet, if desired. Styled text in the RTF document becomes direct formatted text in the resulting Word document if no stylesheet is attached or if the stylesheet does not match the style information in the RTF file. - Graphics conversion from Word to RTF: Word for DOS includes graphics by specifying a picture "tag," or the pathname of the picture file to be included in the document. These tags are converted to RTF picture fields. Sizing information is not preserved. - Graphics conversion from RTF to Word: RTF picture fields are converted to Word picture tags. Bitmaps and Windows metafiles stored in an RTF file are not converted. Scaling and cropping information is not preserved. - Simple merge documents (with DATA, NEXT, and field names) are supported in both directions. Other merge instructions (IF, SET, ASK, etc.) are not supported. - Word marks merge instructions with left and right chevron characters. By default, all left and right chevron characters (ASCII 174 and 175) are assumed to be part of merge instructions when converting Word documents to RTF. To turn this feature off and convert chevrons literally, use the /n option in WPTOWP. If WPTOWP finds chevrons that it cannot translate into merge instructions, and the /n option is not being used, the conversion is halted. - Tables of contents and index entries are converted. However, the generated table of contents or index is brought across as simple text and should generally be deleted before generating the new table of contents or index. - Word page numbering formatted with the Format Division Line-Numbers command is converted to RTF only when there is no existing header or footer. - Glossary information is not converted. Customizable Font Mapping Between Works and Word ------------------------------------------------ In general, there should not be font mapping problems between Works and Word provided the same printer driver is used with both documents. However, you can make your own font mapping tables to override some or all of the built-in font conversions provided by the WPTOWP for Works to RTF and RTF to Works. The actual translation of the font names and numbers occurs in the Works <-> RTF part of the conversion. (The RTF file with the new font information is then read in by Word.) The translation tables are in the form of two ASCII files: RTF-WWP.DAT (to map RTF fonts to Works font numbers) and WWP-RTF.DAT (to map Works font numbers to RTF fonts). The files must be in the same directory as the document or the converter. The entries in the file map Works font numbers to and from RTF fonts. The names of fonts are not case sensitive, but the lines in the tables must run in ascending order by the first character of each line (a-z, 0-9). Comments can be inserted in the file with the number sign (#), either at the beginning of a line or after the font mapping entry. RTF-WWP.DAT ----------- To map RTF fonts to Word format, you can create the file RTF- PCW.DAT. Each line of the file must be in the following format: FontName;WorksFontNumber Example: courier;8 timesroman;16 The first line in this example changes all RTF characters in Courier to Works characters in font 8 (Helvetica). The second line converts all RTF characters in Times Roman to Works characters in font 16 (Roman a). A list of all Works font numbers and their meanings appears in the font table near the top of every RTF file created from a Works source document. WWP-RTF.DAT ----------- To map Works font numbers to RTF fonts and font families, you can create the file WWP-RTF.DAT. Each line of the file must be in the following format (brackets indicate an optional item): WorksFontNumber;FontName[,FontFamily] Example: 8;courier,modern 16;timesroman,roman The first line in this example changes all Works characters in font 8 (Helvetica) into RTF characters in Courier. The second line converts all Works characters in font 16 (Roman a) to RTF characters in Times Roman. Customizable Font Mapping Between Word and RTF ---------------------------------------------- The same customizable font mapping capability that exists for conversions between Works and RTF exists for conversions between Word and RTF. The only difference is that the files are named PCW-RTF.DAT and RTF-PCW.DAT. Conversions Involving DCA/RFT ----------------------------- Below is a list of features not supported by the conversion to DCA/RFT: 1. Character Formatting a. Italic text becomes regular text. b. Small caps become regular caps. c. Hidden text becomes underlined text. 2. Paragraph Formatting a. Right aligned text becomes left aligned in versions of DisplayWrite prior to v4.2. b. Hanging indents do not exist in DCA/RFT. Tabs and indent tabs are used to maintain appearance. c. Only 0.5, 1, 1.5, 2, 2.5, and 3 line spacing convert to DisplayWrite. 3. Division Formatting a. Snaking columns must be terminated with a hard column break; otherwise snaking column text is converted to single column text. b. Where RTF snaking columns are converted into DCA/RFT multiple columns, only consistent line spacing is supported. c. Page numbering outside of running heads is not supported. 4. Other a. Normal and nonbreaking hyphens become required hyphens. Optional hyphens become syllable hyphens. b. Leading characters for tab stops are not converted. c. Merge documents are not supported. All special marks become normal text. d. Indexes and tables of contents are not supported. All special marks become normal text. e. Style sheets and glossary files are not converted. f. Outlining is not supported. Below is a list of features not supported by the conversion from DCA/RFT: 1. Document comments are not translated. 2. Lines per inch commands are not supported. 3. Half justification becomes full justification. 4. Page numbering outside of header text is not supported. 5. Merge documents are not supported. All special marks become normal text. Conversion Options ------------------ 1. Variant=5520 This switch should be set for conversions from RTF to DCA/RFT in the 5520 environment. It tells the conversion to generate some different DCA/RFT structures in cases where the DCA/RFT required by the 5520 differs from that required by PC DisplayWrite. 2. Tab=CommaTab The setting of this switch determines the disposition of any decimal tabs found in the RTF. The default action is to translate RTF decimal tabs into DCA/RFT period tabs. However, especially for European versions of word processors that use comma tabs, this parameter may be set to translate RTF decimal tabs into DCA/RFT comma tabs. 3. StrikeThrough='\' This switch is used in the RTF to DCA/RFT conversion to set the strikethrough character. The default is the hyphen (-). 4. TranslateBeta=Greek The setting of this switch determines how the ANSI beta character is translated. The default action is to translate it into the German s-set character (a character in the DisplayWrite Character Set). However, you may want to set this character to be translated to the Greek beta character (a character in the DisplayWrite Symbol Set). DCA/RFT Customizable Font Mapping --------------------------------- You can create your own font mapping tables to override some or all of the mappings provided by the conversion. The tables are in the form of two ASCII files, one for each direction of the conversion. The files are used to map RTF fonts to and from DCA/RFT GFIDs (Generic Font Identifiers). The files must be located either in the directory where the document is located or in the directory where the converter is located. All RTF font sizes are specified in half-points. The names need not be capitalized in any particular manner, but the tables must be in ascending order by the first character of each line (a-z, 0-9). Comments can be inserted in the file with a number sign (#) either at the beginning of a line or after the font mapping entry. In theexamples below, the terms in brackets are optional. A range of point sizes or GFIDs can be specified with a hyphen between the two numbers. RTF-DCA.DAT ----------- The file RTF-DCA.DAT can be created for the conversion to use in mapping RTF fonts to GFIDs (RTF to DCA/RFT conversion). Each line of the file must be in the following format (brackets indicate an optional item): FontName,PointSize[-PointSize]; GFID[,[Width][,Attrib]] Example: timesroman,0-20;25 timesroman,24;26 RTF font sizes are specified in half-points. DCA-RTF.DAT ----------- The file DCA-RTF.DAT can be created for the conversion to use in mapping GFIDs to RTF fonts (DCA/RFT to RTF conversion). Each line of the file must be in the following format (brackets indicate an optional item): GFID[-GFID];FontName,[FontFamily], PointSize Example: 25;timesroman,roman,20 26;timesroman,,24 Note that the font family is optional, but the comma preceding it is required. Again, all RTF font sizes are specified in half- points.