代码:
<object id="arv" codebase="arview2.cab#version=2.4.1.1283" height="70%" width="100%" classid="clsid:8569D715-FF88-44BA-8D1D-AD3E59543DDE" viewastext>
<param name="_ExtentX" value="26141">
<param name="_ExtentY" value="11959">
</object>
<script language="vbscript">
<!--
sub arv_ControlLoaded()
arv.DataPath = "ActiveXViewer.aspx?ReturnReport=1"
end sub
-->
</script>
</div>
----------------------
this.Page.Response.Buffer = true;
ActiveReport3 rpt = null;
try
{
//rpt.DataSource = new DataSet();
//rpt.
rpt = new ActiveReport3(); //new DataDynamics.ActiveReports.Samples.WebReports.NwindLabels();
if (dtAR_TEMPLATE_LIS != null)
{
if (dtAR_TEMPLATE_LIS.Rows.Count > 0)
{
byte[] bFile = dtAR_TEMPLATE_LIS.Rows[0]["ARS_Content"] as byte[];
Stream stream = new MemoryStream(bFile);
rpt.SetLicense("wmy,vlp,888888,8O4S--K4EM8--F77VF--");
rpt.LoadLayout(stream);
rpt.DataSource = DataAccess.GetTable(busiSql);
}
}
rpt.Run(false);
}
catch (DataDynamics.ActiveReports.ReportException eRunReport)
{
this.Trace.Warn("Report failed to run:\n" + eRunReport.ToString());
}
// Create a memory stream to put the report document RDF in
MemoryStream outStream = new MemoryStream();
// Save the report document into the memory stream
rpt.Document.Save(outStream, DataDynamics.ActiveReports.Document.RdfFormat.AR20);
// Move the postion back to the beginning of the stream
outStream.Seek(0, SeekOrigin.Begin);
// Create a byte array buffer to read the memory stream into
byte[] bytes = new byte[outStream.Length];
// Fill the byte array buffer with the bytes from the memory stream
outStream.Read(bytes, 0, (int)outStream.Length);
// Clear anything that might have been written by the aspx page
this.Page.Response.ClearContent();
this.Page.Response.ClearHeaders();
// Write the report document byte array to the requestor:
this.Page.Response.BinaryWrite(bytes);
// end this request/response
this.Page.Response.End(); |