CacheContent

Adds an item to the WebCache collection.

Note: CacheContent is the most commonly used method to add items to the WebCache collection. The CacheItem Method should only be used when additional header information other than content type needs to be written into the header of the cached item.

Syntax

object.CacheContent(ContentType As String, Data As Variant)

The CacheContent method syntax has the following parts:

Part Description
object An expression evaluating to an object of type WebCache.
ContentType String
Data Variant

Example

'The following example performs the following
'1)Loads an ActiveReport from a presaved XML file
'2)Runs the report
'3)Exports the report to a byte array in PDF format
'4)Adds the byte array to ActiveReports WebCache so
'that it may be streamed directly to the browser
'The example code is placed in a user-defined function.
'A typical scenario would be for this function to be placed
'in a COM object and called from an ASP page.
'You could then do an ASP response.redirect to the
'url where the pdf export was cached.
Public Function ExportReport() as long
 
Dim rpt As ActiveReport
Dim aWebCache As WebCache
Dim pdfExpt As ActiveReportsPDFExport.ARExportPDF
Dim PDFByteArray As Variant
 
Set rpt = New ActiveReport
Set aWebCache = New WebCache
Set pdfExpt = New ActiveReportsPDFExport.ARExportPDF
 
rpt.Load "c:\testing.rpx"
 
rpt.run
 
Call pdfExpt.ExportStream(rpt.Pages, PDFByteArray)
 
lWebCacheID = aWebCache.CacheContent("Application/PDF", PDFByteArray)
 
ExportReport = lWebCacheID 'lWebCacheID can now be used to access the cached pdf file
'ASP Code calling the above function
Dim vWebCacheID
'vWebCacheID = arptserver.ExportReport()
'Response.Redirect "mywebsite/webcache.dll?" & vWebCacheID & "?"
End Function