Active report-InWebUse onActive report
Active reportThe operation is simple and convenient, and examples are provided to help you get started easily. After several weeks of reporting, we recorded the study notes. EnvironmentXP + vs2005 + Active report3.0.This articleArticleFor translation help documentation, practice English! Original article address:
MS-help: // dd. activereports3.1033/ddarnet3/ar2wlkusingactivexviewercontrolontheweb.html
ActiveX ViewerControls allow you to display, print, and output report files in a browser.
This article consists of the following parts:
LAdd a reportWebApplicationProgram
LSet a report data source
LAddActiveX viewer. CabFile to the Program Folder
LAddReportoutputFolder
LInWebAdd required object tags to the form
LInWebAdd formWindow_onloadEventCode
LInWebAddPage_loadEvent code
To complete this tutorial, you must be able to accessNorth‑vrnDatabase,Active reportProvide a database in the following pathCopy:C: \ Program Files \ Data Dynamics \ activereports for. Net 3.0 \ data \ nwind. MDB.
Your computer or server must be accessibleIIS.
You must be able to run "Configure web sample"Configuration from program Start MenuActive report.
After completing this tutorial, you will get the following report:
Add a reportWebApplications
1.CreateAsp.net WebEngineering
2.SlaveWebProject menu, select Add new item
3.SelectActivereports 3.0File, renameRptactivex
4.Click Add.
5.If you wantClassPut in'App _ Code'Folder, click"Yes"
Set a report data source
1.InDetail SectionClick the gray Data Source button to open a report dialog box.
2.ClickBuild
3.SelectMicrosoft JET 4.0 ole db ProviderClick Next
4.Click to omitButton to find the database path and select the path
5.PointOKContinue
6.In the queryField,Input"Select * from products order by categoryid"
7.PointOKReturn to report page
Add Report Data Control
1.AddGroupheader/footer SectionToRptactivex
2.ModifyGroupheaderAttribute Name = "ghcategories", backcolor = "rosybrown", datafield = "categoryid"
3.InGhcategoriesAdd the followingLabels
Name |
Text |
Location |
Lblproductname |
Product Name |
0, 0 |
Lblunitsinstock |
Units in stock |
1.88, 0 |
Lblunitsonorder |
Units on order |
2.94, 0 |
Lblunitprice |
Unit Price |
4, 0 |
4SetDetail SectionOfCanshrink = true.
5In the report resource manager, expandFieldSection, drag the followingFelidToDetail Section
Field |
Text |
Location |
Output Format |
Productname |
Product Name |
0, 0 |
Na |
Unitsinstock |
Units in stock |
1.88, 0 |
Na |
Unitsonorder |
Units on order |
2.94, 0 |
Na |
Unitprice |
Unit Price |
4, 0 |
Currency |
AddActiveX. CabFile to project folder
1.OpenWindowResource Manager foundActive reportInstallation path, Default:"C: \ Program Files \ Data Dynamics \ activereports for. Net 3.0 ."
2.Double-clickDeploymentFolder,CopyActiveX. Cab
3.Go to your project folder
4.Paste this. CabFile to your project folder
Create ReportoutputFolder
1.InWindowResource Manager find your project folder
2.Right-click New-"Folder
3.Change the folder nameReportoutput
4.Make sure you have the write permission for this folder.
In the formHtmlAdd OBJECT tag
LInHtmlForm view, inBodyMark, but in<Form> tagsAdd the following code.:
<Object ID = "ARV" codebase = "arview2.cab" Height = "100%" width = "100%"
Classid = "CLSID: 8127d715-ff88-44ba-8d1d-ad3e59543dde" viewastext>
<Param name = "_ extentx" value = "11218">
<Param name = "_ extenty" value = "7329"> </Object>
InWebFormWindow_onloadAdd code to the event
1.InHtmlForm top,Click the drop-down list"Client objects and events",Select "Window"
2.Select"OnLoad"Event
3.This willWebCreate an event for the form body
4.Add the following code in the eventARV. datapath = "reportoutput/axreport. RDF ";
In the formPage_loadAdd code to the event
Private sub page_load (byval sender as system. Object, byval e as system. eventargs) handles _
Mybase. Load
Dim RPT as new rptactivex ()
Rpt. Run ()
Rpt. Document. Save (server. mappath ("") + "\ reportoutput \ axreport. RDF", datadynamics. activereports. Document. rdfformat. ar20)
End sub
// C #
Private void page_load (Object sender, system. eventargs E)
{
Rptactivex RPT = new rptactivex ();
Rpt. Run ();
Rpt. Document. Save (server. mappath ("") + "\ reportoutput \ axreport. RDF ",
Datadynamics. activereports. Document. rdfformat. ar20 );
}