type
_HTMLReport = record
strURI String ; URI (or output file name)
strTitle String ; Document title
iBGColor LongInt ; Background color
iTextColor LongInt ; Text color
mHeader Memo ; (filled) Header template
mTemplate Memo ; (filled) Main template
lStatic Logical ; Static output? (FALSE = Dynamic)
lMsg Logical ; Show status line messages?
; Add these if you're using Paradox 10
lServlet Logical ; Unknown (Undocumented)
lDocHyperlink Logical ; Unknown (Undocumented)
strPublishAs String ; Unknown (Undocumented)
endRecord
endType
uses ObjectPAL
HTMLPublish_Report( var rSource Report,
var HTMLReport _HTMLReport ) Logical
_LaunchBrowser( strFileName String, lWait Logical ) Logical
endUses
method reportPublish( strRptName String, strSaveAs String ) Logical
var
rptWebPub Report ; The report being published.
_hrWebPub _htmlReport ; Details for the library routine.
libWebPub Library ; Pointer to the publishing library.
fbiSaveAs fileBrowserInfo ; Information for Save As dialog.
loRetval Logical ; Value returned to calling proc.
endVar
const
ERRTITLE = "HTML Publishing Error" ; title for error dialogs.
endConst
; Next, we have to open the HTMLIB01.LDL library. If that
; fails, we cannot continue.
loRetval = libWebPub.open( expertsDir() + "\\HTMLIB01" )
If not loRetval then
errorShow( ERRTITLE, "Reason: Unable to load publishing " +
"library; see details..." )
return loRetval
endIf
; Open the report.
loRetval = rptWebPub.open( strRptName )
If not loRetval then
errorShow( ERRTITLE, "Reason: The report failed to " +
"open; see details..." )
return loRetval
endIf
rptWebPub.DesignModified = FALSE
; Now, we need to initialize the fields of the publishing
; information record.
_hrWebPub.strURI = strSaveAs
_hrWebPub.strTitle = rptWebPub.getTitle()
_hrWebPub.iBGColor = Black
_hrWebPub.iTextColor = White
_hrWebPub.lStatic = TRUE
_hrWebPub.lMsg = TRUE
; Try to publish the report.
loRetval = libWebPub.htmlPublish_Report( rptWebPub, _hrWebPub )
If not loRetval then
errorShow( ERRTITLE, "Reason: The publishing routine failed; " +
"see details." )
else
If msgQuestion( "Report Sucessfully Published",
"Your report has been published. Would " +
"you like to view the final file in " +
"your Internet browser?" ) = "Yes" then
If not libWebPub._launchBrowser( _hrWebPub.strURI,
Yes ) then
errorShow( "Can't Preview HTML", "Reason: The " +
"browser failed to launch; see " +
"details..." );
endIf
endIf
endIf
; Make sure the report gets closed.
try
rptWebPub.close()
onFail
; do nothing as the report is already closed.
endtry
; Make sure the library gets closed and its memory gets
; released.
If libWebPub.isAssigned() then
libWebPub.close()
endIf
endMethod