[File Conversion]

656 Kreag Road - Pittsford, NY 14534-3730 - USA
PHONE: (US)-585-385-3810 FAX: (US)-585-385-6822 EMAIL:
click here


WordPort Conversion Library and API for Developers

Table of Contents


Introduction

     The Word Processor conversion library described here is intended for Windows 95/98/Me/XP/2000/NT/2000 software developers, programmers and OEMs who wish to incorporate this advanced conversion technology into their own products, without having to write code for reading and/or writing today's complex word processor native file formats. The host product(s) using this library may be for private use, or may be distributed under a license from Advanced Computer Innovations, Inc..

What is the Conversion Library?

     This library consists of 32-bit DLLs and other support files that enable your Windows application to identify, read, write and convert between all popular PC word processing file formats, as well as some specialty formats such as HTML and RTF. These DLLs are completely user-transparent, convert very accurately and integrate very easily with your Windows applications.

     Your Windows application that calls these DLLs is called the host application. The host application may be written in any language or environment that permits DLL calls. This includes C, C++, Visual C++, Visual Basic, FoxPro, Delphi, Clarion and many others.

Why use the Conversion Library?

     If you are developing an application that needs to read and/or write various file formats (such as Office 97 or 2000, Word for Windows, WordPerfect, Ami Pro, HTML, RTF, etc.), this Conversion Library saves you an incredible amount of time, work and overhead. Modern-day word processor file formats are extremely complex, and they keep changing with each new revision. Writing code to interface with those file formats is more than an on-going full-time job!

     Instead, you may use this Conversion Library to address all these complex word processor file formats. The DLLs in this library convert very accurately, and are easily called with almost no development overhead on your part. What's more, keeping up with new revisions of word processors is no longer your headache, since we do all that for you.

     Let's say your application has to create document files compatible with today's popular word processors. It need write to only one file format of your choice, then use the library to convert to any eventually desired file type. The single file format to which your application writes may be a word processor file format of your choice, a simple format such as ASCII files, or for maximum benefit a special mark-up file format called InterScript™[1] which has been developed specially with such requirements in mind.

     Similarly, if your application needs to read files coming from various word processors, it may use the conversion library to identify the incoming file(s) and convert them to a common file format, which may be a word processor file format of your choice, a simple format like ASCII files or InterScript™.

The Library DLLs

     The DLLs and interface API described in this document are 32-bit. If you need 16-bit technology, please contact us. The DLLs that you need be directly concerned with are:
     This package also contains other DLLs and additional files which are not called directly by your application. These files must be installed in the same subdirectory as WpConv.DLL. Not all of these files may be required. These files are listed later, and you may remove the ones that you do not need.

DETFILE.DLL

     This DLL determines the file format of an unknown file[2]. The C/C++ function prototype is:
extern "C" __declspec(dllimport) BOOL __stdcall detfile (
  const char FAR* lpszFileName,
  char FAR* lpszShortForm,
  char FAR* lpszLongForm);
     The function arguments are:
     Correspondingly, the Visual Basic declaration for this function is:
Private Declare Function detfile Lib "detfile.dll" ( _
  ByVal FileName As String, _
  ByVal ShortForm As String, _
  ByVal LongForm As String) _
  As Integer
where the arguments correspond to the descriptions given above.

     This DLL function always returns a value of TRUE (1). The result (source file identification) is determined by examining lpszShortForm. The possible keywords returned in lpszShortForm are:

KEYWORDDescription
!EMPTY-- Empty file --
!FERR** File Open Error **
!UNK-- Could not identify --
123/2-Lotus 1-2-3 1.x/2.x, Symphony 1.x/2.x or compatible spreadsheet
123/3Lotus 1-2-3 3.x, Symphony 3.x or compatible spreadsheet
ABILAbility file
ALPHAAlpha Works/Electric Desk document
AMDRAWAmi Professional Draw file
AMIAmi Pro document
ASCASCII (Dos text) file
BACKUPFile produced by Dos Backup
BROTDBrother Word Processor (Daisy Wheel)
BROTNBrother Word Processor (U.S. Notebook)
BROTUBrother Word Processor (U.K. Notebook)
BROTFBrother Word Processor (French Notebook)
BROTGBrother Word Processor (InkJet)
CCOMComplete Communicator/PC Switchboard fax file
CRLDRWxCorel Draw version x file (x = 3, 4 or 5)
DBASE2dBase-II data file
DBASE3+dBase-III or dBase-IV data file
DBINXdBase (or compatible) Index file
DBMEMOdBase Memo file
DSWIBM DisplayWrite document
DWA/PTSIBM DisplayWrite Assistant or PTS document
ENABxEnable WP document (version x = 1, 2, 3 or 4)
EXEMS-Dos Executable program
FFTIBM DCA (FFT) file
FXINXFoxPro data base index file
FXMEMOFoxPro data base Memo file
FXPROFoxPro data base
GEOWRGeoWrite file
GEOCALGeoCalc file
HTMLHyperText Markup Language
IWAIBM Writing Assistant document
LEWPLeading Edge WP document
LMxLotus Manuscript document (version x = 1 or 2)
M11DMass-11 document
M11FMass-11 folder file
MSACMicrosoft Access data base
MSPPMicrosoft PowerPoint Presentation
MSPUBMicrosoft Publisher document
MSWDxyMS Word version x.y for Dos (x.y = 3.0, 4.0, 5.0, 5.5)
MSWKWxMicrosoft Works version x WP document
MSWKSxMicrosoft Works version x spreadsheet
MSWKDxMicrosoft Works version x data base
MSWRMicrosoft Write for Windows document
MSWWxMicrosoft Word for Windows x.0 document (x = 1, 2, 6, 7, 8)
MSWW2KMicrosoft Word 2000 or higher document
MSXLMicrosoft Excel Spreadsheet
MULxMultimate document (version x)
MULxFMultimate footnotes file (version x)
MYMManaging Your Money data file
OFCPWROfficePower/PC document
OFW4-OfficeWriter document (version 4 or earlier)
OFWxOfficeWriter document (version x = 5 or 6)
OLEMicrosoft Windows Compound (OLE) file
PFSFCpfs:First Choice document
PFSPWpfs:Professional Write document
PFSW1pfs:Write 1.x document
PFSW2pfs:Write 2.x (Spinnaker) document
PFSWWD1pfs:WindowWorks (Spinnaker) document
PFSWWD2pfs:WindowWorks (SoftKey) document
PFSWWS1pfs:WindowWorks (Spinnaker) spreadsheet
PFSWWS2pfs:WindowWorks (SoftKey) spreadsheet
RFTIBM DCA (RFT) file
RTFMicrosoft Rich Text Format
SAMNASamna Word/Plus document
SC4SuperCalc-4 spreadsheet
SPJSuperProject Plus data file
VENPUBVentura Publisher file
WANGWang-IWP document
WMCWordMarc Composer document
WPF4WordPerfect 4.1 or 4.2 document
WPFxyWordPerfect x.y document (Dos or Windows, x.y = 5.1, 5.2, 6.0, 6.1)
WPF7WordPerfect (Corel) version 7, 8, 9, 2000 or higher
WPROLotus WordPro
2WSWordStar-2000 document
WSxyWordStar document (version x.y = 5.0, 5.5, 6.0 or 7.0)

     Note that error conditions are denoted by an exclamation mark (!) in the first character of the returned lpszShortForm keyword.

WpConv.DLL

     This DLL converts a document file to a different file format. The C/C++ function prototype is:
extern "C" __declspec(dllimport) int __stdcall WpConv (
  const char FAR* lpszSourceFormat,
  const char FAR* lpszSourceFileName,
  const char FAR* lpszDestFormat,
  const char FAR* lpszDestFileName,
  const char FAR* lpszConfFileName,
  const char FAR* lpszScratchPath,
  const char FAR* lpszMeterName);
     The function arguments are:
     Correspondingly, the Visual Basic declaration for this function is:
Private Declare Function WpConv Lib "WpConv.dll" ( _
  ByVal SourceFormat As String, _
  ByVal SourceFileName As String, _
  ByVal DestFormat As String, _
  ByVal DestFileName As String, _
  ByVal ConfFileName As String, _
  ByVal ScratchPath As String, _
  ByVal MeterName As String) _
  As Integer
where the arguments correspond to the descriptions given above.

     The return value shows if the conversion was successful as follows:
 0: normal return
 1: unrecognized source format keyword
 2: unrecognized destination format keyword
 3: could not create or open CONV_LOG.TXT on scratch drive
 4: could not write to or close CONV_LOG.TXT on scratch drive
 5: could not open a system configuration file
 6: one or more error(s) in configuration file(s)
 7: could not open WX.DTA
 8: could not create scratch file(s) on scratch drive
 9: could not open scratch file(s) on scratch drive
10: could not write to or close scratch file(s)
11: could not open source document
12: source file is not in the specified format
13: some other source file discrepancy
14: could not create new destination file
15: error writing or closing destination file
16: some other destination file discrepancy
17: insufficient memory
18: a required DLL is missing
19: a required DLL is corrupted
20: unusual error, normally would never occur
21: license type error

GMETER.DLL

     This is a sample but useable "progress meter" that graphically displays the progress of a file conversion from 0% to 100%, as well as the source and destination file names and formats. Your host application does not directly call any function in this DLL. To use this DLL, simply make sure it resides in the directory where WpConv is installed, and pass "GMETER" as the lpszMeterName argument to WpConv. You do not have to do anything else.

Progress Meter Options

     When converting a large document file, it is reassuring for the end user to know that something is happening and that the computer hasn't just locked up. To this end, the conversion DLLs in this package support a progress meter which can display the progress of a file conversion from 0% to 100%. Recognizing that the progress meter interfaces visually with your end user, this package gives you a great deal of flexibility and freedom in the design of this progress meter so that it integrates seamlessly with your application. Depending on how much of the meter DLL you want to design yourself, there are three levels of approach:
     Please note that the extra processing associated with updating and displaying a progress meter slows down the conversion somewhat. This is specially so when converting a large number of very small files; its proportionate impact is insignificant when converting large files.

Installation Directory Considerations

     All the WordPort files required by your application should be installed in the same directory. This includes the DLL files and any other files in this package that your application requires. It is easiest to install them in the same directory as your host application. That way Windows knows where to look for them. If you install them in a different directory, you must ensure that Windows can find them.

     Further, you must make sure that none of the DLL files exist in any other directory in the Windows search path. This is to ensure that Windows loads the DLLs only from the directory you intend it to load from. Otherwise, Windows may look for the subsidiary DLLs and supporting files in the wrong place and not find them.

The Log file

     The conversion engine creates a log file in the scratch drive and directory. This is a standard ASCII text file. The conversion engine writes to it the date and time of conversion, the name and type of the source and destination files, and any discrepancies encountered during the conversion. For example, if some of the formatting features of the source file are not supported in the destination file format, this will be recorded in the log file. Typically, the host application may ignore and delete this log file, display it to the user after completing a conversion or let the user print it.

     The log file is normally called CONV_LOG.TXT, and is placed in the scratch drive and directory passed as the lpszScratchPath argument to WpConv. In the case of a multiply instantiating autoserve license, the log file is called Conversion Log n.txt, where n stands for the instantiation number. The log file is created in the append mode, so the log accumulates over successive calls to WpConv, as well as over successive host application sessions. To display only the log for a single session, your application must delete a previously existing log (if any).

Advanced Customization

     The conversion engine implemented in these DLLs is a very powerful and full-featured piece of software. It converts more accurately and completely than any alternative we know of. It has many elements that you may customize to exactly suit even very demanding applications. This is done via the system customization file WX.CF and/or an additional "user-specified" customization file specified by the lpszCustFileName parameter in the WpConv call. To take advantage of these features, please consult the Advanced Usage section of the WordPort user manual.

Format Keywords

     Format keywords are used to specify the source and destination file formats to the WpConv DLL. They are also used to support filetype-specific customization as described in the Advanced Usage section of the WordPort user manual.

Source Format Keywords

     As mentioned earlier, a format keyword returned by detfile may be passed directly to WpConv to specify a source file format if it is supported by the conversion package. However, not all file formats can be autorecognized, or you may have opted not to use autorecognition. In any case, following is a list of the source format keywords recognized by the conversion DLLs, and the subsidiary DLL required for each format.
=================================================================
KEYWORD   FILE FORMAT                             SUBSIDIARY DLL
-----------------------------------------------------------------
ASC-D     ASCII (Document-oriented)               iascd.dll
ASC-L     ASCII (Line-oriented)                   iascl.dll
AMI       Ami Pro                                 iami.dll
DSW*      DisplayWrite                            idsw.dll
DWA*      DisplayWrite Assistant                  ipts.dll
ENAB*     Enable WP                               ienab.dll
GEOWR     GeoWrite                                igeo.dll
INSCR     InterScript                             iinsc.dll
IWA       Writing Assistant                       ipfs.dll
LEWP      Leading Edge WP                         ilewp.dll
LM*       Lotus Manuscript                        ilm.dll
M11D      Mass-11                                 imass11.dll
MSWD*     MS Word for Dos                         imswd.dll
MSWKW*    MS Works (WP)                           imswk.dll
MSWM*     MS Word for Macintosh                   imswm.dll
MSWR      MS Write (Windows)                      imswd.dll
MSWW*     MS Word for Windows                     imsww.dll
MSWW8     MS Word 8 (Office 97)                   imsww8.dll
MSWW2K    MS Word 2000 (Office 2000)              imsww8.dll
MUL?D     Multimate                               imul.dll
NB*       Nota Bene                               ixy.dll
PCW       PC Write                                ipcw.dll
PFS*      pfs:First Choice/Write/ProWrite         ipfs.dll
PFSFC*    pfs:First Choice                        ipfs.dll
PFSPW*    pfs:Professional Write                  ipfs.dll
PFSW2     Spinnaker Write                         ipfs.dll
PTS       Personal Typing System                  ipts.dll
RFT       DCA/RFT (Revisable Form Text)           idsw.dll
RTF       Microsoft Rich Text Format              irtf.dll
SAMNA     Samna Word/Word Plus                    isamna.dll
SIGN      Signature                               ixy.dll
TW        Total Word                              itw.dll
WPF4*     WordPerfect 4.x                         iwpf4.dll
WPF5*     WordPerfect 5.x (Dos/Windows)           iwpf5.dll
WPF6*     WordPerfect 6.x (Dos/Windows)           iwpf6.dll
WPF7*     WordPerfect 7 (Corel)                   iwpf6.dll
WPF8*     WordPerfect 8 (Corel)                   iwpf6.dll
WS*       WordStar 3.x - 7.0                      iws.dll
2WS*      WordStar 2000                           iws2.dll
XY2       XyWrite-II                              ixy.dll
XY3       XyWrite-III                             ixy.dll
XY4       XyWrite-IV                              ixy.dll
=================================================================
     Wildcard characters "*" and "?" are permitted in source format keywords, and they carry the same significance as in Dos file names. Specifically, "*" may be used as the last character of a source format keyword to match revision or sub-revision numbers as long as all the matching revision levels are handled by the same subsidiary DLL. So, for example, either WPF51 or WPF5* may be used to read a WordPerfect 5.1 file, and the keyword WPF5* may be used to read WordPerfect 5.0, 5.1 and 5.2 files since they involve the same subsidiary DLL. However, the keyword WPF* cannot be used to match all WordPerfect revisions from 4.x through 6.x, since the different major revision levels are handled by different subsidiary DLLs.

Destination Format Keywords

     Following is a list of the destination format keywords recognized by the conversion DLLs, and the subsidiary DLL required for each format.
=================================================================
KEYWORD   FILE FORMAT                             SUBSIDIARY DLL
-----------------------------------------------------------------
AMI       Ami Pro                                 oami.DLL
ANSI-D    ANSI (document-oriented)                oascd.DLL
ANSI-L    ANSI (line-oriented)                    oascl.DLL
ANSI-P    ANSI (printer-oriented)                 oascd.DLL
ASC-D     ASCII (document-oriented)               oascd.DLL
ASC-L     ASCII (line-oriented)                   oascl.DLL
ASC-P     ASCII (printer-oriented)                oascd.DLL
DSW~      DisplayWrite (~=2,3,4,42,5)             odsw.dll
ENAB~     Enable WP (~=1,2,3,4)                   oenab.dll
HTML      HyperText Markup Language               ohtml.dll
INSCR     InterScript                             oinsc.DLL
LM2       Lotus Manuscript 2.0/2.1                olm.DLL
M11D      Mass-11 (native)                        omass11.dll
M11E      Mass-11 (export)                        omass11.dll
MSWD~     MS Word/Dos (~=3,4,50,55)               omswd.dll
MSWKW~    MS Works WP document (~=1,2,3,4)        omswk.dll
MSWR      MS Write (Windows)                      omswd.dll
MSWW2     MS Word for Windows 2.0                 omsww2.DLL
MSWW6     MS Word for Windows 6.0                 omsww6.DLL
MSWW7     MS Word for Windows 7.0                 omsww6.DLL
MSWW8     MS Word 8 (Office 97)                   omsww6.DLL
MSWW2K    MS Word 2000 (Office 2000)              omsww6.DLL
NB~       Nota Bene (~=2,3,4)                     oxy.dll
RFT       DCA/RFT (Revisable Form Text)           odsw.dll
SIGN      Signature                               oxy.dll
WPF5~     WordPerfect 5.x (~=0,1,2)               owpf5.DLL
WPF6~     WordPerfect 6.x (~=0,1)                 owpf6.DLL
WPF7      WordPerfect 7 (Corel)                   owpf6.DLL
WPF8      WordPerfect 8 (Corel)                   owpf6.DLL
WS~       WordStar (~=3,4,50,55,6,7)              ows.DLL
2WS~      WordStar 2000 (~=1,2,3)                 ows2.dll
XY~       XyWrite (~=2,3,4)                       oxy.dll
=================================================================
     Note that wild card characters "*" and "?" are not allowed in destination format keywords. Specifically, this means that you must exactly the version of the destination word processor you wish to convert to.

Test Programs

     This package includes a very simple and self-explanatory test program, DllTest.EXE, which lets you easily issue calls to the DLLs in this package. It lets you manually enter arguments for the detfile and WpConv functions, and call these functions by clicking a button. It then displays the returned results and codes. It does not perform any error-checking on its own, so it reflects exactly the performance of these DLLs in your particular environment.

     The package also includes a simple but fully functional application written in Visual Basic that demonstrates calls to library. The relevant files are TEST.VBP and TEST.FRM.

WordPort Retail Product WPT.EXE

     This package also includes a copy of the WordPort retail product implemented in the file WPT.EXE. This product basically uses the same conversion library, and provides a handy means for checking out the capabilities of the conversion library DLLs. The file WPT.EXE may not be distributed with your product.

Files included in this package

     The files included in this package are listed below, along with their purpose. You need install only the ones you need.

Footnotes

[1]: InterScript™ is an ASCII-based file format in which control and formatting functions are represented by customizable mnemonics. In this respect, it is like mark-up languages such as SGML or HTML. However, unlike these languages, InterScript™ is customizable, and is also much more flexible and powerful. In other words, it is sufficiently simple and flexible that your software can read or write it with minimum overhead and development effort, yet it is powerful enough to encode even complex formatting functions such as fonts, footnotes/endnotes, automatic paragraph numbering, tables, etc. By writing to InterScript™, your application can generate very complex and highly formatted documents with minimum overhead and development effort. Similarly, if your software needs to read word processing files, it can obtain the text and formatting information more efficiently and with less overhead by first converting the document to an InterScript™ file.

[2]: The DetFile DLL determines the format of an unknown file by examining its contents rather than by simply looking at its filename extension. Therefore, it can recognize file types that do not use a unique extension.