【下载Stimulsoft Reports.Net最新版本】
此示例项目演示了如何使用组件属性自定义Flash查看器。您可以更改查看器元素的颜色,隐藏隐藏不必要的按钮或菜单项,设置控件的默认状态,更改Flash查看器的某些行为。 例如,设置flash查看器控件的默认宽度和heihgt,显示和隐藏工具栏上的一些按钮,设置单击“退出”按钮时将使用的URL地址,隐藏一些报表导出,设置其他文本。关于对话框:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Customize_the_ViewerFx.Default" %>
<%@ Register assembly="Stimulsoft.Report.Web" namespace="Stimulsoft.Report.Web" tagprefix="cc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Customize the ViewerFx</title>
</head>
<body>
<form id="form1" runat="server">
<cc1:StiWebViewerFx ID="StiWebViewerFx1" runat="server"
Width="1000px" Height="700px"
ShowOpenButton="false" ShowDesignButton="false" ShowExitButton="true"
ExitUrl="http://www.stimulsoft.com"
ShowExportToBmp="false" ShowExportToPcx="false" ShowExportToSvg="false" ShowExportToSvgz="false"
ShowExportToPng="false" ShowExportToGif="false" ShowExportToSylk="false" ShowExportToMetafile="false"
ShowExportToJpeg="false" ShowExportToTiff="false" ShowExportToDif="false" ShowExportToDbf="false"
ShowExportToCsv="false" ShowExportToXml="false"
AboutDialogTextLine1="My Company Name"
AboutDialogTextLine2="Information about My Company"
OnGetReport="StiWebViewerFx1_GetReport" />
</form>
</body>
</html>
要显示报表,您应添加OnGetReport事件,您需要在该事件中加载报表模板文件,并在需要时注册数据。
protected void Page_Load(object sender, EventArgs e)
{
}
protected void StiWebViewerFx1_GetReport(object sender, Stimulsoft.Report.Web.StiReportDataEventArgs e)
{
string reportPath = Server.MapPath("Reports/SimpleList.mrt");
StiReport report = new StiReport();
report.Load(reportPath);
string dataPath = Server.MapPath("Data/Demo.xml");
DataSet data = new DataSet();
data.ReadXml(dataPath);
report.RegData(data);
e.Report = report;
}
示例代码的结果如下图所示: