ActiveReports.HtmlExport Request technical support
Export(Document,IOutputHtml,String) Method
See Also  Example


document
The ActiveReports document to be exported to HTML.
outputHandler
An implementation of IOutputHandler that will receive the HTML output.
pageRange
A range of page numbers. Ranges are indicated by the use of a hyphen between the starting and ending page numbers in the range. Single pages may also be included. Each range or single page is separated by a comma.
Exports the specified range of pages of the document to the chosen outputHandler.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Export( _
   ByVal document As Document, _
   ByVal outputHandler As IOutputHtml, _
   ByVal pageRange As String _
) 
Visual Basic (Usage)Copy Code
Dim instance As HtmlExport
Dim document As Document
Dim outputHandler As IOutputHtml
Dim pageRange As String
 
instance.Export(document, outputHandler, pageRange)
C# 
public void Export( 
   Document document,
   IOutputHtml outputHandler,
   string pageRange
)

Parameters

document
The ActiveReports document to be exported to HTML.
outputHandler
An implementation of IOutputHandler that will receive the HTML output.
pageRange
A range of page numbers. Ranges are indicated by the use of a hyphen between the starting and ending page numbers in the range. Single pages may also be included. Each range or single page is separated by a comma.

Example

C#Copy Code
private void Page_Load(object sender, System.EventArgs e)
{
   rptCustExHTML rpt =
new rptCustExHTML();
   
try
   {
       
rpt.Run(false);
   }
   
catch (Exception eRunReport)
   {
       
// Failure running report, just report the error to the user:
       
Response.Clear();
       Response.Write(
"<h1>Error running report:</h1>");
       Response.Write(eRunReport.ToString());
       
return;
   }
   
// Buffer this page's output until the report output is ready.
   
Response.Buffer = true;
   
// Clear any part of this page that might have already been buffered for output.
   
Response.ClearContent();
   
// Clear any headers that might have already been buffered (such as the content type for an HTML page)
   
Response.ClearHeaders();
   
// Tell the browser and the "network" that this resulting data of this page should be be cached since this
    
// could be a dynamic report that changes upon each request.
   
Response.Cache.SetCacheability(HttpCacheability.NoCache);
   
// Tell the browser this is an Html document so it will use an appropriate viewer.
   
Response.ContentType = "text/html";
   
// Create the HTML export object
   
DataDynamics.ActiveReports.Export.Html.HtmlExport html = new DataDynamics.ActiveReports.Export.Html.HtmlExport();
   
// Export the report to HTML in this session's webcache:
   
//this.htmlExport1.Export(rpt.Document, DataDynamics.ActiveReports.Web
   
MyCustomHtmlOutputter outputter = new MyCustomHtmlOutputter(this.Context);
   
this.htmlExport1.Export(rpt.Document, outputter, "");
   Response.Redirect(
"ReportOutput" + "/" + System.IO.Path.GetFileName(outputter.mainPage));
}
Visual BasicCopy Code
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim rpt As New ActiveReport1()
        Try
            rpt.Run(False)
        Catch eRunReport As Exception
            ' Failure running report, just report the error to the user:
            Response.Clear()
            Response.Write("<h1>Error running report:</h1>")
            Response.Write(eRunReport.ToString())
            Return
        End Try
        ' Buffer this page's output until the report output is ready.
        Response.Buffer = True
        ' Clear any part of this page that might have already been buffered for output.
        Response.ClearContent()
        ' Clear any headers that might have already been buffered (such as the content type for an HTML page)
        Response.ClearHeaders()
        ' Tell the browser and the "network" that this resulting data of this page should be be cached since
        ' this could be a dynamic report that changes upon each request.
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        ' Tell the browser this is an Html document so it will use an appropriate viewer.
        Response.ContentType = "text/HTML"
        ' Create the Html export object
        Dim HtmlExport1 As New HtmlExport()
        Dim outputter As New MyCustomHtmlOutputter(Me.Context)
        Me.HtmlExport1.Export(rpt.Document, outputter, "")
        Response.Redirect("ReportOutput" + "/" + System.IO.Path.GetFileName(outputter.mainPage))
End Sub

Remarks

Provides advanced control over how the HtmlExport stores all output, including html pages, images, bookmark pages, etc.

See Also