Re: print with word97 by sherry
sherry
Tue Aug 15 13:07:01 CDT 2006
Hi
Here is some code I don't know if it is all you might need.
This section of code creates the variable---
DO CASE
CASE laChangeSchedule[lnI,2] = 0
This.outValue = This.outValue + 'None Thereafter' +CHR(13)+ CHR(10)
OTHERWISE
IF lcPBFCode = 'LIF'
laChangeSchedule[lnI,2] = ROUND(laChangeSchedule[lnI,2], 0)
ELSE
laChangeSchedule[lnI,2] = INT(laChangeSchedule[lnI,2])
ENDIF
This.outValue = This.outValue + ALLTRIM(TRANSFORM(laChangeSchedule[lnI,2],
'$,$$$,$$9.99')) + ', ' + lcYear +CHR(13)+ CHR(10)
ENDCASE
THIS SECTION GETS SAVED OBJECT FROM MEMO FIELD
COPY MEMO publhpdc.pdcfile TO (lcFileName)
loDocument = GETOBJECT(lcFileName)
loDocument.Activate
THIS SECTION DEFINES OLE PRINT IMAGE
LOCAL lcRegistryName, lnRegistryKey, lcRegistryLookupValue, lnSubKey,
lnRtnValue, lcKeyValueName, llError
#DEFINE HKEY_CLASSES_ROOT -2147483648 && BITSET(0,31)
LOCAL nHKey, cSubKey, nResult, lpszValueName, dwReserved, lpdwType,
lpbData, lpcbData
DECLARE Integer RegOpenKey IN Win32API Integer nHKey, String @cSubKey,
Integer @nResult
DECLARE Integer RegCloseKey IN Win32API Integer nHKey
DECLARE Integer RegQueryValueEx IN Win32API Integer nHKey, String
lpszValueName, Integer dwReserved, Integer @lpdwType, String @lpbData,
Integer @lpcbData
llError = .F.
lnRegistryKey = HKEY_CLASSES_ROOT
lcRegistryLookupValue = 'CLSID\{6D940280-9F11-11CE-83FD-02608C3EC08A}\ProgID'
lnSubKey = 0
lnRtnValue = RegOpenKey(lnRegistryKey, lcRegistryLookupValue, @lnSubKey)
IF lnRtnValue != 0 && An Error Occurred Trying to Find the Key
llError = .T.
ELSE
lcKeyValueName = ''
lpbData = SPACE(256)
lpcbData = LEN(lpbData)
STORE 0 TO lpdwReserved, lpdwType
lnRtnValue = RegQueryValueEx(lnSubKey, lcKeyValueName, lpdwReserved,
@lpdwType, @lpbData, @lpcbData)
=RegCloseKey(lnSubKey)
IF lnRtnValue != 0
llError = .T.
ENDIF
ENDIF
CLEAR DLLS
IF llError = .F.
This.intImageObjRegistered = .T.
lcRegistryName = LEFT(lpbData, lpcbData)
This.AddObject('olePrintImage', 'oleControl', lcRegistryName)
This.olePrintImage.Left = -20
ELSE
WAIT 'Image Printing Control Not Available' WINDOW
ENDIF
"Bernhard Sander" wrote:
> Hi sherry,
>
> > I have an exe I think was originally created in vfp 5 , has been upgraded to
> > 8 and then to 9. It creates a word document and populates it with variables
> > created in same exe. The problem is it will only print correctly if word 97
> > is the only version of word on the computer running it. The part that
> > doesn't print properly is a variable that uses chr(13)+chr(10). The newer
> > versions of word do not have the carriage return . Only a space.
> Maybe you give us some lines of code around your problem and some more info of
> what should happen in word.
> Word in all versions does know about carriage return and line feed. And I don't
> know of any version of word, where carriage return is replaced by space.
>
> Regards
> Bernhard Sander
>