#2
sych2024-06-14 15:04
|
*--设置默认路径
Local lcPath
m.lcPath = Justpath( sys(16,0) )
m.lcPath = Alltrim( Substr( m.lcPath , At( ":" , m.lcPath) -1 ) )
Set Default To ( m.lcPath )
Set Reportbehavior 90
Set Procedure To netsuite.reg.prg Additive
LOCAL lcReport ;
, loReportListener
m.lcReport = Getfile("FRX|LBX")
If Empty( m.lcReport ) Then
Return
Endif
?'正在转换FRX2PDF,请稍候...'
loReportListener = .NULL.
Local loErr
*5——HTML输出
Try
DO (_reportoutput) WITH 5, m.loReportListener
With m.loReportListener
.TargetFileName = Forcepath( Juststem( m.lcReport ) + '.html', Addbs( m.lcPath ) + [\testdata\ConvertPDF] )
.QuietMode = .T.
Endwith
Report Form ( m.lcReport ) Object m.loReportListener
Catch To m.loErr
Endtry
If Type( "loErr.Message" ) == 'C' Then
Messagebox( [FRX输出HTML出错(] + loErr.Message + [)] , 16 , '过程:' + Program() )
Return .F.
Endif
*--HTML2PDF
Local lcGenlFile ;
, lcHtmlFile ;
, lcToPdfFile;
, lcErrmsg ;
, loHtml2Pdf
m.lcErrmsg = ""
m.lcHtmlFile = m.loReportListener.TargetFileName
*m.lcHtmlFile = [file:///] + m.lcHtmlFile
*!* m.lcHtmlFile = Getfile( "HTML" )
*!* m.lcHtmlFile = strtran( m.lcHtmlFile , "\" , "/" )
m.lcToPdfFile = Addbs( m.lcPath ) + [\testdata\ConvertPDF] + Sys(2015) + [.PDF]
m.loHtml2Pdf = Createobjects( "NetHtml2Pdf.Html2Pdf" , "NetHtml2Pdf.dll")
If !Vartype( m.loHtml2Pdf ) == "O" Then
Return .F.
Endif
If !m.loHtml2Pdf.HtmlToPdf( m.lcHtmlFile , m.lcToPdfFile , @lcErrmsg ) Then
Messagebox( m.lcErrmsg , 16 )
Return .F.
Else
Erase ( m.lcHtmlFile )
Endif
[此贴子已经被作者于2024-6-14 16:01编辑过]