web下水晶報表的使用!
來源:互聯網
上載者:User
web|水晶報表 在web水晶報表的使用。
首先
需要在.aspx.cs檔案中引入:using CrystalDecisions.CrystalReports.Engine;
建立.xsd檔案和.rpt檔案,.xsd檔案其實是在.aspx.cs中建立的DataSet中的欄位的映射。(可以添加,修改)。
然後
在.aspx.cs檔案中操作,
ReportDocument oCR =null;
DataSet ds = data.GetDataSet();
oCR = new R_StandardAuditPrint();
oCR.SetDataSource(ds);
crvMainView.ReportSource=oCR; //CrystalDecisions.Web.CrystalReportViewer crvMainView 報表瀏覽器
其次
需要注意是,在 .aspx文將中,設定CRYSTALREPORTVIEWER的一些屬性,
<TABLE id="Tab4le1" height="100%" cellSpacing="2" cellPadding="2" width="100%">
<tr>
<td vAlign="top" id="m_printpage"><FONT face="宋體"><CR:CRYSTALREPORTVIEWER id="crvMainView" runat="server" Width="350px" EnableDrillDown="False" DisplayToolbar="False" DisplayGroupTree="False" Height="50px"></CR:CRYSTALREPORTVIEWER></FONT>
</td>
</tr>
</TABLE>
最後
在.aspx的btnprint.onclick事件中調用(javascript)
function printpage(m_printpage)
{
var newstr = document.all.item(m_printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = newstr; window.print();
document.body.innerHTML = oldstr;
return true;
}
完成列印!