Hi all,
Im trying to generate some reports with FoxyPreviewer v299z30 with no preview so the user can choose previosly the output format or send it directly to the default printer.
This code run perfect when selecting pdf, html (it creates 3 files with 3 differents names each with its extensions) or printer but in case of word or excel it do strange things.
This is the code:
I've got foxypreview initialice on the main prg of my app this way:
Explain each case in detail, suppose i want to print 3 reports:
Normal output should be (i.e, for word): 001-1.rtf 001-2.rtf 001-3.rtf
- If i check "Word" it creates the 1.st file with its right filename, then it doesn't generates any more files. If i exit and entry again into the form it doesn't creates any. Only if i exit the app it generates again only the 1.st file.
- In case of "Excel" it creates the 1.st file but when creates the 2.nd first it delete the 1.st one, when creates ther 3.erd the 2.nd is deleted.At end only the 3.rnd file remains.
In all cases the foxy progress bar show normally and no errors it's shown.
In its normal use it works perfect in all the app. You can save any report to any format previewing it first and choosing the "save as" format. This is the first time i try to save it directly with no preview.
Any idea is welcome.
Thanks very much.
Im trying to generate some reports with FoxyPreviewer v299z30 with no preview so the user can choose previosly the output format or send it directly to the default printer.
This code run perfect when selecting pdf, html (it creates 3 files with 3 differents names each with its extensions) or printer but in case of word or excel it do strange things.
This is the code:
Code:
PRIVATE cCodi_emp, cCodi_tia,cCodi_vhi, cMatricula, cMarcaMod, cCodi_tvh, cCodi_trb, cCodi_trb_sup, cNombre_trb, cNombre_trb_sup
PRIVATE dFecha, dFecha_sup, dFecha_rev, cObs_vhi, cObs_trb, cObs_taller, ccodi_lch, cpregunta
LOCAL ccadena , cdestino, cext
IF RECCOUNT('m_lch') > 0
IF pregunta('¿Quieres imprimir los check list?') == 1
DO CASE
&&' OBJTYPE 10 = PDF , 11 = PDF AS IMAGE , 12 = RTF , 13 = XLS , 14 = HTML
CASE ThisForm.optbase1.value = 1
cdestino = '10'
cext= '.pdf'
CASE ThisForm.optbase1.value = 2
cdestino = '12'
cext= '.rtf'
CASE ThisForm.optbase1.value = 3
cdestino = '13'
cext= '.xls'
CASE ThisForm.optbase1.value = 4
cdestino = '14'
cext= '.html'
OTHERWISE
cdestino = '10'
cext= '.pdf'
ENDCASE
SELECT m_lch
SCAN ALL
Thisform.get_preguntas && This get the detail of the report
STORE '' TO m.cCodi_emp,m.cCodi_tia, m.cCodi_vhi,m.cMatricula, m.cMarcaMod,m.cCodi_tvh, m.cCodi_trb, m.cCodi_trb_sup, m.cNombre_trb, m.cNombre_trb_sup, m.cObs_vhi, m.cObs_trb, m.cObs_taller
STORE {//::} TO m.dFecha, m.dFecha_sup, m.dFecha_rev, cpregunta
SELECT m_lch
*Para todos los checklist de ese vhi
*ThisFill The header and footer of the report
ThisForm.rellena_encabeza_y_pie(@m.cCodi_emp,@m.cCodi_tia, @m.cCodi_vhi, @m.cMatricula,@cMarcaMod,@m.ccodi_tvh, @m.ccodi_trb, @m.ccodi_trb_sup, @m.cNombre_trb, ;
@m.cNombre_trb_sup, @m.dfecha, @m.dfecha_sup,@m.dfecha_rev, @m.cobs_vhi, @m.cobs_trb,@m.cobs_taller, @m.cpregunta)
*Para cada contenido check list
*This fill the detail of the report
ThisForm.rellena_cursor (m_lch.codi_lch)
SELECT ccursor
IF ThisForm.optbase1.Value = 5
m.ccadena = 'REPORT FORM lli_chk TO PRINTER NOCONSOLE NOWAIT'
ELSE
m.ccadena = "REPORT FORM lli_chk OBJECT TYPE " + cdestino + " TO FILE 'c:\gam\" + m_lch.codi_vhi + '-' + LTRIM(STR(RECNO('m_lch'))) + cext + "'"
ENDIF
&cCadena
ENDSCAN
IF ThisForm.optbase1.Value = 5
avis_literal('Check-List impresos')
ELSE
avis_literal('Check-List generados en c:\gam')
ENDIF
ENDIF
ENDIF
I've got foxypreview initialice on the main prg of my app this way:
Code:
SET REPORTBEHAVIOR 90
*Foxy Preview, instanciación y configuración
DO FOXYPREVIEWER.APP
_Screen.oFoxyPreviewer. nDockType = 0
_Screen.oFoxyPreviewer.nThermType = 2
_Screen.oFoxyPreviewer.cLanguage = "SPANISH"
_Screen.oFoxyPreviewer.lExpandFields = .T.
_Screen.oFoxyPreviewer.cOutputPath = 'c:\gam\'
_Screen.oFoxyPreviewer.lSendToEmail = .F.
_Screen.oFoxyPreviewer.lShowSetup = .F.
_Screen.oFoxyPreviewer.lShowMiniatures = .F.
_Screen.oFoxyPreviewer.nWindowState = 2
*Fin Foxy
Explain each case in detail, suppose i want to print 3 reports:
Normal output should be (i.e, for word): 001-1.rtf 001-2.rtf 001-3.rtf
- If i check "Word" it creates the 1.st file with its right filename, then it doesn't generates any more files. If i exit and entry again into the form it doesn't creates any. Only if i exit the app it generates again only the 1.st file.
- In case of "Excel" it creates the 1.st file but when creates the 2.nd first it delete the 1.st one, when creates ther 3.erd the 2.nd is deleted.At end only the 3.rnd file remains.
In all cases the foxy progress bar show normally and no errors it's shown.
In its normal use it works perfect in all the app. You can save any report to any format previewing it first and choosing the "save as" format. This is the first time i try to save it directly with no preview.
Any idea is welcome.
Thanks very much.