Hello All,

First of sorry for the post, but I'm moving to Harbour, I'm full of
questions to resolve.
Below is another example that compiling and running without problems in
xHarbour, but when you try to run with harbor it generates an error on the
line 'if asc (cCaractere) == chr (13)'

*************
Function MAIN
*************
set print to "c:\my_file.txt"
SET DEVICE TO PRINT

@ PROW()+1,00  say CHR(15)

@ PROW()+1,01     say "TESTE DE IMPRESSAO LINHA 01"
@ prow(),pcol()+2 say "AINDA NA MESMA LINHA TESTE DE IMPRESSAO LINHA 01"
@ prow()+3,02     say " ______________________________"
@ prow()+1,02     say " Gerente de Compra.:"

SET PRINTER TO
set device to screen

Open_word( "c:\my_file.txt" )

RETURN

*****************************
Function Open_word( cArquivo)
*****************************
local cArqRtf, arq, arq_txt, cHandle
local cCaractere  := space( 01 )
local cLinha      := space( 01 )
local lf          := chr( 13 ) + chr( 10 )

cArqRtf  := lower( left( cArquivo, len( cArquivo ) - 4 ) + ".doc" )
arq      := fcreate( cArqRtf, 1 )

cHandle  :=
"{\rtf1\ansi\ansicpg1252\deff0\deflang1046{\fonttbl{\f0\fmodern\fprq1\fcharset0
Courier New;}{\f1\fswiss\fcharset0 Arial;}}" + lf
cHandle  += "\margl284\margr505\margt505\margb505" + lf
cHandle  += "{\*\generator Msftedit
5.41.15.1503;}\viewkind4\uc1\pard\f0\fs14 "
fwrite( arq, cHandle )

arq_txt  := fopen( cArquivo, 0 )

while .t.
   cCaractere  := space( 01 )

   if fread( arq_txt, @cCaractere, 1 ) <> 1
      exit
   endif

   if asc( cCaractere ) == chr( 13 )
      cLinha   += "\par" + lf

      fwrite( arq, cLinha )
      cLinha   := space( 01 )

      fseek( arq_txt, 1, 1 )
      loop
   endif

   if cLinha == space( 01 )
      cLinha := cCaractere
   else
      cLinha += cCaractere
   endif
enddo
cHandle  := "}"

fwrite( arq, cHandle )
fclose( arq          )
fclose( arq_txt      )

*open_file( cArqRtf )
Return( .T. )
****************

The error that is giving the error below:
Error BASE/1070  Erro nos parƒmetros: ==
Called from ABRE_WORD(46)

Leonardo Machado

-- 
View this message in context: 
http://www.nabble.com/Error-in-function-to-create-the-Word-file-tp23046678p23046678.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to