Segue um exemplo para salvar html via job.
//-- SALVAR EM DISCO (HTML)
oReport:nRemoteType := NO_REMOTE
oReport:nDevice := 5 //-- Gera arquivo HTML
oReport:cFile := "\teste\relatorio2.htm" //-- Nome do arquivo na pasta system
oReport:Print()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "protheus.ch"
#include "report.ch"
#include "tbiconn.ch"
User Function tstReport()
Local oReport
Local oSA1
Local oBreak
PREPARE ENVIRONMENT EMPRESA "99" FILIAL "01"
DEFINE REPORT oReport NAME "REPORT1" TITLE "Relatorio de Clientes" PARAMETER "REPORT" ACTION {|oReport| PrintReport(oReport)}
DEFINE SECTION oSA1 OF oReport TITLE "Cliente" TABLES "SA1"
DEFINE CELL NAME "A1_COD" OF oSA1 ALIAS "SA1"
DEFINE CELL NAME "A1_NOME" OF oSA1 ALIAS "SA1"
DEFINE CELL NAME "A1_VEND" OF oSA1 ALIAS "SA1"
//DEFINE CELL NAME "A1_MCOMPRA" OF oSA1 ALIAS "SA1"
DEFINE BREAK oBreak OF oSA1 WHEN oSA1:Cell("A1_VEND")
DEFINE FUNCTION FROM oSA1:Cell("A1_COD") FUNCTION COUNT BREAK oBreak
//DEFINE FUNCTION FROM oSA1:Cell("A1_MCOMPRA") FUNCTION SUM BREAK oBreak
//-- SALVAR EM DISCO (HTML)
oReport:nRemoteType := NO_REMOTE
oReport:nDevice := 5 //-- Gera arquivo HTML
oReport:cFile := "\teste\relatorio2.htm" //-- Nome do arquivo na pasta system
oReport:Print()
RESET ENVIRONMENT
Conout("FIM")
Return
Static Function PrintReport(oReport)
#IFDEF TOP
cAlias := GetNextAlias()
MakeSqlExp("REPORT")
BEGIN REPORT QUERY oReport:Section(1)
BeginSql alias cAlias
SELECT A1_COD,A1_NOME,A1_VEND//,A1_MCOMPRA
FROM %table:SA1% SA1
WHERE A1_FILIAL = %xfilial:SA1% AND SA1.%notDel%
ORDER BY A1_FILIAL,A1_VEND
EndSql
END REPORT QUERY oReport:Section(1) PARAM mv_par01
oReport:Section(1):Print(.F.)
#ENDIF
Return