Use of web Crystal Reports.
First
You need to introduce using CrystalDecisions. CrystalReports. Engine in the. aspx. cs file;
Create a. xsd file and A. rpt file. The. xsd file is actually a ing of fields in the DataSet created in. aspx. cs. (Can be added or modified ).
Then
In the. aspx. cs file,
ReportDocument oCR = null;
DataSet ds = data. GetDataSet ();
OCR = new R_StandardAuditPrint ();
OCR. SetDataSource (ds );
CrvMainView. ReportSource = oCR; // CrystalDecisions. Web. CrystalReportViewer crvMainView report Browser
Second
You must note that in the. aspx text, set some attributes of 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>
Last
Call (javascript) in the. aspx btnprint. onclick event)
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;
}
Print finished!