ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ1

ActiveReportsÿforÿ.NETÿ3ÿUserÿGuide

ActiveReportsÿforÿ.NETÿ3.0ÿisÿaÿfullyÿintegratedÿproductÿwhichÿcombinesÿtheÿfeaturesÿofÿtheÿVisualÿStudioÿ.NETÿ programmingÿlanguagesÿwithÿuser-friendlyÿcontrolsÿtoÿprovideÿaÿpowerfulÿreportÿdesigner.

InÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿDocumentation IntroducingÿActiveReportsÿforÿ.NETÿ3.0 Findÿoutÿwhat'sÿnewÿinÿActiveReportsÿforÿ.NETÿ3.0,ÿinstallationÿandÿsetupÿinformation,ÿandÿtheÿfeaturesÿofÿtheÿ StandardÿandÿProfessionalÿEditions.ÿThisÿsectionÿalsoÿcontainsÿimportantÿarchitectureÿandÿconceptsÿinformationÿasÿ wellÿasÿaÿguideÿtoÿhelpÿyouÿtoÿgetÿstarted.ÿ LicensingÿReports Useÿthisÿguideÿtoÿlicenseÿyourÿmachineÿandÿtoÿaddÿlicensingÿtoÿprojectsÿcreatedÿduringÿyourÿevaluation.ÿ GettingÿAssistance LearnÿtheÿlocationÿofÿtheÿReadmeÿfileÿandÿhowÿtoÿobtainÿproductÿsupport.ÿ SamplesÿandÿWalkthroughs FindÿoutÿhowÿtoÿuseÿvariousÿfeaturesÿofÿActiveReportsÿinÿtheÿavailableÿsamplesÿandÿwalkthroughs.ÿ Troubleshooting LearnÿhowÿtoÿresolveÿsomeÿcommonÿissuesÿwithÿActiveReports.ÿ

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ2

TableÿOfÿContents

ActiveReportsÿforÿ.NETÿ3.0ÿUserÿGuide 11 IntroducingÿActiveReportsÿforÿ.NETÿ3.0 11 ActiveReportsÿEditions 11-12

StandardÿEditionÿFeatures 12-13 ProfessionalÿEditionÿFeatures 13 DataÿDynamicsÿCopyrightÿNotice 13 ActiveReportsÿforÿ.NETÿ3.0ÿLicenseÿAgreementÿandÿLimitedÿWarranty 13-15 FrequentlyÿAskedÿQuestions 15-17

InstallationÿandÿSetup 17 HardwareÿandÿSoftwareÿRequirements 17 InstalledÿFiles 17-20 TroubleshootingÿInstallation 20 VerifyingÿPackageÿInstallation 20 UpgradingÿReports 20

ChangesÿBetweenÿActiveReportsÿ2.0ÿandÿActiveReportsÿforÿ.NET 20-21 ConvertingÿMicrosoftÿAccessÿReports 21-26 MigratingÿfromÿActiveReportsÿ2.0 26 UpgradingÿReportsÿCreatedÿwithÿPreviousÿVersionsÿofÿActiveReportsÿforÿ.NET 26-28 ArchitectureÿandÿConcepts 28-29 Charts 29

ChartÿTypes 29 CommonÿCharts 29-30 AreaÿCharts 30 Barÿ2DÿCharts 30-31 BezierÿCharts 31-32

DoughnutÿandÿPieÿCharts 32-33 GanttÿCharts 33-34 HorizontalÿBarÿCharts 34-35 LineÿCharts 35-36 ScatterÿCharts 36-37 StackedAreaÿCharts 37-38 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ3

StackedBarÿCharts 38-39 StackedArea100PctÿCharts 39-40 StackedBar100PctÿCharts 40-41 3DÿCharts 41-42 Area3DÿCharts 42-43

Bar3DÿCharts 43-44 ClusteredBarÿCharts 44-46 Doughnut3DÿPieÿCharts 46-47 Funnelÿ3DÿCharts 47-49 HorizontalÿBarÿ3DÿCharts 49-50

Line3DÿCharts 50-51 PyramidÿCharts 51-52 StackedBar3DÿCharts 52-53 StackedBar3D100PctÿCharts 53-54 XYÿCharts 54-55 BubbleÿCharts 55-56

BubbleXYÿCharts 56-57 LineXYÿCharts 57 PlotXYÿCharts 58 FinancialÿCharts 58 CandleÿCharts 58-60

HiLoÿCharts 60-61 HiLoOpenCloseÿCharts 61-62 KagiÿCharts 62-63 PointÿAndÿFigureÿCharts 63-64 RenkoÿCharts 65-66 ThreeÿLineÿBreakÿCharts 66-67

ChartÿAppearance 67 ChartÿEffects 67 Colors 67-68 3DÿEffects 68-69 AlphaÿBlending 69-70

Lighting 70-71 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ4

ChartÿControlÿItems 71 Annotations 71-73 TitlesÿandÿFooters 74-75 Legends 75-77 Markers 77-79

ConstantÿLinesÿandÿStripes 79-81 ChartÿAxesÿandÿWalls 81 StandardÿAxes 81-83 CustomÿAxes 83-85 GridÿlinesÿandÿTickÿMarks 85-86 ChartÿData 86-87

DataÿBoundÿCharts 87-90 UnboundÿCharts 90-93 CalculatedÿandÿSequenceÿSeriesÿCharts 93-94 Chart-SpecificÿProperties 94-101 ChartÿWizard 101

SectionÿEvents 101-102 SequenceÿofÿEvents 102-103 Hyperlinks 103-104 Inheritance 104-107 LayoutÿFiles 107 Localization 107

OutputFormatÿStrings 107-108 Parameters 108-110 ReportÿandÿPageÿSettings 111-115 ReportÿExecution 115-116 ReportÿStructure 116

RichText 116-117 SupportedÿHtmlÿTagsÿInÿtheÿRichTextÿControl 117-118 Scripting 118 AccessÿControlsÿInÿScript 118-119 ScriptÿClass 119-120 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ5

AddÿScriptÿReference 120 AddÿNamedÿItem 120-121 AddÿCode 121 GettingÿStarted 121-123 ActiveReportsÿandÿtheÿWeb 123

ActiveXÿViewerÿControl 123-125 ManuallyÿConfiguringÿWebÿSamples 125-129 AddingÿActiveReportsÿControlsÿtoÿtheÿVisualÿStudioÿToolbox 129-130 AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿ.NETÿProject 130-131 ActiveReportsÿDesigner 131-132

DesignÿSurface 132-133 DesignerÿTabs 133-136 ReportÿExplorer 136-139 ReportÿMenu 139-140 Toolbars 140-141 Toolbox 141-142

AddingÿFieldÿExpressions 142-144 BindingÿReportsÿtoÿaÿDataÿSource 144 UsingÿtheÿDataSourceÿIcon 144-146 UsingÿaÿDataset 146-148 UsingÿaÿDataÿView 148-149

DeployingÿTheÿEndÿUserÿReportÿDesigner 149 GroupingÿData 149-150 LimitationsÿinÿExportÿFormats 150-151 LocalizingÿtheÿViewerÿControl 151-152 UsingÿMetricÿUnits 152-153 OptimizingÿActiveReports 153-154

ViewingÿReports 154 UsingÿtheÿActiveReportsÿWinFormÿViewer 154-155 PreviewingÿReportsÿatÿDesignÿTime 155 SavingÿandÿLoadingÿRDFÿFiles 155-156 SavingÿandÿLoadingÿRPXÿFiles 156-158

UsingÿCharts 158-159 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ6

Adding,ÿMovingÿorÿDeletingÿaÿChart 159 CreatingÿaÿSimpleÿBarÿChart 159-163 SavingÿandÿLoadingÿCharts 163-164 UsingÿAnnotations 164-167 What'sÿNew 167-171

LicensingÿReports 171-172 GettingÿAssistance 173 ReadmeÿFile 173 ProductÿSupport 173 ProductÿRegistration 173 TechnicalÿSupport 173-174

SamplesÿandÿWalkthroughs 174-175 Samples 175 StandardÿEditionÿSamples 175-176 AnnualÿReportÿSample 176 ASP.NETÿStandardÿEditionÿWebÿSampleÿforÿVisualÿStudioÿ2003 176

BoundÿDataÿSample 176-177 CacheToDiskÿSample 177 CalculatedÿFieldsÿSample 177 CategoryÿSelectionÿSample 177 ChartingÿSample 177 Cross-TabÿSample 177-178

CustomÿPreviewÿSample 178 DataFieldÿExpressionsÿSample 178 E-mailÿSample 178 HyperlinksÿandÿDrill-DownÿSample 178 iListÿBindingÿSample 178-179

PrintÿMultipleÿPagesÿPerÿSheetÿSample 179 RDFÿFileÿViewerÿSample 179 ReportÿAssembliesÿSample 179 SubreportsÿSample 179 UnboundÿDataÿSample 180 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ7

XMLÿDataÿSample 180 ProfessionalÿEditionÿSamples 180 ASP.NETÿWebÿSample 180 End-UserÿReportÿDesignerÿSample 180-181 Walkthroughs 181

StandardÿEditionÿWalkthroughs 181-182 AddressÿLabels 182-185 BookmarksÿWalkthroughs 185-186 Walkthrough:ÿBookmarksÿwithÿGrouping 186-190 Walkthrough:ÿBookmarksÿwithÿSimpleÿReports 190-193

Walkthrough:ÿBookmarksÿwithÿSubreports 193-198 Walkthrough:ÿCalculatedÿFields 198-201 ChartÿWalkthroughs 201 2DÿBarÿChart 201-203 3DÿPieÿChart 203-205 FinancialÿChart 205-208

SimpleÿUnboundÿChart 208-211 ColumnarÿReports 211-213 CustomÿControlsÿandÿChartFX 213-215 Walkthrough:ÿCustomizingÿtheÿViewerÿControl 216-217 Walkthrough:ÿDataÿBoundÿReports 217-219

Walkthrough:ÿUsingÿDataSetsÿContainingÿRelationshipsÿwithÿSubreports 219-224 Walkthrough:ÿDeployingÿCompiledÿReports 224-225 Walkthrough:ÿExportingÿOutput 225-227 GreenÿBarÿReports 227-230 GroupingÿDataÿWalkthroughs 230 Walkthrough:ÿConditionalÿShow-HideÿDetail 230-233

Walkthrough:ÿGroupÿonÿSimpleÿFields 233-235 GroupÿonÿaÿFieldÿExpression 235-237 GroupÿonÿUnboundÿFields 237-243 Walkthrough:ÿKeepTogetherÿOptions 243-245 HyperlinksÿWalkthroughs 245-246

Walkthrough:ÿHyperlinks 246-248 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ8

Walkthrough:ÿHyperlinksÿandÿBookmarks 248-254 Walkthrough:ÿHyperlinksÿandÿSimulatedÿDrill-DownÿReporting 254-261 LocalizationÿWalkthroughs 261 LocalizingÿtheÿActiveReportsÿViewerÿControl 261-265 LocalizingÿtheÿActiveReportsÿEngine 265-269

MasterÿDetailÿReportsÿWalkthroughs 269 Walkthrough:ÿMasterÿDetailÿReportsÿwithÿGrouping 269-272 Walkthrough:ÿMasterÿDetailÿReportsÿwithÿSubreports 272-276 Walkthrough:ÿMasterÿDetailÿReportsÿwithÿXMLÿData 276-279 ModifyingÿReportÿDocumentsÿWalkthroughs 279 Walkthrough:ÿAddingÿPages 279-283

Walkthrough:ÿApplyingÿPageÿTemplates 283-286 Walkthrough:ÿMergingÿReports 286-290 PageÿNumberingÿWalkthroughs 290 Walkthrough:ÿPageÿNumberingÿinÿtheÿGroupÿHeader 290-292 Walkthrough:ÿPageÿNumberingÿinÿtheÿPageÿFooter 292-294

ParametersÿWalkthroughs 294-295 Walkthrough:ÿParametersÿwithÿSimpleÿReports 295-296 Walkthrough:ÿParametersÿwithÿSubreports 296-300 ParametersÿwithÿCharts 300-304 PrintingÿWalkthroughs 304 Walkthrough:ÿDuplexing 304-306

Walkthrough:ÿMultipleÿCopies 306-307 Walkthrough:ÿOrientation 307-308 RichTextÿWalkthroughs 308-309 Walkthrough:ÿRichÿTextÿandÿFieldÿMerging 309-314 HTML,ÿTablesÿandÿExportingÿwithÿRichText 314-318

Run-TimeÿReportingÿWalkthroughs 318-319 Walkthrough:ÿCreatingÿandÿModifyingÿReportÿLayoutsÿatÿRunÿTime 319-328 Walkthrough:ÿModifyingÿtheÿReportÿDataÿSourceÿatÿRunÿTime 328-330 Walkthrough:ÿSavingÿandÿLoadingÿtoÿaÿMemoryÿStream 330-333 ScriptingÿWalkthroughs 333 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ9

Walkthrough:ÿScriptingÿandÿSimpleÿReports 333-337 Walkthrough:ÿScriptingÿandÿSubreports 337-343 Walkthrough:ÿUsingÿSpreadBuilder 343-345 Walkthrough:ÿStyleÿSheets 345-346 SubreportsÿWalkthroughs 346

Walkthrough:ÿHierarchicalÿSubreports 346-349 Walkthrough:ÿSimpleÿSubreports 349-352 NestedÿSubreports 353-357 SubreportsÿwithÿXMLÿData 357-359 Walkthrough:ÿSummaryÿFields 359-362

SummaryÿReports 362-364 TopÿNÿReports 364-366 Walkthrough:ÿUnboundÿReports 366-370 WebÿWalkthroughsÿ(StandardÿEdition) 371 Walkthrough:ÿUsingÿtheÿActiveXÿViewerÿControlÿonÿtheÿWeb 371-374 CustomÿWebÿExportingÿWalkthroughs 374-375

Walkthrough:ÿCustomÿExportingÿwithÿHTML 375-382 Walkthrough:ÿCustomÿExportingÿwithÿPDF 382-385 Walkthrough:ÿCustomÿExportingÿwithÿExcel 386-389 Walkthrough:ÿCustomÿExportingÿwithÿTIFF 389-392 Walkthrough:ÿCustomÿExportingÿwithÿRTF 392-395

CustomÿExportingÿwithÿPlainÿText 395-398 WebÿDeployment 398-399 WebÿServicesÿWalkthroughs 399-400 DataSetÿWebÿService 400-401 DataSetÿWindowsÿApplication 401-404 ActiveReportsÿDocumentÿWebÿService 404-406

ActiveReportsÿDocumentÿWindowsÿApplication 406-409 ProfessionalÿEditionÿWalkthroughs 409 CreatingÿanÿEnd-UserÿReportÿDesignerÿWalkthroughs 409 Walkthrough:ÿCreatingÿtheÿBasicÿLayoutÿforÿanÿEnd-UserÿReportÿDesigner 409-412 Walkthrough:ÿAddingÿCodeÿforÿtheÿEnd-UserÿReportÿDesigner 412-417

Walkthrough:ÿDeployingÿActiveReportsÿWebÿApplications 417-418 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ10

ConfiguringÿtheÿHTTPÿHandlers 418-421 Walkthrough:ÿHTTPÿHandlers 421-424 ParametersÿAndÿHTTPÿHandlers 424-426 ProÿEditionÿLocalizationÿWalkthroughs 426-427 LocalizingÿtheÿActiveReportsÿDesigner 427-432

LocalizingÿtheÿActiveÿReportsÿWebÿViewerÿControl 432-434 Walkthrough:ÿWebÿViewerÿControl 434-436 Troubleshooting 436-437 ActiveReportsÿIconÿnotÿShowing 437 CopyÿIconÿMissingÿfromÿtheÿViewer 437 EvaluationÿMessageÿShowing 437-439

TroubleshootingÿExports 439 ExcelÿExportÿTroubleshooting 439-440 HTMLÿExportÿTroubleshooting 440 PDFÿExportÿTroubleshooting 440-441 RTFÿExportÿTroubleshooting 441-442

TextÿExportÿTroubleshooting 442 TIFFÿExportÿTroubleshooting 442-443 TroubleshootingÿMemoryÿIssues 443-444 TroubleshootingÿParameters 444 TroubleshootingÿPrinting 444-446 TroubleshootingÿtheÿWebViewer 446-448

VisualÿStudioÿ2005ÿWebÿProjectÿConversion 448 CopyingÿReportsÿResultsÿinÿStackedÿControls 448 TroubleshootingÿErrorsÿAfterÿNewÿBuildÿInstallation 448 TroubleshootingÿControlsÿinÿSubreports 448

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ11

ActiveReportsÿforÿ.NETÿ3.0ÿUserÿGuide

ActiveReportsÿforÿ.NETÿ3.0ÿisÿaÿfullyÿintegratedÿproductÿwhichÿcombinesÿtheÿfeaturesÿofÿtheÿVisualÿStudioÿ.NETÿ programmingÿlanguagesÿwithÿuser-friendlyÿcontrolsÿtoÿprovideÿaÿpowerfulÿreportÿdesigner.

InÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿDocumentation IntroducingÿActiveReportsÿforÿ.NETÿ3.0 Findÿoutÿwhat'sÿnewÿinÿActiveReportsÿforÿ.NETÿ3.0,ÿinstallationÿandÿsetupÿinformation,ÿandÿtheÿfeaturesÿofÿ theÿStandardÿandÿProfessionalÿEditions.ÿThisÿsectionÿalsoÿcontainsÿimportantÿarchitectureÿandÿconceptsÿ informationÿasÿwellÿasÿaÿguideÿtoÿhelpÿyouÿtoÿgetÿstarted.ÿ LicensingÿReports Useÿthisÿguideÿtoÿlicenseÿyourÿmachineÿandÿtoÿaddÿlicensingÿtoÿprojectsÿcreatedÿduringÿyourÿevaluation.ÿ GettingÿAssistance LearnÿtheÿlocationÿofÿtheÿReadmeÿfileÿandÿhowÿtoÿobtainÿproductÿsupport.ÿ SamplesÿandÿWalkthroughs FindÿoutÿhowÿtoÿuseÿvariousÿfeaturesÿofÿActiveReportsÿinÿtheÿavailableÿsamplesÿandÿwalkthroughs.ÿ Troubleshooting ÿ LearnÿhowÿtoÿresolveÿsomeÿcommonÿissuesÿwithÿActiveReports.ÿ

IntroducingÿActiveReportsÿforÿ.NETÿ3.0

ActiveReportsÿleveragesÿtheÿlatestÿtechnologiesÿincludingÿXML,ÿscriptingÿandÿCSSÿalongÿwithÿopenÿarchitectureÿ toÿprovideÿyouÿwithÿaÿfully-integratedÿandÿuser-friendlyÿreportÿdesigner.ÿThisÿversionÿnowÿsupportsÿVisualÿ Studioÿ2005,ÿasÿwellÿasÿVisualÿStudioÿ2003. Thisÿsectionÿcontainsÿinformationÿabout: ActiveReportsÿEditions FindÿoutÿaboutÿtheÿdifferentÿfeaturesÿofÿtheÿStandardÿandÿProfessionalÿEditions.ÿ DataÿDynamicsÿCopyrightÿNotice ExplainsÿDataÿDynamicsÿcopyrightÿinformation.ÿ ActiveReportsÿLicenseÿAgreement UnderstandÿtheÿtermsÿofÿtheÿActiveReportsÿLicenseÿAgreementÿandÿLimitedÿWarranty.ÿ FrequentlyÿAskedÿQuestions FindÿtheÿanswersÿtoÿFrequentlyÿAskedÿQuestions.ÿ InstallationÿandÿSetup ExplainsÿtheÿdetailsÿofÿActiveReportsÿinstallationÿandÿsetup.ÿ UpgradingÿReports LearnÿtoÿupgradeÿreportsÿinÿpreviousÿversionsÿofÿActiveReportsÿandÿotherÿreportÿprograms.ÿ ArchitectureÿandÿConcepts Findÿoutÿaboutÿtheÿstructureÿandÿconceptsÿofÿreportÿdesign.ÿ GettingÿStarted LearnÿtheÿbasicsÿofÿusingÿActiveReportsÿforÿ.NETÿ3.0.ÿ What'sÿNew ÿ LearnÿaboutÿtheÿnewÿfeaturesÿaddedÿtoÿActiveReportsÿforÿ.NETÿ3.0.

ActiveReportsÿEditions

StandardÿEditionÿFeatures FindÿoutÿaboutÿtheÿfeaturesÿofÿActiveReportsÿforÿ.NETÿ3.0ÿStandardÿEdition.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ12

ÿ ProfessionalÿEditionÿFeatures FindÿoutÿaboutÿtheÿfeaturesÿofÿActiveReportsÿforÿ.NETÿ3.0ÿProfessionalÿEdition.ÿ

StandardÿEditionÿFeatures

ActiveReportsÿforÿ.NETÿ3.0ÿisÿanÿenhancementÿofÿtheÿpopularÿActiveReportsÿforÿ.NETÿengineÿandÿreportÿ viewer.ÿÿItÿincludesÿtheÿsameÿpowerÿandÿflexibilityÿofÿActiveReportsÿforÿ.NETÿandÿtheÿsameÿintegrationÿwithÿ theÿVisualÿStudio®ÿ.NETÿ2003ÿEnvironment,ÿandÿaddsÿseveralÿnewÿfeaturesÿincludingÿintegrationÿwithÿtheÿ VisualÿStudioÿ.NETÿ2005ÿEnvironment.ÿActiveReportsÿforÿ.NETÿ3.0ÿStandardÿEditionÿsupportsÿtheÿfollowingÿ features:ÿ

Designer

l Fullÿintegrationÿwithÿtheÿ.NETÿenvironmentÿ l Familiarÿuserÿinterfaceÿ l C#ÿandÿVB.NETÿsupportÿ

l Theÿabilityÿtoÿcompileÿreportsÿintoÿtheÿapplicationÿforÿspeedÿandÿsecurityÿorÿtoÿkeepÿthemÿseparateÿforÿ easeÿofÿupdatingÿ

l Designerÿhostingÿofÿ.NETÿandÿuserÿcontrolsÿ

ReportÿControls l Labelÿ

l Textboxÿ l Checkboxÿ

l Pictureÿ l Lineÿ l Shapeÿ

l RichTextÿwithÿnewÿHTMLÿtagÿsupportÿ l New!ÿReportÿInfoÿ

l Subreportÿ

l Pagebreakÿ l BarcodeÿwithÿstandardÿstylesÿplusÿQRCode,ÿCode49,ÿJapanesePostal,ÿandÿPdf417ÿ

l OleObjectÿ

l Chartÿcontrolÿwithÿseparateÿdataÿsource

ReportingÿEngine l Managedÿcodeÿ

l BindingÿtoÿADO.NET,ÿXML,ÿiList,ÿandÿcustomÿdataÿsourcesÿ l EasyÿdeploymentÿwithÿtheÿreportÿprocessingÿengineÿasÿaÿsingleÿassemblyÿDLLÿ

l AllÿofÿtheÿfeaturesÿofÿActiveReportsÿ2.0

ReportÿViewer l ManagedÿC#ÿcodeÿ

l Veryÿsmallÿdeploymentÿassembly,ÿsuitableÿforÿuseÿonÿtheÿInternetÿ l TableÿofÿContents/Bookmarksÿ l ThumbnailÿViewÿ

l Hyperlinkingÿ l New!ÿTabbedÿViewing

ExportÿFilters ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ13

ActiveReportsÿincludesÿexportÿfiltersÿtoÿgenerateÿoutputÿintoÿRichÿTextÿFormatÿ(RTF)ÿforÿword-processing,ÿ PortableÿDocumentÿFormatÿ(PDF)ÿforÿprinting,ÿMicrosoft®ÿExcel®ÿworksheets,ÿHTMLÿandÿDHTMLÿforÿ publishingÿyourÿreportsÿtoÿtheÿinternet,ÿTIFFÿforÿopticalÿarchivingÿandÿfaxingÿandÿdelimitedÿtextÿforÿÿ spreadsheetsÿandÿdatabases.

ProfessionalÿEditionÿFeatures

ActiveReportsÿforÿ.NETÿ3.0ÿisÿanÿenhancementÿofÿtheÿpopularÿActiveReportsÿforÿ.NETÿengineÿandÿreportÿ viewer.ÿItÿincludesÿtheÿsameÿpowerÿandÿflexibilityÿofÿActiveReportsÿforÿ.NETÿandÿtheÿsameÿintegrationÿwithÿtheÿ VisualÿStudio®ÿ.NETÿ2003ÿEnvironmentÿandÿaddsÿintegrationÿwithÿtheÿVisualÿStudioÿ.NETÿ2005ÿEnvironment.ÿ ActiveReportsÿforÿ.NETÿ3.0ÿProfessionalÿEditionÿincludesÿallÿofÿtheÿfeaturesÿofÿtheÿStandardÿEditionÿandÿ supportsÿtheÿfollowingÿadditionalÿfeatures:ÿ

End-UserÿReportÿDesigner Theÿcontrolÿisÿaÿrun-timeÿdesignerÿthatÿmayÿbeÿdistributedÿroyalty-free.ÿItÿallowsÿtheÿActiveReportsÿdesignerÿ toÿbeÿhostedÿinÿanÿapplicationÿandÿprovidesÿend-userÿreportÿeditingÿcapabilities.ÿTheÿcontrol'sÿmethodsÿandÿ propertiesÿprovideÿeasyÿaccessÿforÿsavingÿandÿloadingÿreportÿlayouts,ÿmonitoringÿandÿcontrollingÿtheÿdesignÿ environment,ÿandÿcustomizingÿtheÿlookÿandÿfeelÿtoÿtheÿneedsÿofÿendÿusers.

ASP.NETÿIntegration

l TheÿWebÿserverÿcontrolÿprovidesÿconvenienceÿforÿrunningÿandÿexportingÿreportsÿinÿASP.NET.ÿ l HTTPÿHandlerÿextensionsÿallowÿreportÿfilesÿ(RPX)ÿorÿcompiledÿassembliesÿcontainingÿreportsÿtoÿbeÿdroppedÿ onÿtheÿserverÿandÿhyperlinked.ÿ

WebÿViewerÿControl l TheÿWebÿViewerÿcontrolÿallowsÿquickÿviewingÿofÿActiveReportsÿonÿtheÿwebÿasÿwellÿasÿprintingÿcapabilityÿ withÿtheÿActiveXViewerÿandÿAcrobatReaderÿViewerTypeÿenumerations.ÿ

HTTPÿHandlers

l TheÿRPXÿHTTPHandlerÿallowsÿtheÿdeveloperÿtoÿhyperlinkÿActiveReportsÿonÿaÿwebÿpageÿtoÿreturnÿHTMLÿ formatÿorÿPDFÿformatÿreportsÿforÿviewingÿand/orÿprinting.ÿ

ÿ l TheÿCompiledÿReportÿHTTPHandlerÿallowsÿtheÿdeveloperÿtoÿhyperlinkÿActiveReportsÿcompiledÿinÿanÿ assemblyÿonÿaÿwebÿpageÿtoÿreturnÿHTMLÿformatÿorÿPDFÿformatÿreportsÿforÿviewingÿand/orÿprinting.ÿ

DataÿDynamicsÿCopyrightÿNotice

Informationÿinÿthisÿdocument,ÿincludingÿURLÿandÿotherÿInternetÿWebÿsiteÿreferences,ÿisÿsubjectÿtoÿchangeÿ withoutÿnotice.ÿUnlessÿotherwiseÿnoted,ÿtheÿexampleÿcompanies,ÿorganizations,ÿproducts,ÿdomainÿnames,ÿe- mailÿaddresses,ÿlogos,ÿpeople,ÿplacesÿandÿeventsÿdepictedÿhereinÿareÿfictitious,ÿandÿnoÿassociationÿwithÿanyÿ realÿcompany,ÿorganization,ÿproduct,ÿdomainÿname,ÿe-mailÿaddress,ÿlogo,ÿperson,ÿplaceÿorÿeventÿisÿintendedÿ orÿshouldÿbeÿinferred.ÿComplyingÿwithÿallÿapplicableÿcopyrightÿlawsÿisÿtheÿresponsibilityÿofÿtheÿuser.ÿNoÿpartÿofÿ thisÿdocumentÿmayÿbeÿreproduced,ÿstoredÿinÿorÿintroducedÿintoÿaÿretrievalÿsystem,ÿorÿtransmittedÿinÿanyÿformÿ orÿbyÿanyÿmeansÿ(electronic,ÿmechanical,ÿphotoÿcopying,ÿrecording,ÿorÿotherwise),ÿorÿforÿanyÿpurpose,ÿ withoutÿtheÿexpressÿwrittenÿpermissionÿofÿDataÿDynamics,ÿLtd. ÿ

ActiveReportsÿandÿtheÿActiveReportsÿlogoÿareÿregisteredÿtrademarksÿofÿDataÿDynamics,ÿLtd.ÿÿÿ Allÿotherÿtrademarksÿareÿtheÿpropertyÿofÿtheirÿrespectiveÿowners.

ActiveReportsÿforÿ.NETÿ3.0ÿLicenseÿAgreementÿandÿLimitedÿWarranty

LicenseÿAgreementÿandÿLimitedÿWarranty Pleaseÿreadÿcarefullyÿbeforeÿinstallingÿthisÿsoftwareÿpackage.ÿYourÿinstallationÿofÿtheÿpackageÿindicatesÿyourÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ14 acceptanceÿofÿtheÿtermsÿandÿconditionsÿofÿthisÿlicenseÿagreement.ÿContactÿDataÿDynamicsÿifÿyouÿhaveÿanyÿ questionsÿaboutÿthisÿlicense. TheÿProductÿ(librariesÿandÿobjectÿcode)ÿisÿproprietaryÿtoÿDataÿDynamics,ÿLtd.ÿandÿisÿprotectedÿbyÿFederalÿ CopyrightÿLaw.ÿDataÿDynamicsÿretainsÿtheÿtitleÿtoÿandÿownershipÿofÿtheÿProduct.ÿYouÿareÿlicensedÿtoÿuseÿthisÿ Productÿonÿtheÿfollowingÿtermsÿandÿconditions:

LICENSE: TheÿProductÿisÿlicensedÿperÿsoftwareÿapplicationÿdeveloperÿ(“developer”).ÿLicenseeÿisÿdefinedÿasÿtheÿpersonÿorÿ entityÿthatÿpaysÿconsiderationÿforÿtheÿlicenseÿtoÿuseÿtheÿProduct.ÿDataÿDynamicsÿherebyÿgrantsÿtheÿLicenseeÿaÿ nonexclusiveÿLicenseÿauthorizingÿone,ÿandÿonlyÿone,ÿdeveloperÿatÿaÿtimeÿtoÿuseÿtheÿProductÿforÿdevelopmentÿ purposes.ÿTheÿLicenseeÿisÿalsoÿpermittedÿtoÿdistributeÿapplicationsÿcontainingÿtheÿfilesÿdesignatedÿbelowÿonÿaÿ royaltyÿfreeÿbasis.ÿTheÿuseÿofÿthisÿLicenseÿdoesÿnotÿcreateÿanyÿkindÿofÿpartnershipÿorÿjointÿownershipÿinterestÿ inÿtheÿLicensee’sÿproprietaryÿapplications.ÿPleaseÿcontactÿDataÿDynamicsÿifÿyouÿrequireÿadditionalÿLicenses.ÿ LicenseeÿmayÿincorporateÿtheÿsampleÿcodeÿintoÿLicensee’sÿapplications.ÿUseÿofÿthisÿproductÿbyÿmoreÿthanÿoneÿ developerÿatÿaÿtimeÿterminates,ÿwithoutÿnotification,ÿthisÿLicenseÿandÿtheÿrightÿtoÿuseÿthisÿproduct.

LICENSEEÿMAYÿNOT: Distribute,ÿrent,ÿsub-licenseÿorÿotherwiseÿmakeÿavailableÿtoÿothersÿtheÿsoftwareÿorÿdocumentationÿorÿcopiesÿ thereof,ÿexceptÿasÿexpresslyÿpermittedÿinÿthisÿLicenseÿwithoutÿpriorÿwrittenÿconsentÿfromÿDataÿDynamics.ÿInÿ theÿcaseÿofÿanÿauthorizedÿtransfer,ÿtheÿtransfereeÿmustÿagreeÿtoÿbeÿboundÿbyÿtheÿtermsÿandÿconditionsÿofÿthisÿ LicenseÿAgreement.

RESTRICTIONS: LicenseeÿmayÿuseÿthisÿProductÿinÿLicensee'sÿbusinessÿapplicationÿforÿsaleÿorÿdistributionÿasÿlongÿas: 1. TheÿproductÿthatÿLicenseeÿproducesÿand/orÿdistributesÿisÿNOTÿaÿsoftwareÿdevelopmentÿproduct;ÿaÿproductÿ thatÿisÿsoldÿprimarilyÿtoÿsoftwareÿdevelopersÿorÿsystemÿintegratorsÿorÿaÿdevelopmentÿenvironmentÿofÿanyÿ kind.ÿPleaseÿcontactÿDataÿDynamics,ÿLtd.ÿforÿspecialÿcommercialÿlicensingÿprovisionsÿinÿtheseÿ circumstances.ÿ 2. TheÿsoftwareÿserialÿnumberÿandÿLicenseeÿmustÿbeÿregisteredÿwithÿDataÿDynamicsÿinÿorderÿtoÿreceiveÿ supportÿorÿdistributionÿrights.ÿ 3. Licenseeÿmayÿnotÿremoveÿanyÿproprietaryÿnotices,ÿlabels,ÿorÿtrademarksÿonÿtheÿsoftwareÿorÿ documentation.ÿ 4. Licenseeÿmayÿnotÿmodify,ÿde-compile,ÿdisassemble,ÿreverseÿengineerÿorÿtranslateÿtheÿsoftware.

FILESÿTHATÿMAYÿBEÿDISTRIBUTEDÿWITHÿYOURÿAPPLICATION: StandardÿEditionÿLicense: ACTIVEREPORTS3.DLL,ÿACTIVEREPORTS.CHART.DLL,ÿACTIVEREPORTS.VIEWER3.DLL,ÿ ACTIVEREPORTS.INTEROP.DLL,ÿACTIVEREPORTS.XLSEXPORT.DLL,ÿACTIVEREPORTS.HTMLEXPORT.DLL,ÿ ACTIVEREPORTS.PDFEXPORT.DLL,ÿACTIVEREPORTS.RTFEXPORT.DLL,ÿACTIVEREPORTS.TEXTEXPORT.DLL,ÿ ACTIVEREPORTS.TIFFEXPORT.DLL ProfessionalÿEditionÿLicense: ACTIVEREPORTS.DESIGN3.DLLÿandÿACTIVEREPORTS.WEB.DLLÿinÿadditionÿtoÿtheÿStandardÿEditionÿfiles.

USÿGOVERNMENTÿRESTRICTEDÿRIGHTS: Use,ÿduplicationÿorÿdisclosureÿbyÿtheÿUnitedÿStatesÿGovernmentÿisÿsubjectÿtoÿrestrictionsÿasÿsetÿforthÿunderÿ DFARSÿ252.227-7013ÿorÿinÿFARSÿ52.227-19ÿCommercialÿComputerÿSoftwareÿ- RestrictedÿRights.

TERM: LicenseeÿmayÿterminateÿitsÿLicenseÿandÿthisÿAgreementÿatÿanyÿtimeÿbyÿdestroyingÿallÿcopiesÿofÿtheÿProductÿ andÿProductÿDocumentation.ÿTheyÿwillÿalsoÿterminateÿautomaticallyÿifÿLicenseeÿfailsÿtoÿcomplyÿwithÿanyÿtermÿ orÿconditionÿinÿthisÿAgreement.

LIMITEDÿWARRANTY Thisÿsoftwareÿandÿdocumentationÿareÿsoldÿ"asÿis"ÿwithoutÿanyÿwarrantyÿasÿtoÿtheirÿperformance,ÿ merchantabilityÿorÿfitnessÿforÿanyÿparticularÿpurpose.ÿLicenseeÿassumesÿtheÿentireÿriskÿasÿtoÿtheÿqualityÿandÿ performanceÿofÿtheÿsoftware.ÿDataÿDynamicsÿwarrantsÿthatÿtheÿmediaÿonÿwhichÿtheÿProgramÿisÿfurnishedÿwillÿ beÿfreeÿfromÿanyÿdefectsÿinÿmaterials.ÿExclusiveÿremedyÿinÿtheÿeventÿofÿaÿdefectÿisÿexpresslyÿlimitedÿtoÿtheÿ replacementÿofÿmedia.ÿInÿnoÿeventÿshallÿDataÿDynamicsÿorÿanyoneÿelseÿwhoÿhasÿbeenÿinvolvedÿinÿtheÿ creation,ÿdevelopment,ÿproduction,ÿorÿdeliveryÿofÿthisÿsoftwareÿbeÿliableÿforÿanyÿdirect,ÿincidentalÿorÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ15 consequentialÿdamages,ÿsuchÿas,ÿbutÿnotÿlimitedÿto,ÿlossÿofÿanticipatedÿprofits,ÿbenefits,ÿuse,ÿorÿdataÿresultingÿÿ fromÿtheÿuseÿofÿthisÿsoftware,ÿorÿarisingÿoutÿofÿanyÿbreachÿofÿwarranty.

FrequentlyÿAskedÿQuestions

IsÿActiveReportsÿ100%ÿmanaged? ActiveReportsÿincludesÿtheÿfollowingÿdistributableÿassemblies: Managedÿassemblies:ÿ l ActiveReports3.DLLÿ- Thisÿisÿtheÿreportingÿengine.ÿManagedÿandÿwrittenÿinÿC#.ÿ

l ActiveReports.Chart.DLLÿ- Thisÿisÿtheÿchartÿcontrol.ÿÿManagedÿandÿwrittenÿinÿC#.ÿ l ActiveReports.Design3.DLLÿ- Thisÿisÿtheÿrun-timeÿendÿuserÿreportÿdesigner.ÿManagedÿandÿwrittenÿinÿC#.ÿ l ActiveReports.Viewer3.DLLÿ- ThisÿisÿtheÿWindowsÿFormsÿviewer.ÿManagedÿandÿwrittenÿinÿC#.ÿ

l ActiveReports.Web.DLLÿ- ThisÿisÿtheÿWebÿFormsÿviewerÿandÿRPXÿhandler.ÿManagedÿandÿwrittenÿinÿC#.ÿ l ActiveReports.PdfExport.DLLÿ- ThisÿisÿtheÿPDFÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ l ActiveReports.HtmlExport.DLLÿ- ThisÿisÿtheÿHTMLÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ

l ActiveReports.XlsExport.DLLÿ- ThisÿisÿtheÿMicrosoft®ÿExcel®ÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ l ActiveReports.RtfExport.DLLÿ- ThisÿisÿtheÿRTFÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ

l ActiveReports.TextExport.DLLÿ- ThisÿisÿtheÿTextÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ

l ActiveReports.TiffExport.DLLÿ- ThisÿisÿtheÿTIFFÿexportÿfilter.ÿManagedÿandÿwrittenÿinÿC#.ÿ ÿ Unmanagedÿassemblies:ÿ l ActiveReports.Interop.DLLÿ- ThisÿisÿtheÿauxiliaryÿCOMÿinteropÿDLL.ÿUnsafeÿC#ÿcodeÿusedÿforÿOLEÿobjectÿ hostingÿandÿotherÿCOMÿfunctions.ÿTheÿaboveÿareÿtheÿonlyÿdistributableÿDLLs.ÿTheÿcoreÿcomponentsÿareÿallÿ managedÿandÿuseÿallÿofÿwhatÿtheÿ.NETÿframeworkÿhasÿtoÿoffer.ÿ

l riched20.dllÿ- Thisÿisÿversionÿ4.0ÿofÿtheÿMicrosoft®ÿRichEditÿcontrol.ÿThisÿonlyÿneedsÿtoÿbeÿdistributedÿifÿ youÿhaveÿtheÿEndÿUserÿReportÿDesignerÿinÿyourÿproject,ÿandÿwantÿtoÿensureÿthatÿtablesÿwillÿdisplayÿ correctlyÿinÿeditÿmodeÿofÿtheÿRichTextBoxÿcontrol. ÿ ActiveReportsÿalsoÿincludesÿtheÿfollowingÿnon-distributableÿDLLs: l ActiveReportsWizards.AccessImport.DLLÿ- Thisÿisÿtheÿdesign-timeÿReportÿWizard.ÿManagedÿC#.ÿ

l ARTaskPane.DLLÿ- Thisÿisÿtheÿdesign-timeÿwizardsÿcontainer.ÿManagedÿC#.ÿ l ARVSPackage.DLLÿ- ThisÿisÿtheÿVSÿIntegrationÿpackage.ÿUnmanagedÿVC++ÿ(SinceÿintegrationÿwithÿVSÿ requiresÿCOM,ÿthisÿcannotÿbeÿdoneÿanyÿotherÿway).ÿ ÿ HowÿdoÿIÿdisplayÿtheÿReportÿExplorer? ÿ WhenÿyouÿcreateÿyourÿfirstÿActiveReportÿwithÿActiveReportsÿforÿ.NETÿ3.0,ÿtheÿReportÿExplorerÿbyÿdefaultÿdoesÿ notÿdisplay.ÿToÿdisplayÿtheÿReportÿExplorer,ÿcompleteÿtheÿfollowingÿsteps.ÿ 1. Right-clickÿonÿtheÿVisualÿStudioÿtoolbar.ÿ 2. SelectÿActiveReportsÿforÿ.NETÿ3.0 fromÿtheÿshortcutÿmenuÿtoÿdisplayÿtheÿdesignerÿtoolbar.ÿ 3. Onÿtheÿdesignerÿtoolbar,ÿclickÿtheÿViewÿReportÿExplorer button.

Alternatively,ÿyouÿcanÿdisplayÿtheÿReportÿExplorerÿbyÿopeningÿtheÿView menu,ÿpointingÿtoÿOtherÿWindows,ÿ andÿclickingÿReportÿExplorer. Note:ÿOnceÿtheÿReportÿExplorerÿhasÿbeenÿaddedÿtoÿtheÿIDE,ÿitÿwillÿappearÿwhenÿaÿnewÿ WindowsÿApplicationÿisÿcreated.ÿIfÿyouÿdoÿnotÿwishÿtoÿseeÿtheÿReportÿExplorerÿyouÿcanÿcloseÿitÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ16

byÿselectingÿtheÿwindowÿandÿclosingÿit.ÿ WhereÿisÿtheÿScriptÿEditorÿIcon? ÿ TheÿScriptÿEditorÿhasÿbecomeÿtheÿScriptÿViewÿofÿtheÿreportÿinÿtheÿsameÿwayÿthatÿthereÿisÿanÿHTMLÿViewÿofÿ anÿ.ASPXÿform.ÿToÿaccessÿtheÿScriptÿView,ÿclickÿtheÿScriptÿViewÿtabÿlocatedÿbelowÿtheÿreportÿdesignÿsurface.ÿ ToÿgoÿbackÿtoÿtheÿDesignÿView,ÿclickÿtheÿDesignÿViewÿtabÿjustÿtoÿtheÿrightÿofÿtheÿScriptÿViewÿtab.ÿ

ÿ Whyÿisÿtheÿviewerÿiconÿgrayedÿout? ÿ Theÿiconÿmayÿbeÿgrayedÿoutÿforÿtwoÿreasons:ÿ 1. Theÿcontrolÿselectedÿinÿtheÿcomponentsÿlistÿwasÿforÿtheÿwrongÿviewerÿcontrol.ÿActiveReportsÿhasÿtwoÿ separateÿviewerÿcontrols.ÿOneÿisÿDataDynamics.ActiveReports.WebViewer,ÿwhichÿisÿaÿviewerÿcontrolÿthatÿ onlyÿworksÿonÿWebÿForms,ÿandÿtheÿotherÿisÿDataDynamics.ActiveReports.Viewer,ÿwhichÿisÿaÿviewerÿcontrolÿ thatÿworksÿonlyÿonÿWindowsÿForms.ÿÿÿÿ NOTE:ÿTheÿWebViewerÿcontrolÿisÿonlyÿlicensedÿforÿuseÿwithÿtheÿProfessionalÿEdition.ÿAnÿevaluationÿ messageÿisÿdisplayedÿifÿtheÿcontrolÿisÿusedÿwithÿaÿStandardÿlicense. 2. Theÿcorrectÿformÿisÿnotÿselected.ÿIfÿaÿWindowsÿFormÿorÿWebÿFormÿisÿnotÿselectedÿinÿtheÿproject,ÿtheÿ viewerÿiconÿmayÿbeÿgrayedÿout.ÿVerifyÿtheÿcorrectÿviewerÿcomponentÿisÿselectedÿforÿtheÿproject:ÿ ForÿtheÿWindowsÿFormÿViewerÿ- DataDynamics.ActiveReports.Viewerÿ- ActiveReports.Viewer(x.x.x.xxxx) ForÿtheÿWebFormÿViewerÿ- DataDynamics.ActiveReports.Webÿ- ActiveReports.WebViewer(x.x.x.xxx) ÿ WhyÿamÿIÿgettingÿanÿambiguousÿreferenceÿerror? ÿ Thisÿerrorÿoccursÿifÿtheÿreport'sÿclassÿfileÿhasÿ"ImportsÿSystem.Windows.Form"ÿorÿ"usingÿ System.Windows.Form."ÿTheÿreasonÿforÿtheÿerrorÿisÿthatÿtheÿWindows.Formsÿnamespaceÿandÿtheÿ ActiveReportsÿnamespaceÿbothÿhaveÿdefinitionsÿforÿTextbox,ÿLabelÿetc.ÿInÿorderÿtoÿpreventÿtheÿerror,ÿtheÿcodeÿ needsÿtoÿuseÿtheÿfullÿSystem.Windows.FormÿnamespaceÿwhenÿreferencingÿWindows.Formÿobjects.ÿ ÿ Whyÿareÿmyÿemptyÿcontrolsÿnotÿmovingÿup?ÿ Stackedÿcontrolsÿwillÿnotÿmoveÿupÿunderÿtheÿfollowingÿconditions:ÿ 1. Theÿcontrolsÿoverlap:ÿIfÿtheÿcontrolsÿareÿoverlappingÿtheyÿareÿpreventedÿfromÿmovingÿupÿwhenÿtheÿemptyÿ controlsÿshrink.ÿ 2. Theÿcontrolsÿintersectÿwithÿanotherÿcontrol:ÿifÿtheÿstackedÿcontrolsÿhaveÿanotherÿcontrolÿtoÿtheÿleftÿorÿrightÿ thatÿdoesÿnotÿlineÿup,ÿitÿwillÿstopÿtheÿcontrolsÿfromÿmovingÿup.ÿ TheÿbestÿsolutionÿisÿtoÿuseÿtheÿRemoveÿVerticalÿSpacingÿiconÿonÿtheÿ.NETÿlayoutÿtoolbar.ÿAfterÿyouÿplaceÿtheÿ controlsÿonÿtheÿreport,ÿleavingÿaÿlittleÿspaceÿbetweenÿeachÿcontrol,ÿselectÿallÿofÿtheÿcontrolsÿinÿtheÿstackÿandÿ clickÿtheÿiconÿtoÿremoveÿtheÿwhiteÿspaceÿbetweenÿthem.ÿ ÿ HowÿdoÿIÿdistributeÿtheÿassembliesÿforÿActiveReportsÿforÿ.NETÿ3.0? ThereÿareÿtwoÿwaysÿtheÿActiveReportsÿassembliesÿcanÿbeÿdeployed.ÿTheÿdecisionÿonÿwhichÿoneÿtoÿuseÿdependsÿ onÿyourÿinstallationÿmethod.ÿ 1. Ifÿyouÿareÿcopyingÿyourÿprojectÿfromÿtheÿdevelopmentÿmachineÿtoÿyourÿserver,ÿyouÿshouldÿsetÿtheÿ ActiveReportsÿreferencesÿinÿyourÿprojectÿreferencesÿtoÿCopyLocalÿ=ÿTrue.ÿThisÿwayÿtheÿActiveReportsÿ DLLsÿareÿinÿtheÿbinÿfolderÿofÿtheÿcompiledÿproject.ÿ 2. Ifÿyouÿareÿmakingÿanÿinstallerÿforÿyourÿsoftware,ÿyouÿwillÿneedÿtoÿincludeÿtheÿActiveReportsDistrib.MSMÿ fileÿincludedÿwithÿtheÿinstallationÿofÿActiveReportsÿforÿ.NETÿ3.0.ÿForÿexample,ÿitÿmayÿbeÿinstalledÿinÿtheÿ C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Deploymentÿfolder.ÿ Thereÿisÿaÿthirdÿwayÿtoÿaccomplishÿthisÿthatÿisÿnotÿgenerallyÿrecommended.ÿThereÿisÿaÿcommandÿlineÿutilityÿ thatÿyouÿcanÿuseÿtoÿinstallÿeachÿDLLÿinÿtheÿGAC.ÿTheÿformatÿisÿ'C:\ProgramÿFiles\MicrosoftÿVisualÿ Studioÿ.NET\FrameworkSDK\Bin>gacutilÿ-iÿassembly'.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ17

ÿ

Whyÿisÿmyÿcopyÿbuttonÿnotÿshowingÿupÿonÿmyÿviewer?ÿÿ YouÿneedÿtoÿincludeÿreferencesÿtoÿtheÿRtfExportÿandÿTextExportÿDLLsÿinÿorderÿtoÿenableÿtheÿcopyÿfeature.ÿÿ

InstallationÿandÿSetup

ThisÿtopicÿwillÿhelpÿyouÿfindÿoutÿwhatÿisÿnecessaryÿtoÿinstallÿActiveReportsÿandÿdirectÿyouÿtoÿappropriateÿhelpÿ forÿtheÿinstallationÿprocess. ÿ Requirements LearnÿtheÿhardwareÿandÿsoftwareÿrequiredÿtoÿinstallÿActiveReportsÿforÿ.NETÿ3.0.ÿ InstalledÿFiles FindÿoutÿwhatÿfilesÿareÿinstalledÿwithÿActiveReportsÿforÿ.NETÿ3.0.ÿ TroubleshootingÿInstallation Findÿoutÿhowÿtoÿtroubleshootÿinstallationÿissues.ÿ VerifyingÿPackageÿInstallation Findÿoutÿhowÿtoÿverifyÿsuccessfulÿinstallation.ÿ

ÿ Tip:ÿCloseÿVisualÿStudio®ÿ.NETÿbeforeÿrunningÿtheÿinstallationÿprogramÿtoÿallowÿtheÿhelpÿfilesÿtoÿbeÿ integratedÿintoÿtheÿcommonÿhelpÿcollectionÿinÿVisualÿStudio®.

HardwareÿandÿSoftwareÿRequirements

ThisÿtopicÿdetailsÿhardwareÿandÿsoftwareÿrequirementsÿforÿinstallingÿandÿusingÿActiveReportsÿforÿ.NETÿ3.0.ÿ

Hardwareÿrequirementsÿ(minimum)

l Minimumÿprocessor:ÿPentium®ÿII-classÿprocessorÿ450ÿMHzÿ ¡ Recommendedÿprocessor:ÿPentium®ÿIII-classÿprocessorÿ600ÿMHzÿ

l MinimumÿRAM:ÿ160ÿMBÿ(192ÿMBÿforÿWindows®ÿ2000ÿServer operatingÿsystem)ÿ

¡ RecommendedÿRAM:ÿ200ÿMBÿ l Minimumÿhardÿdriveÿspace:ÿ46ÿMBÿavailableÿ

¡ Recommendedÿhardÿdriveÿspace:ÿ50ÿMBÿavailable

Softwareÿrequirements l OperatingÿSystem:ÿWindows®ÿ2000,ÿWindows®ÿXPÿorÿWindows®ÿNTÿ4.0ÿ

l Microsoft®ÿ.NETÿFrameworkÿVersionÿ1.1ÿSP1ÿorÿ2.0ÿ

l MicrosoftÿVisualÿStudio®ÿ.NETÿ2003ÿorÿMicrosoftÿVisualÿStudio®ÿ.NETÿ2005ÿ Note: TheÿExpressÿEditionsÿofÿVisualÿStudioÿ.NETÿ2005ÿwillÿnot workÿwithÿActiveReports,ÿasÿtheyÿdoÿ

ÿ notÿsupportÿpackages. l ForÿWebÿdeployment:ÿIISÿ5.1ÿorÿ6.0ÿandÿASP.NETÿ(versionÿtoÿmatchÿtheÿ.NETÿFrameworkÿversion)

InstalledÿFiles

Folder/Files Description

\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0

ActiveReports3.dllÿ Run-timeÿengineÿassemblyÿfileÿ

ActiveReports.Chart.dllÿ Chartÿcontrolÿassemblyÿfileÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ18

ActiveReports.CodeDomSerializer.dll HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

ActiveReports.Design3.dllÿ Designerÿassemblyÿfileÿ

ActiveReports.HtmlExport.dllÿ HTMLÿExportÿassemblyÿfileÿ

ActiveReports.Interop.dllÿ Nativeÿfunctionsÿassemblyÿfileÿ

ActiveReports.ItemWizard.VS200*.dll Accessÿimportÿandÿnewÿitemÿwizardÿfiles

ActiveReports.PdfExport.dllÿ PDFÿExportÿassemblyÿfileÿ

ActiveReports.RtfExport.dllÿ RTFÿExportÿassemblyÿfileÿ

ActiveReports.TextExport.dllÿ TextÿExportÿassemblyÿfileÿ

ActiveReports.TiffExport.dllÿ TIFFÿExportÿassemblyÿfileÿ

ActiveReports.Viewer3.dllÿ Viewerÿassemblyÿfileÿ

ActiveReports.Web.Design.dllÿ Webÿdesignerÿassemblyÿfileÿ

ActiveReports.Web.dllÿ Webÿassemblyÿfileÿ

ActiveReports.XlsExport.dllÿ Microsoft®ÿExcel®ÿExportÿassemblyÿfileÿ

AR3Col*.*ÿ(2ÿfiles)ÿ ActiveReportsÿHelpÿIntegrationÿCollectionÿ

ARVSPackage.dllÿ VisualÿStudio®ÿ.NETÿIntegrationÿPackageÿ

COL_ActiveReports3*.*ÿ(5ÿfiles)ÿ ActiveReportsÿHelpÿIntegrationÿCollectionÿ

CustomInstaller.dll Managedÿinstallationÿhelperÿfile

CustomInstaller.InstallState Managedÿinstallationÿhelperÿfile ddARNET3.HxSÿ ActiveReportsÿHelpÿFile

H2Reg*.*ÿ(3ÿfiles)ÿ FilesÿusedÿtoÿregisterÿtheÿActiveReportsÿ helpÿcollectionÿwithÿtheÿcombinedÿhelpÿ collectionÿofÿVisualÿStudioÿ.NET

License.rtfÿ DataÿDynamicsÿActiveReportsÿLicenseÿ AgreementÿandÿLimitedÿWarrantyÿ

Microsoft.VisualStudio.Designer.Interfaces.dll HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

Microsoft.VisualStudio.DLL HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

Microsoft.VisualStudio.OLE.Interop.dll HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

Microsoft.VisualStudio.Shell.Interop.dll HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

Microsoft.VisualStudio.TextManager.Interop.dll HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration

Microsoft.VisualStudio.VSIP.Helper.DLL HelperÿfileÿforÿVisualÿStudioÿ.NETÿ integration riched20.dll Versionÿ4.0ÿofÿtheÿMicrosoft®ÿRichEditÿ control,ÿusedÿtoÿsupportÿrtfÿtablesÿinÿeditÿ modeÿofÿtheÿActiveReportsÿRichTextBoxÿ control

\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\1033

ARVSPackageUI.DLLÿ VisualÿStudioÿ.NETÿintegrationÿlocalizedÿUIÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ19

assemblyÿfileÿforÿUSÿEnglish

\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\1041

ARVSPackageUI.DLLÿ VisualÿStudioÿ.NETÿintegrationÿlocalizedÿUIÿ assemblyÿfileÿforÿJapanese

\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Wizards

WebKey.exeÿ Web.configÿkeyÿgeneratorÿ

File.ico ImageÿfileÿforÿtheÿReportÿicon

\Data

NWIND.mdb Samplesÿdatabaseÿfileÿ

\Deployment

ActiveReportsDistrib.msmÿ ActiveReportsÿmergeÿmoduleÿfileÿ arview2.cabÿ ActiveX®ÿviewerÿcabÿfileÿ

\Introduction

*.gifÿandÿ*.icoÿ(8ÿfiles) Readmeÿimageÿfiles readme.htaÿ ActiveReportsÿReadmeÿfileÿ

\Localization

ARDesigner.zip FilesÿusedÿforÿlocalizingÿtheÿEndÿUserÿ ReportÿDesignerÿcontrolÿ

AREngine.zip Filesÿusedÿforÿlocalizingÿtheÿreportÿengineÿ

ARVSPackage.zip FilesÿusedÿforÿlocalizingÿVisualÿStudioÿ integration

Chart.zip Filesÿusedÿforÿlocalizingÿtheÿchart

ExcelExport.zip FilesÿusedÿforÿlocalizingÿtheÿExcelÿexport

HtmlExport.zip FilesÿusedÿforÿlocalizingÿtheÿHTMLÿexport

ItemWizard2003.zip FilesÿusedÿforÿlocalizingÿtheÿAccessÿimportÿ andÿnewÿitemÿwizards

ItemWizard2005.zip FilesÿusedÿforÿlocalizingÿtheÿAccessÿimportÿ andÿnewÿitemÿwizards

PdfExport.zip FilesÿusedÿforÿlocalizingÿtheÿPDFÿexport publickey.snkÿ Strongÿnameÿkeyÿfileÿusedÿinÿlocalizingÿtheÿ ReportÿEngine,ÿEndÿUserÿReportÿDesigner,ÿ andÿViewerÿ

RtfExport.zip FilesÿusedÿforÿlocalizingÿtheÿRTFÿexport

Satellite.chm HelpÿfileÿforÿtheÿSatelliteÿAssemblyÿutility

SatelliteAssembly.exeÿ Utilityÿwhichÿcreatesÿsatelliteÿassembliesÿ forÿlocalizingÿtheÿReportÿEngine,ÿEndÿUserÿ ReportÿDesigner,ÿandÿViewerÿ

TextExport.zip FilesÿusedÿforÿlocalizingÿtheÿTextÿexport

TiffExport.zip FilesÿusedÿforÿlocalizingÿtheÿTIFFÿexport

Viewer.zip FilesÿusedÿforÿlocalizingÿtheÿViewerÿcontrolÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ20

Web.zip FilesÿusedÿforÿlocalizingÿtheÿWebÿViewerÿ controlÿ

WebDesign.zip FilesÿusedÿforÿlocalizingÿtheÿWebÿViewerÿ controlÿdesignerÿforÿuseÿinÿVisualÿStudio

\Samples

CSharp\*.*ÿ VisualÿC#®ÿsampleÿprojectsÿ

ÿ VB\*.*ÿ VisualÿBasic®ÿsampleÿprojectsÿ

TroubleshootingÿInstallation

Whyÿcan'tÿotherÿusersÿaccessÿorÿuseÿActiveReportsÿonÿmyÿmachine? TheÿinstallationÿforÿActiveReportsÿforÿ.NETÿ3.0ÿgivesÿtheÿuserÿtheÿoptionÿtoÿinstallÿtheÿprogramÿforÿeveryoneÿorÿ theÿcurrentÿuser.ÿIfÿitÿisÿinstalledÿonlyÿforÿtheÿcurrentÿuser,ÿotherÿusersÿonÿtheÿsameÿmachineÿwillÿnotÿbeÿableÿ toÿaccessÿitÿorÿuseÿit.ÿ IÿjustÿinstalledÿActiveReportsÿforÿ.NETÿ3.0.ÿWhyÿcan'tÿIÿseeÿtheÿhelpÿfiles? IfÿtheÿinstallationÿwasÿrunÿwhileÿVisualÿStudio®ÿwasÿopen,ÿtheÿhelpÿfilesÿwillÿnotÿbeÿintegratedÿuntilÿtheÿuserÿ exitsÿVisualÿStudio ®ÿandÿreopensÿit. WhyÿdoÿIÿget,ÿ"TheÿinstallerÿwasÿinterruptedÿbeforeÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿ couldÿbeÿinstalled.ÿYouÿneedÿtoÿrestartÿtheÿinstallerÿtoÿtryÿagain"ÿwhenÿIÿrunÿtheÿActiveReportsÿ Setup? Theÿmostÿlikelyÿcauseÿforÿthisÿerrorÿisÿaÿpermissionsÿissue.ÿEitherÿtheÿfolderÿtheÿsetupÿisÿpointingÿtoÿorÿtheÿ folderÿcontainingÿtheÿsetupÿfilesÿdoesÿnotÿhaveÿtheÿcorrectÿpermissions.ÿTheÿuserÿneedsÿtoÿverifyÿthatÿtheÿ systemÿaccountÿforÿtheÿlocalÿmachineÿhasÿpermissionsÿtoÿtheÿfolderÿcontainingÿtheÿsetupÿandÿverifyÿthatÿtheÿÿ userÿinstallingÿtheÿprogramÿhasÿtheÿappropriateÿpermissions.

VerifyingÿPackageÿInstallation

Toÿverifyÿpackageÿinstallation 1. OpenÿVisualÿStudio®ÿ.NET.ÿ 2. YouÿshouldÿseeÿtheÿActiveReportsÿlogoÿonÿtheÿsplashÿscreen.ÿ

3.ÿ OpenÿtheÿHelp >ÿAbout dialogÿandÿverifyÿtheÿ"DataÿDynamicsÿActiveReports"ÿentryÿinÿtheÿinstalledÿ productsÿlist.ÿ

UpgradingÿReports

ActiveReportsÿallowsÿyouÿtoÿupgradeÿyourÿreportsÿfromÿotherÿversionsÿofÿActiveReportsÿandÿotherÿreportingÿ programs.ÿ ChangesÿBetweenÿActiveReportsÿ2.0ÿandÿActiveReportsÿforÿ.NET FindÿoutÿaboutÿchangesÿbetweenÿActiveReportsÿ2.0ÿandÿActiveReportsÿforÿ.NET.ÿ ConvertingÿMicrosoft®ÿAccess®ÿReports FindÿoutÿaboutÿconvertingÿMicrosoft®ÿAccess®ÿreportsÿtoÿActiveReports.ÿ MigratingÿfromÿActiveReportsÿ2.0 FindÿoutÿhowÿtoÿmigrateÿreportsÿfromÿActiveReportsÿ2.0.ÿ

UpgradingÿReportsÿCreatedÿwithÿPreviousÿVersionsÿofÿActiveReportsÿforÿ.NETÿ FindÿoutÿhowÿtoÿupgradeÿreportsÿcreatedÿwithÿActiveReportsÿforÿ.NETÿ1.0ÿandÿActiveReportsÿ2.0ÿtoÿ ActiveReportsÿforÿ.NETÿ3.0.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ21

ChangesÿBetweenÿActiveReportsÿ2.0ÿandÿActiveReportsÿforÿ.NET

ReportÿClasses DataÿDynamicsÿattemptedÿtoÿkeepÿtoÿaÿminimumÿtheÿnumberÿofÿchangesÿtoÿtheÿreportÿobjectÿmodelÿfromÿ ActiveReportsÿ2.0.ÿÿMostÿofÿtheÿchangesÿareÿdueÿtoÿclassÿrefactoringÿandÿrenamingÿofÿobjectsÿandÿmembersÿtoÿ closelyÿmatchÿtheÿ.NETÿFrameworkÿnamingÿconventions.ÿÿListedÿbelowÿareÿtheÿsignificantÿchangesÿinÿtheÿ objectÿmodel. 1. ActiveReport.Showÿremoved:ÿActiveReportsÿclassÿisÿnoÿlongerÿaÿWindowÿclass.ÿThisÿrequiresÿusingÿtheÿ viewerÿcontrolÿtoÿpreviewÿtheÿoutputÿofÿaÿreport.ÿ 2. Strong-typedÿSectionÿclasses:ÿÿActiveReportsÿforÿ.NETÿincludesÿclassesÿforÿeachÿofÿtheÿsectionÿtypesÿwithÿ theirÿownÿuniqueÿproperties.ÿÿTheÿoldÿSectionÿobjectÿisÿstillÿavailableÿandÿtheÿSectionCollectionÿclassÿholdsÿ itemsÿofÿtheÿSectionÿtype.ÿÿTheÿnewÿsectionÿclassesÿareÿDetail,ÿGroupHeader,ÿGroupFooter,ÿPageHeader,ÿ PageFooter,ÿReportHeaderÿandÿReportFooter.ÿ 3. NewÿStylesheetÿclass:ÿÿProvidesÿaccessÿtoÿtheÿstylesÿdefinedÿinÿtheÿreportÿandÿallowsÿyouÿtoÿchangeÿtheÿ individualÿstyleÿitemÿproperties.ÿ 4. ImageÿcontrolÿrenamedÿtoÿPicture.ÿ 5. FieldÿcontrolÿrenamedÿtoÿTextbox.ÿ 6. Supportedÿjustifiedÿtextÿalignmentÿoptionÿforÿtextboxesÿandÿlabels.ÿ 7. IndirectÿsupportÿofÿActiveX®ÿcontrolsÿthroughÿ.NETÿwrappersÿandÿtheÿnewÿCustomControlÿclass.ÿ 8. Threeÿaddedÿdataÿsourceÿclassesÿwhichÿreplaceÿtheÿdataÿcontrols:ÿÿOleDbDataSource,ÿXmlDataSourceÿandÿ SqlClientDataSource.ÿ 9. SplitÿPagesÿcollection:ÿÿtheÿPagesÿclassÿfromÿActiveReportsÿ2.0ÿisÿrefactoredÿintoÿaÿPagesCollectionÿclassÿ andÿaÿDocumentÿclass.ÿÿTheÿnewÿDocumentÿclassÿcontainsÿallÿtheÿmembersÿtoÿsaveÿorÿloadÿRDFÿfilesÿandÿ streams.ÿ 10. Changedÿmeasurementsÿfromÿtwipsÿtoÿinches. 11. Frameÿcontrolÿhasÿbeenÿremoved.ÿ

Printing 1. AddedÿPrintControllerÿandÿPrintControllerWithStatusÿclassesÿtoÿmakeÿtheÿprintingÿmodelÿsimilarÿtoÿ theÿ.NETÿFramework.ÿ 2. Useÿofÿtheÿ.NETÿFrameworkÿPrinterÿandÿPrinterSettingsÿclassesÿbyÿtheÿviewerÿcontrol.ÿÿAnÿoptionalÿ•ÿ unsafe•ÿprinterÿclassÿisÿalsoÿincludedÿforÿadvancedÿprintingÿandÿprintÿjobÿcontrolÿsimilarÿtoÿtheÿ ActiveReportsÿ2.0ÿclass.ÿ 3. CallingÿDocument.Printÿwillÿnoÿlongerÿrunÿtheÿreport.ÿÿTheÿreportÿmustÿbeÿrunÿbeforeÿattemptingÿtoÿprintÿ theÿdocument.

Viewer 1. Aÿrewrittenÿreportÿviewerÿcontrolÿtoÿtakeÿfullÿadvantageÿofÿtheÿ.NETÿFrameworkÿclasses.ÿ 2. CompleteÿrevisionÿofÿtheÿToolbarÿandÿToolsÿclasses.ÿ 3. SeparationÿofÿtheÿTableÿofÿContentsÿtreeÿcontrolÿfromÿtheÿTOCÿcollectionÿ(renamedÿtoÿ

ÿ BookmarksCollection).ÿ 4. NoÿbindingÿofÿtheÿviewerÿcontrolÿtoÿanÿActiveReportÿobject.ÿInstead,ÿitÿbindsÿtoÿaÿDocumentÿobject.ÿ

ConvertingÿMicrosoftÿAccessÿReports

Microsoft®ÿAccess®ÿreportsÿcanÿbeÿeasilyÿconvertedÿintoÿActiveReportsÿformatÿbyÿrunningÿtheÿActiveReportsÿ MicrosoftÿAccessÿImportÿWizard.ÿDueÿtoÿdifferencesÿbetweenÿproducts,ÿtheÿextentÿtoÿwhichÿyourÿreportsÿwillÿ beÿconvertedÿwillÿdependÿonÿyourÿspecificÿreportÿlayout.ÿHowever,ÿsinceÿDataÿDynamicsÿprovidesÿsourceÿcode,ÿ youÿcanÿmodifyÿtheÿresultingÿActiveReportÿtoÿachieveÿtheÿresultsÿyouÿdesire.

ToÿconvertÿaÿMicrosoft®ÿAccess®ÿreportÿintoÿanÿActiveReportÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ22

1. OpenÿaÿprojectÿinÿVisualÿStudio®.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem. 3. Selectÿ"ActiveReportsÿAccessÿWizard"ÿfromÿtheÿTemplatesÿpaneÿofÿtheÿ"AddÿNewÿItem"ÿdialogÿandÿclickÿ Open.ÿ

ÿ 4. ClickÿtheÿellipsisÿbuttonÿbuttonÿtoÿbrowseÿforÿtheÿAccessÿDatabaseÿthatÿcontainsÿtheÿreportÿorÿreportsÿyouÿ wantÿtoÿconvert.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ23

ÿ 5. OnceÿyouÿhaveÿselectedÿtheÿdatabaseÿfileÿclickÿOpen.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ24

ÿ 6. Ifÿyouÿreceiveÿaÿsecurityÿwarning,ÿclickÿOpen toÿproceed.ÿ 7. SelectÿtheÿreportsÿfromÿtheÿdatabaseÿthatÿyouÿwantÿtoÿimportÿandÿclickÿNext.ÿÿ

ÿ 8. ClickÿNext toÿbeginÿtheÿconversionÿprocess.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ25

ÿ 9. ClickÿOpen toÿproceedÿthroughÿanyÿsecurityÿwarnings.ÿ 10. ClickÿFinish whenÿtheÿconversionÿprocessÿhasÿfinished.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ26

ÿ TheÿconvertedÿreportsÿnowÿappearÿinÿtheÿSolutionÿExplorer.

ÿ

MigratingÿfromÿActiveReportsÿ2.0

ActiveReportsÿforÿ.NETÿ3.0ÿcanÿuseÿexistingÿActiveReportsÿ2.0ÿreportÿlayoutÿfilesÿ(RPX)ÿafterÿsomeÿ modificationsÿtoÿtheÿscriptingÿcode.ÿÿActiveReportsÿ2.0ÿdesignerÿfilesÿ(DSR/DSX)ÿmustÿbeÿsavedÿasÿRPXÿfilesÿinÿ theÿActiveReportsÿ2.0ÿDesignerÿbeforeÿtheyÿcanÿbeÿimportedÿintoÿActiveReports.ÿSinceÿActiveReportsÿdoesÿnotÿ importÿanyÿVisualÿBasicÿ ®ÿorÿscriptingÿcodeÿintoÿ.NET,ÿtheÿcodeÿwillÿneedÿtoÿbeÿrewrittenÿusingÿtheÿappropriateÿ languageÿinÿtheÿnewÿ.NETÿenvironment.

UpgradingÿReportsÿCreatedÿwithÿPreviousÿVersionsÿofÿActiveReportsÿ forÿ.NET

BecauseÿActiveReportsÿforÿ.NETÿ3.0ÿwritesÿitsÿreportÿlayoutÿfilesÿinÿC#ÿorÿVisualÿBasicÿforÿ.NETÿandÿtheÿ nomenclatureÿofÿtheÿActiveReports,ÿActiveReports.Viewer,ÿandÿActiveReports.DesignÿDLLsÿhaveÿchangedÿ toÿActiveReports3,ÿActiveReports.Viewer3,ÿandÿActiveReports.Design3ÿrespectively,ÿreportsÿthatÿwereÿbuiltÿ withÿActiveReportsÿforÿ.NETÿ1.0ÿandÿActiveReportsÿforÿ.NETÿ2.0ÿwillÿneedÿtoÿbeÿconvertedÿtoÿrunÿinÿtheÿnewÿ environment.ÿActiveReportsÿforÿ.NETÿ3.0ÿincludesÿaÿconverterÿthatÿmakesÿthisÿanÿeasyÿprocess.ÿ

ToÿconvertÿanÿActiveReportsÿforÿ.NETÿ1.0ÿorÿ2.0ÿprojectÿintoÿanÿActiveReportsÿforÿ.NETÿ3.0ÿproject Note: Alwaysÿbackÿupÿyourÿprojectsÿbeforeÿbeginningÿtheÿconversionÿprocess. 1. OpenÿanÿexistingÿActiveReportsÿforÿ.NETÿ1.0ÿorÿ2.0ÿprojectÿinÿVisualÿStudio®.ÿTheÿreportÿappearsÿinÿtheÿ SolutionÿExplorerÿasÿanÿRPXÿfile.ÿIfÿyouÿopenÿtheÿfileÿinÿtheÿIDE,ÿyouÿwillÿseeÿtheÿXMLÿthatÿmakesÿupÿtheÿ report'sÿlayout,ÿbutÿwillÿnotÿbeÿableÿtoÿviewÿtheÿdesignerÿorÿrunÿtheÿproject.ÿ 2. Clickÿon Tools >ÿConvertÿActiveReportsÿtoÿopenÿtheÿActiveReportsÿforÿ.NETÿReportÿConverter.ÿ TheÿconverterÿdisplaysÿaÿlistÿofÿallÿRPXÿfilesÿinÿyourÿproject.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ27

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ28

ÿ 3. ToÿconvertÿtheÿfilesÿclickÿOK.ÿTheÿreportsÿnowÿappearÿinÿtheÿSolutionÿExplorerÿasÿC#ÿorÿVisualÿBasicÿ forÿ.NETÿfilesÿandÿallÿreferencesÿtoÿearlierÿversionsÿofÿActiveReportsÿforÿ.NETÿDLLsÿhaveÿbeenÿupdated.ÿÿ Note: TheÿnamingÿconventionÿforÿcontrolsÿhasÿchangedÿfromÿpreviousÿeditionsÿofÿActiveReportsÿ forÿ.NET.ÿPreviouslyÿcontrolsÿcouldÿbeÿsimilarlyÿnamed,ÿasÿinÿ"Test"ÿandÿ"test,"ÿbutÿActiveReportsÿ forÿ.NETÿ3.0ÿrequiresÿcontrolÿnamesÿtoÿbeÿunique.ÿThusÿwhenÿloadingÿanÿRPXÿthatÿhasÿtwoÿcontrolsÿwithÿ ÿ theÿsameÿnamesÿbutÿdifferentÿcases,ÿtheÿreportÿwillÿnotÿloadÿandÿanÿerrorÿwillÿbeÿraised.ÿInÿorderÿtoÿ avoidÿthis,ÿgiveÿeachÿcontrolÿaÿuniqueÿname.ÿ

ArchitectureÿandÿConcepts

ThisÿtopicÿintroducesÿyouÿtoÿtheÿbasicÿstructureÿandÿconceptsÿofÿActiveReportsÿforÿ.NETÿ3.0ÿtoÿenableÿefficientÿ reportÿcreation. ÿ Charts ÿ Learnÿaboutÿtheÿavailableÿchartÿtypes,ÿdata,ÿandÿcustomizingÿtheÿappearanceÿofÿcharts.ÿ Events LearnÿhowÿsectionÿeventsÿworkÿinÿActiveReports.ÿ RaisingÿSequenceÿofÿEvents LearnÿhowÿprocessingÿeventsÿworkÿinÿActiveReports.ÿ Hyperlinks LearnÿhowÿhyperlinksÿcanÿbeÿusedÿinÿActiveReports.ÿ Inheritance LearnÿhowÿtoÿcreateÿaÿbaseÿclassÿfromÿanÿActiveReportÿtoÿsetÿupÿaÿtemplateÿreportÿfromÿwhichÿotherÿ reportsÿcanÿinherit.ÿ LayoutÿFiles Learnÿaboutÿlayoutÿfiles.ÿ Localization ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ29

Learnÿhowÿtoÿlocalizeÿtheÿviewerÿcontrol.ÿ OutputFormatÿStrings LearnÿaboutÿOutputFormatÿstrings.ÿ Parameters Learnÿhowÿparametersÿfunctionÿforÿsimpleÿreportsÿandÿsubreports.ÿ ReportÿandÿPageÿSettings LearnÿhowÿtoÿaccessÿreportÿandÿpageÿsettingsÿinÿActiveReports.ÿ ReportÿExecution LearnÿaboutÿreportÿexecutionÿinÿActiveReports.ÿ ReportÿStructure LearnÿaboutÿtheÿstructureÿofÿActiveReports.ÿ RichText LearnÿaboutÿtheÿnewÿRichTextÿfeatures,ÿandÿwhichÿHTMLÿtagsÿareÿsupportedÿinÿtheÿcontrol.ÿ Scripting ÿ LearnÿhowÿtoÿuseÿscriptingÿwithÿActiveReports.ÿ

Charts

FollowÿtheÿlinksÿbelowÿforÿinformationÿaboutÿconceptsÿessentialÿtoÿtheÿuseÿofÿtheÿChartÿcontrol. ChartÿTypes ShowsÿexamplesÿofÿCommonÿCharts,ÿ3DÿCharts,ÿXYÿCharts,ÿandÿFinancialÿCharts.ÿ ChartÿData Discussesÿwaysÿofÿconnectingÿaÿchartÿtoÿdata.ÿ ChartÿAppearance CoversÿChartÿEffects,ÿChartÿControlÿItems,ÿandÿChartÿAxesÿandÿWalls.ÿ Chart-SpecificÿProperties ÿ ExplainsÿtheÿuseÿofÿpropertiesÿspecificÿtoÿeachÿChartÿType.

ChartÿTypes

TheseÿtopicsÿintroduceÿyouÿtoÿtheÿdifferentÿChartÿTypesÿyouÿcanÿcreateÿwithÿtheÿChartÿcontrol.ÿ CommonÿChartsÿ Area,ÿBar2D,ÿBezier,ÿDoughnut/Pie,ÿLine,ÿScatter,ÿStackedArea,ÿStackedBar,ÿStackedArea100Pct,ÿandÿ StackedBar100Pctÿ 3DÿChartsÿ Area3D,ÿBar3D,ÿClusteredBar,ÿLine3D,ÿDoughnut3D/Pie,ÿStackedBar3D,ÿandÿStackedBar3D100Pctÿ XYÿChartsÿ Bubble,ÿBubbleXY,ÿLineXY,ÿandÿPlotXYÿ FinancialÿChartsÿ ÿ Candle,ÿHiLo,ÿandÿHiLoOpenCloseÿ

CommonÿCharts

TheseÿtopicsÿtakeÿyouÿthroughÿsomeÿofÿtheÿcommonÿchartÿtypesÿthatÿyouÿcanÿcreateÿwithÿtheÿChartÿcontrol. AreaÿCharts LearnÿaboutÿtheÿfeaturesÿofÿanÿAreaÿChart.ÿ Bar2DÿCharts ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ30

LearnÿaboutÿtheÿfeaturesÿofÿaÿBar2DÿChart.ÿ BezierÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿBezierÿChart.ÿ Doughnut/PieÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿDoughnutÿorÿPieÿChart.ÿ HorizontalBarÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿHorizontalBarÿChart.ÿ LineÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿLineÿChart.ÿ ScatterÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿScatterÿChart.ÿ StackedAreaÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedAreaÿChart.ÿ StackedBarÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedBarÿChart.ÿ StackedArea100PctÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedArea100PctÿChart.ÿ StackedBar100PctÿCharts ÿ LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedBar100PctÿChart.ÿ

AreaÿCharts

Useÿanÿareaÿchartÿtoÿcompareÿtrendsÿoverÿaÿperiodÿofÿtimeÿorÿinÿspecificÿcategories.

ÿ

GraphÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

ÿ CustomÿProperties Noneÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ31

Barÿ2DÿCharts

Useÿaÿbarÿchartÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategories.

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeach CustomÿProperties Xÿaxisÿvalueÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿbarÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ50.0F

//ÿC#ÿ this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ50f;

BezierÿCharts

UseÿaÿBezierÿorÿsplineÿchartÿtoÿcompareÿtrendsÿoverÿaÿperiodÿofÿtimeÿorÿinÿcertainÿcategories.ÿItÿisÿaÿlineÿchartÿ thatÿplotsÿcurvesÿthroughÿtheÿdataÿpointsÿinÿaÿseries. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ32

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

CustomÿProperties Noneÿ

ÿ

ÿ

DoughnutÿandÿPieÿCharts

Aÿdoughnutÿchartÿshowsÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿtheÿtotal. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ33

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

ExplodeFactor getsÿorÿsetsÿtheÿamountÿofÿseparationÿbetweenÿdataÿ pointÿvalues. HoleSize getsÿorÿsetsÿtheÿinnerÿradiusÿofÿtheÿchart. OutsideLabels getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿ pointÿlabelsÿappearÿoutsideÿtheÿchart. CustomÿProperties StartAngle getsÿorÿsetsÿtheÿhorizontalÿstartÿangleÿforÿtheÿseries.ÿ

ÿ Inÿorderÿtoÿshowÿeachÿsectionÿofÿtheÿpieÿinÿaÿdifferentÿcolor,ÿtheÿBackgroundÿpropertyÿforÿeachÿdataÿpointÿ mustÿbeÿset.ÿBelowÿisÿanÿexampleÿofÿsettingÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿdoughnutÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("ExplodeFactor")ÿ=ÿ0.0F Me.ChartControl1.Series(0).Properties("HoleSize")ÿ=ÿ0.25F Me.ChartControl1.Series(0).Properties("OutsideLabels")ÿ=ÿFalse Me.ChartControl1.Series(0).Properties("StartAngle")ÿ=ÿ0.0F ÿ //ÿC# this.ChartControl1.Series[0].Properties["ExplodeFactor"]ÿ=ÿ0f; this.ChartControl1.Series[0].Properties["HoleSize"]ÿ=ÿ0.25f; this.ChartControl1.Series[0].Properties["OutsideLabels"]ÿ=ÿfalse; this.ChartControl1.Series[0].Properties["StartAngle"]ÿ=ÿ0f;ÿ ÿ

GanttÿCharts ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ34

TheÿGanttÿchartÿisÿaÿprojectÿmanagementÿtoolÿusedÿtoÿchartÿtheÿprogressÿofÿindividualÿprojectÿtasks.ÿTheÿ chartÿcomparesÿprojectÿtaskÿcompletionÿtoÿtheÿtaskÿschedule.

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 2ÿ point

#ÿofÿSeries 1ÿorÿmore

MarkerÿSupport SeriesÿorÿDataÿPoint

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties value.

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿGanttÿchart. 'VisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ50.0F

//C# this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ50f;

ÿ Note: InÿaÿGanttÿchartÿtheÿXÿandÿYÿaxesÿareÿreversed.ÿAxisXÿisÿverticalÿandÿAxisYÿisÿhorizontal.

HorizontalÿBarÿCharts

Useÿaÿhorizontalÿbarÿchartÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategoriesÿwithÿtheÿaxesÿreversed. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ35

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties value.

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿhorizontalÿbarÿchartÿasÿshownÿ above. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ65.0F

//ÿC#ÿ this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ65f;

LineÿCharts

Useÿaÿlineÿchartÿtoÿcompareÿtrendsÿoverÿaÿperiodÿofÿtimeÿorÿinÿcertainÿcategories. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ36

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

CustomÿProperties Noneÿ

ÿ

ÿ

ScatterÿCharts

Useÿaÿscatterÿchartÿtoÿcompareÿvaluesÿacrossÿcertainÿcategories. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ37

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

CustomÿProperties Noneÿ

ÿ

ÿ

StackedAreaÿCharts

Aÿstackedÿareaÿchartÿisÿanÿareaÿchartÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿoneÿonÿtopÿofÿtheÿother.ÿUseÿthisÿ chartÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotal. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ38

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

CustomÿProperties Noneÿ

ÿ

ÿ

StackedBarÿCharts

Aÿstackedÿbarÿchartÿisÿaÿbarÿchartÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿoneÿonÿtopÿofÿtheÿother.ÿUseÿthisÿ chartÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotal. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ39

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties valueÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿStackedBarÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ100.0F

//ÿC# this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ100f;ÿ ÿ

StackedArea100PctÿCharts

Aÿstackedÿareaÿ100%ÿchartÿisÿanÿareaÿchartÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿoneÿonÿtopÿofÿtheÿotherÿtoÿ sumÿupÿtoÿ100%.ÿUseÿthisÿchartÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotalÿwithÿtheÿrelativeÿsizeÿofÿeachÿ seriesÿrepresentingÿitsÿcontributionÿtoÿtheÿtotal.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ40

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

ÿ CustomÿProperties Noneÿ

StackedBar100PctÿCharts

AÿStackedBar100Pctÿchartÿisÿaÿbarÿchartÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿoneÿonÿtopÿofÿtheÿotherÿtoÿsumÿ upÿtoÿ100%.ÿUseÿthisÿchartÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotalÿwithÿtheÿrelativeÿsizeÿofÿeachÿ seriesÿrepresentingÿitsÿcontributionÿtoÿtheÿtotal.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ41

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties valueÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿStackedBar100Pctÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ100.0F

//ÿC#ÿ this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ100f;

3DÿCharts

TheseÿtopicsÿtakeÿyouÿthroughÿsomeÿofÿtheÿthreeÿdimensionalÿchartÿtypesÿthatÿyouÿcanÿcreateÿwithÿtheÿChartÿ control.ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿopenÿtheÿChartAreaÿCollectionÿdialog,ÿandÿinÿtheÿProjectionÿ section,ÿchangeÿtheÿProjectionTypeÿfromÿIdenticalÿtoÿOrthogonal.ÿ Area3DÿCharts LearnÿaboutÿtheÿfeaturesÿofÿanÿArea3DÿChart.ÿ Bar3DÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿBar3DÿChart.ÿ ClusteredBarÿCharts ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ42

LearnÿaboutÿtheÿfeaturesÿofÿaÿClusteredBarÿChart.ÿ HorizontalBar3DÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿHorizontalBar3DÿChart.ÿ Line3DÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿLine3DÿChart.ÿ Doughnut3D/PieÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿDoughnut3DÿChart.ÿ StackedBar3DÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedBar3DÿChart.ÿ StackedBar3D100PctÿCharts ÿ LearnÿaboutÿtheÿfeaturesÿofÿaÿStackedBar3D100PctÿChart.ÿ

Area3DÿCharts

Useÿaÿ3Dÿareaÿchartÿtoÿcompareÿtrendsÿinÿtwoÿorÿmoreÿdataÿseriesÿoverÿaÿperiodÿofÿtimeÿorÿinÿspecificÿ categories,ÿallowingÿtheÿdataÿtoÿbeÿviewedÿsideÿbyÿside.

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection. ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

LineBackdrop getsÿorÿsetsÿtheÿbackdropÿinformation ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ43

forÿtheÿ3Dÿline. Thickness getsÿorÿsetsÿtheÿthicknessÿof theÿ3Dÿline. CustomÿProperties Width getsÿorÿsetsÿtheÿwidthÿofÿtheÿ3Dÿline.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿareaÿchartÿasÿshownÿforÿtheÿ firstÿseriesÿinÿtheÿimageÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("LineBackdrop")ÿ=ÿNewÿBackdrop(Color.Red,ÿCType(150,ÿ_ Byte)) Me.ChartControl1.Series(0).Properties("Thickness")ÿ=ÿ5.0F Me.ChartControl1.Series(0).Properties("Width")ÿ=ÿ30.0F

//ÿC# this.ChartControl1.Series[0].Properties["LineBackdrop"]ÿ=ÿnewÿBackdrop(Color.Red,ÿ((System.ÿ_ Byte)(150))); this.ChartControl1.Series[0].Properties["Thickness"]ÿ=ÿ5f;ÿ this.ChartControl1.Series[0].Properties["Width"]ÿ=ÿ30f;

Bar3DÿCharts

Useÿaÿ3Dÿbarÿchartÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategories,ÿallowingÿtheÿdataÿtoÿbeÿviewedÿconvenientlyÿ inÿaÿ3Dÿformat.

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection. ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ44

point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

BarTopPercent getsÿorÿsetsÿtheÿpercentageÿofÿtheÿtop ofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿBarTypes. BarType getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿisÿdisplayed. Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ value. RotationAngle getsÿorÿsetsÿtheÿstartingÿhorizontalÿangleÿfor customÿ3Dÿbarÿshapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿ BarType. VertexNumber getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdata point,ÿusedÿtoÿcreateÿcustomÿ3Dÿbarÿshapes.ÿCanÿonlyÿbeÿusedÿ withÿtheÿCustom CustomÿProperties BarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿbarÿchartÿasÿshownÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("BarTopPercent")ÿ=ÿ80.0F Me.ChartControl1.Series(0).Properties("BarType")ÿ=ÿBarType.Custom Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ65.0F Me.ChartControl1.Series(0).Properties("RotationAngle")ÿ=ÿ0.0F Me.ChartControl1.Series(0).Properties("VertexNumber")ÿ=ÿ6

//ÿC# this.ChartControl1.Series[0].Properties["BarTopPercent"]ÿ=ÿ80f; this.ChartControl1.Series[0].Properties["BarType"]ÿ=ÿBarType.Custom; this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ65f; this.ChartControl1.Series[0].Properties["RotationAngle"]ÿ=ÿ0f;ÿ this.ChartControl1.Series[0].Properties["VertexNumber"]ÿ=ÿ6;

ClusteredBarÿCharts

Useÿaÿ3Dÿclusteredÿbarÿchartÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategories,ÿallowingÿtheÿdataÿtoÿbeÿviewedÿ convenientlyÿinÿaÿ3Dÿformat. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ45

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection. ÿ

ChartÿInformation

#ÿofÿYÿ 1ÿ values/dataÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

BarTopPercent getsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿ shownÿforÿConeÿorÿCustomÿBarTypes. BarType getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed. Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue. RotationAngle getsÿorÿsetsÿtheÿstartingÿhorizontalÿangleÿforÿcustomÿ3Dÿ barÿshapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿBarType. VertexNumber getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdataÿpoint,ÿ Customÿ usedÿtoÿcreateÿcustomÿ3Dÿbarÿshapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿ Properties CustomÿBarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿclusteredÿbarÿchartÿasÿshownÿ above. 'ÿVisualÿBasic 'ÿsetÿtheÿcustomÿpropertiesÿforÿseriesÿ1 Me.ChartControl1.Series(0).Properties("BarTopPercent")ÿ=ÿ50.0F Me.ChartControl1.Series(0).Properties("BarType")ÿ=ÿBarType.Custom Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ300.0F Me.ChartControl1.Series(0).Properties("RotationAngle")ÿ=ÿ0.0F Me.ChartControl1.Series(0).Properties("VertexNumber")ÿ=ÿ6 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ46

'ÿsetÿtheÿcustomÿpropertiesÿforÿseriesÿ2 Me.ChartControl1.Series(1).Properties("BarTopPercent")ÿ=ÿ20.0F Me.ChartControl1.Series(1).Properties("BarType")ÿ=ÿBarType.Custom Me.ChartControl1.Series(1).Properties("Gap")ÿ=ÿ300.0F Me.ChartControl1.Series(1).Properties("RotationAngle")ÿ=ÿ90.0F Me.ChartControl1.Series(1).Properties("VertexNumber")ÿ=ÿ3

//ÿC# //ÿsetÿtheÿcustomÿpropertiesÿforÿseriesÿ1 this.ChartControl1.Series[0].Properties["BarTopPercent"]ÿ=ÿ50f; this.ChartControl1.Series[0].Properties["BarType"]ÿ=ÿBarType.Custom; this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ300f; this.ChartControl1.Series[0].Properties["RotationAngle"]ÿ=ÿ0f; this.ChartControl1.Series[0].Properties["VertexNumber"]ÿ=ÿ6;

//ÿsetÿtheÿcustomÿpropertiesÿforÿseriesÿ2 this.ChartControl1.Series[1].Properties["BarTopPercent"]ÿ=ÿ20f; this.ChartControl1.Series[1].Properties["BarType"]ÿ=ÿBarType.Custom; this.ChartControl1.Series[1].Properties["Gap"]ÿ=ÿ300f; this.ChartControl1.Series[1].Properties["RotationAngle"]ÿ=ÿ90f;ÿ this.ChartControl1.Series[1].Properties["VertexNumber"]ÿ=ÿ3;

Doughnut3DÿPieÿCharts

Aÿ3Dÿdoughnutÿchartÿshowsÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿaÿtotalÿpercentage,ÿallowingÿ theÿdataÿtoÿbeÿviewedÿinÿaÿ3Dÿformat.

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection.ÿ ÿ

ChartÿInformation

#ÿofÿYÿ 1ÿ values/dataÿ point

#ÿofÿSeries 1ÿ

Markerÿ SeriesÿorÿDataÿPointÿ Support ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ47

ExplodeFactor getsÿorÿsetsÿtheÿamountÿofÿseparationÿbetweenÿdataÿ pointÿvalues.ÿTheÿvalueÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1.ÿToÿexplodeÿoneÿ sectionÿofÿtheÿdoughnutÿchart,ÿsetÿExplodeFactorÿonÿtheÿdataÿpointÿ insteadÿofÿonÿtheÿseries. HoleSize getsÿorÿsetsÿtheÿinnerÿradiusÿofÿtheÿchart.ÿIfÿsetÿtoÿ0,ÿtheÿchartÿ willÿlookÿlikeÿaÿpieÿchart.ÿTheÿvalueÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1. OutsideLabels getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿpointÿ labelsÿappearÿoutsideÿofÿtheÿgraph. Customÿ StartAngle getsÿorÿsetsÿtheÿhorizontalÿstartÿangleÿforÿtheÿseriesÿdataÿ Properties points.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿdoughnutÿchartÿasÿshownÿinÿ theÿimageÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("ExplodeFactor")ÿ=ÿ0.0F Me.ChartControl1.Series(0).Properties("HoleSize")ÿ=ÿ0.33F Me.ChartControl1.Series(0).Properties("OutsideLabels")ÿ=ÿFalse Me.ChartControl1.Series(0).Properties("StartAngle")ÿ=ÿ50.0F

//ÿC# this.ChartControl1.Series[0].Properties["ExplodeFactor"]ÿ=ÿ0f; this.ChartControl1.Series[0].Properties["HoleSize"]ÿ=ÿ.33f; this.ChartControl1.Series[0].Properties["OutsideLabels"]ÿ=ÿfalse;ÿ this.ChartControl1.Series[0].Properties["StartAngle"]ÿ=ÿ50f;

Funnelÿ3DÿCharts

Aÿ3Dÿfunnelÿchartÿshowsÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿtheÿwhole,ÿallowingÿtheÿdataÿtoÿ beÿviewedÿinÿaÿthreeÿdimensionalÿformat. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ48

ChartÿInformation

#ÿofÿYÿ 1ÿ values/dataÿ points

#ÿofÿSeries 1

Markerÿ SeriesÿorÿDataÿPoint Support

BaseStyle Getsÿorÿsetsÿaÿcircularÿorÿsquareÿbaseÿdrawingÿstyleÿforÿtheÿ 3Dÿfunnelÿchart.ÿ CalloutLine Getsÿorÿsetsÿtheÿstyleÿforÿaÿlineÿconnectingÿtheÿmarkerÿlabelÿ toÿitsÿcorrespondingÿfunnelÿsection.ÿTheÿdefaultÿvalueÿisÿaÿblackÿone-pointÿ line. FunnelStyle GetsÿorÿsetsÿtheÿYÿvalueÿforÿtheÿseriesÿpointsÿtoÿtheÿwidthÿ orÿheightÿofÿtheÿfunnel.ÿTheÿdefaultÿvalueÿisÿYIsHeight. MinPointHeight Getsÿorÿsetsÿtheÿminimumÿheightÿallowedÿforÿaÿdataÿ pointÿinÿtheÿfunnelÿchart.ÿTheÿheightÿisÿmeasuredÿinÿrelativeÿcoordinates. NeckHeight Getsÿorÿsetsÿtheÿneckÿheightÿforÿtheÿfunnelÿchart.ÿThisÿ propertyÿcanÿonlyÿbeÿusedÿwithÿtheÿFunnelStyleÿpropertyÿsetÿtoÿ YIsHeight.ÿTheÿdefaultÿvalueÿisÿ5. NeckWidth Getsÿorÿsetsÿtheÿneckÿwidthÿforÿtheÿfunnelÿchart.ÿThisÿ propertyÿcanÿonlyÿbeÿusedÿwithÿtheÿFunnelStyleÿpropertyÿsetÿtoÿ YIsHeight.ÿTheÿdefaultÿvalueÿisÿ5. OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿlabelsÿareÿ placedÿoutsideÿofÿtheÿfunnelÿchart.ÿTheÿdefaultÿvalueÿisÿTrue. OutsideLabelsPlacement Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿ dataÿpointÿlabelsÿappearÿonÿtheÿleftÿorÿrightÿsideÿofÿtheÿfunnel.ÿThisÿ propertyÿcanÿonlyÿbeÿusedÿwithÿtheÿOutsideLabelsÿpropertyÿsetÿtoÿTrue. PointGapPct Getsÿorÿsetsÿtheÿamountÿofÿspaceÿbetweenÿtheÿdataÿpointsÿ ofÿtheÿfunnelÿchart.ÿTheÿPointGapPctÿisÿmeasuredÿinÿrelativeÿcoordinates.ÿ Theÿdefaultÿvalueÿisÿ0,ÿandÿvalidÿvaluesÿrangeÿfromÿ0ÿtoÿ100. RotationAngle Getsÿorÿsetsÿtheÿleft-to -rightÿrotationÿangleÿofÿtheÿfunnel.ÿ Theÿvalidÿvaluesÿrangeÿfromÿ-180ÿtoÿ180ÿdegrees.ÿThisÿpropertyÿisÿonlyÿ Customÿ effectiveÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿOrthogonalÿandÿtheÿ Properties BaseStyleÿpropertyÿsetÿtoÿSquareBase.

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿfunnelÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl1.Series(0) .Properties("BaseStyle")ÿ=ÿBaseStyle.SquareBase .Properties("CalloutLine")ÿ=ÿNewÿLine(Color.Black,ÿ2,ÿLineStyle.Dot) .Properties("FunnelStyle")ÿ=ÿFunnelStyle.YIsWidth .Properties("MinPointHeight")ÿ=ÿ10.0F .Properties("NeckWidth")ÿ=ÿ20.0F .Properties("NeckHeight")ÿ=ÿ5.0F .Properties("OutsideLabels")ÿ=ÿTrue .Properties("OutsideLabelsPlacement")ÿ=ÿLabelsPlacement.Right .Properties("PointGapPct")ÿ=ÿ3.0F .Properties("RotationAngle")ÿ=ÿ3.0F EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart; usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["BaseStyle"]ÿ=ÿBaseStyle.SquareBase; this.ChartControl1.Series[0].Properties["CalloutLine"]ÿ=ÿnewÿLine(Color.Black,ÿ2,ÿLineStyle.Dot); ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ49 this.ChartControl1.Series[0].Properties["FunnelStyle"]ÿ=ÿFunnelStyle.YIsWidth; this.ChartControl1.Series[0].Properties["MinPointHeight"]ÿ=ÿ10f; this.ChartControl1.Series[0].Properties["NeckWidth"]ÿ=ÿ20f; this.ChartControl1.Series[0].Properties["NeckHeight"]ÿ=ÿ5f; this.ChartControl1.Series[0].Properties["OutsideLabels"]ÿ=ÿtrue; this.ChartControl1.Series[0].Properties["OutsideLabelsPlacement"]ÿ=ÿLabelsPlacement.Right;ÿ this.ChartControl1.Series[0].Properties["PointGapPct"]ÿ=ÿ3f;ÿ this.ChartControl1.Series[0].Properties["RotationAngle"]ÿ=ÿ3f;

HorizontalÿBarÿ3DÿCharts

Useÿaÿhorizontalÿ3Dÿbarÿchartÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategories,ÿallowingÿtheÿdataÿtoÿbeÿviewedÿ convenientlyÿinÿaÿ3Dÿformatÿwithÿtheÿaxesÿreversed.

Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection. ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ value. CustomÿProperties PointBarDepth Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿbar.

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ50

Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿbarÿchartÿasÿshownÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ65.0F Me.ChartControl1.Series(0).Properties("PointBarDepth")ÿ=ÿ100ÿ //ÿC# this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ65f;ÿ this.ChartControl1.Series[0].Properties["PointBarDepth"]ÿ=ÿ100;

Line3DÿCharts

Useÿaÿ3Dÿlineÿchartÿtoÿcompareÿtrendsÿoverÿaÿperiodÿofÿtimeÿorÿinÿcertainÿcategoriesÿinÿaÿ3Dÿformat.

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection.ÿ ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

LineBackdrop getsÿorÿsetsÿtheÿbackdropÿinformationÿforÿtheÿ3Dÿ line. Thickness getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿline. CustomÿProperties Width getsÿorÿsetsÿtheÿwidthÿofÿtheÿ3Dÿline.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿ3Dÿlineÿchartÿasÿshownÿforÿtheÿ firstÿseriesÿinÿtheÿimageÿabove. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ51

'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("LineBackdrop")ÿ=ÿNewÿBackdrop(Color.GreenYellow) Me.ChartControl1.Series(0).Properties("Thickness")ÿ=ÿ8.0F Me.ChartControl1.Series(0).Properties("Width")ÿ=ÿ40.0F

//ÿC# this.ChartControl1.Series[0].Properties["LineBackdrop"]ÿ=ÿnewÿBackdrop(Color.GreenYellow); this.ChartControl1.Series[0].Properties["Thickness"]ÿ=ÿ8f;ÿ this.ChartControl1.Series[0].Properties["Width"]ÿ=ÿ40f;

PyramidÿCharts

Aÿ3DÿPyramidÿchartÿshowsÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿtheÿwhole,ÿallowingÿtheÿdataÿ toÿbeÿviewedÿinÿaÿthreeÿdimensionalÿformat.

ChartÿInformation

#ÿofÿYÿ 1 values/dataÿ point

#ÿofÿSeries 1

Markerÿ SeriesÿorÿDataÿPoints Support

BaseStyle Getsÿorÿsetsÿaÿcircularÿorÿsquareÿbaseÿdrawingÿstyleÿforÿtheÿ3Dÿ pyramidÿchart.ÿCalloutLine Getsÿorÿsetsÿtheÿstyleÿforÿaÿlineÿconnectingÿ theÿmarkerÿlabelÿtoÿitsÿcorrespondingÿpyramidÿsection.ÿTheÿdefaultÿvalueÿ isÿaÿblackÿone-pointÿline. MinPointHeight Getsÿorÿsetsÿtheÿminimumÿheightÿallowedÿforÿaÿdataÿ pointÿinÿtheÿpyramidÿchart.ÿTheÿheightÿisÿmeasuredÿinÿrelativeÿ coordinates. OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿlabelsÿareÿ placedÿoutsideÿofÿtheÿpyramidÿchart.ÿTheÿdefaultÿvalueÿisÿTrue. OutsideLabelsPlacement Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿ dataÿpointÿlabelsÿappearÿonÿtheÿleftÿorÿrightÿsideÿofÿtheÿpyramid.ÿThisÿ propertyÿcanÿonlyÿbeÿusedÿwithÿtheÿOutsideLabelsÿpropertyÿsetÿtoÿTrue. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ52

PointGapPct Getsÿorÿsetsÿtheÿamountÿofÿspaceÿbetweenÿtheÿdataÿpointsÿ ofÿtheÿpyramidÿchart.ÿTheÿPointGapPctÿisÿmeasuredÿinÿrelativeÿ coordinates.ÿTheÿdefaultÿvalueÿisÿ0,ÿandÿvalidÿvaluesÿrangeÿfromÿ0ÿtoÿ100. RotationAngle Getsÿorÿsetsÿtheÿleft-to-rightÿrotationÿangleÿofÿtheÿ pyramid.ÿTheÿvalidÿvaluesÿrangeÿfromÿ-180ÿtoÿ180ÿdegrees.ÿThisÿpropertyÿ Customÿ isÿonlyÿeffectiveÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿOrthogonalÿandÿtheÿ Properties BaseStyleÿpropertyÿsetÿtoÿSquareBase.

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿPyramidÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl1.Series(0) .Properties("BaseStyle")ÿ=ÿBaseStyle.SquareBase .Properties("MinPointHeight")ÿ=ÿ10.0F .Properties("OutsideLabels")ÿ=ÿTrue .Properties("OutsideLabelsPlacement")ÿ=ÿLabelsPlacement.Right .Properties("PointGapPct")ÿ=ÿ3.0F .Properties("RotationAngle")ÿ=ÿ3.0F EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart; usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["BaseStyle"]ÿ=ÿBaseStyle.SquareBase; this.ChartControl1.Series[0].Properties["MinPointHeight"]ÿ=ÿ10f; this.ChartControl1.Series[0].Properties["OutsideLabels"]ÿ=ÿtrue; this.ChartControl1.Series[0].Properties["OutsideLabelsPlacement"]ÿ=ÿLabelsPlacement.Right;ÿ this.ChartControl1.Series[0].Properties["PointGapPct"]ÿ=ÿ3f;ÿ this.ChartControl1.Series[0].Properties["RotationAngle"]ÿ=ÿ3f;

StackedBar3DÿCharts

Useÿaÿ3Dÿbarÿgraphÿtoÿcompareÿvaluesÿofÿitemsÿacrossÿcategories,ÿallowingÿtheÿdataÿtoÿbeÿviewedÿ convenientlyÿinÿaÿ3Dÿformat.ÿAÿstackedÿbarÿgraphÿisÿaÿbarÿgraphÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿonÿtopÿ ofÿeachÿother.ÿUseÿthisÿgraphÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotal. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ53

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿ isÿfoundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection. ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties valueÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿStackedBar3Dÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ100.0F

//ÿC#ÿ this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ100f;

StackedBar3D100PctÿCharts

AÿStackedBar3D100Pctÿchartÿisÿaÿbarÿchartÿwithÿtwoÿorÿmoreÿdataÿseriesÿstackedÿoneÿonÿtopÿtheÿotherÿthreeÿ dimensionallyÿtoÿsumÿupÿtoÿ100%.ÿUseÿthisÿchartÿtoÿshowÿhowÿeachÿvalueÿcontributesÿtoÿaÿtotalÿwithÿtheÿ relativeÿsizeÿofÿeachÿseriesÿrepresentingÿitsÿcontributionÿtoÿtheÿtotal.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ54

ÿ Note: Toÿseeÿaÿchartÿinÿthreeÿdimensions,ÿtheÿProjectionTypeÿmustÿbeÿOrthogonal.ÿTheÿProjectionTypeÿisÿ foundÿinÿtheÿChartAreaÿCollectionÿdialogÿinÿtheÿProjectionÿsection.ÿ ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 1ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

Gap getsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿ CustomÿProperties valueÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿStackedBar3D100Pctÿchart. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("Gap")ÿ=ÿ100.0F

//ÿC#ÿ this.ChartControl1.Series[0].Properties["Gap"]ÿ=ÿ100f;

XYÿCharts

TheseÿtopicsÿtakeÿyouÿthroughÿsomeÿofÿtheÿXYÿchartÿtypesÿthatÿyouÿcanÿcreateÿwithÿtheÿChartÿcontrol. BubbleÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿBubbleÿChart.ÿ BubbleXYÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿBubbleXYÿChart.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ55

LineXYÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿLineXYÿChart.ÿ PlotXYÿCharts ÿ LearnÿaboutÿtheÿfeaturesÿofÿaÿPlotXYÿChart.ÿ

BubbleÿCharts

TheÿBubbleÿchartÿisÿanÿXYÿchartÿinÿwhichÿbubblesÿrepresentÿdataÿpoints.ÿTheÿfirstÿYÿvalueÿisÿusedÿtoÿplotÿtheÿ bubbleÿalongÿtheÿYÿaxis,ÿandÿtheÿsecondÿYÿvalueÿisÿusedÿtoÿsetÿtheÿsizeÿofÿtheÿbubble.ÿTheÿbubbleÿshapeÿcanÿ beÿchangedÿusingÿtheÿseriesÿShapeÿproperty.

ÿ

ChartÿInformation

#ÿofÿYÿ 2ÿ values/dataÿpoint

#ÿofÿSeries 1ÿorÿmoreÿ

SeriesÿorÿDataÿPoint.ÿMarkerÿlabelsÿuseÿtheÿsecondÿYÿvalueÿasÿtheÿ MarkerÿSupport defaultÿvalue.ÿ

MaxSizeFactor getsÿorÿsetsÿtheÿmaximumÿsizeÿofÿtheÿbubbleÿradius.ÿ Valuesÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1.ÿDefaultÿisÿ.25. MaxValue getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿmaximum. MinValue getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿminimum. Customÿ Shape getsÿorÿsetsÿtheÿshapeÿofÿtheÿbubbles.ÿUsesÿorÿreturnsÿaÿvalidÿ Properties MarkerStyleÿenumerationÿvalue.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿbubbleÿchartÿasÿshownÿinÿtheÿ imageÿabove. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ56

'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("MaxSizeFactor")ÿ=ÿ0.25F Me.ChartControl1.Series(0).Properties("MaxValue")ÿ=ÿ55.0R Me.ChartControl1.Series(0).Properties("MinValue")ÿ=ÿ5.0R Me.ChartControl1.Series(0).Properties("Shape")ÿ=ÿMarkerStyle.Circle

//ÿC# this.ChartControl1.Series[0].Properties["MaxSizeFactor"]ÿ=ÿ.25f; this.ChartControl1.Series[0].Properties["MaxValue"]ÿ=ÿ55D; this.ChartControl1.Series[0].Properties["MinValue"]ÿ=ÿ5D; this.ChartControl1.Series[0].Properties["Shape"]ÿ=ÿMarkerStyle.Circle;ÿ ÿ

BubbleXYÿCharts

TheÿBubbleXYÿchartÿisÿanÿXYÿchartÿinÿwhichÿbubblesÿrepresentÿdataÿpoints.ÿTheÿBubbleXYÿusesÿaÿnumericalÿXÿ axisÿandÿplotsÿtheÿxÿvaluesÿandÿfirstÿsetÿofÿYÿvaluesÿonÿtheÿchart.ÿTheÿsecondÿYÿvalueÿisÿusedÿtoÿsetÿtheÿsizeÿofÿ theÿbubble.

ÿ

ChartÿInformation

#ÿofÿYÿ 2ÿ values/dataÿpoint

#ÿofÿSeries 1ÿorÿmoreÿ

SeriesÿorÿDataÿPoint.ÿMarkerÿlabelsÿuseÿtheÿsecondÿYÿvalueÿasÿtheÿ MarkerÿSupport defaultÿvalue.ÿ

MaxSizeFactor getsÿorÿsetsÿtheÿmaximumÿsizeÿofÿtheÿbubbleÿradius.ÿ Valuesÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1.ÿDefaultÿisÿ.25. MaxValue getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿmaximum. MinValue getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿminimum. Customÿ Shape getsÿorÿsetsÿtheÿshapeÿofÿtheÿbubbles.ÿUsesÿorÿreturnsÿaÿvalidÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ57

Properties MarkerStyleÿenumerationÿvalue.ÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿbubbleÿXYÿchartÿasÿshownÿinÿtheÿ imageÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("MaxSizeFactor")ÿ=ÿ0.25F Me.ChartControl1.Series(0).Properties("MaxValue")ÿ=ÿ50.0R Me.ChartControl1.Series(0).Properties("MinValue")ÿ=ÿ0.0R Me.ChartControl1.Series(0).Properties("Shape")ÿ=ÿMarkerStyle.InvTriangle

//ÿC# this.ChartControl1.Series[0].Properties["MaxSizeFactor"]ÿ=ÿ.25f; this.ChartControl1.Series[0].Properties["MinValue"]ÿ=ÿ0D; this.ChartControl1.Series[0].Properties["MaxValue"]ÿ=ÿ50D; this.ChartControl1.Series[0].Properties["Shape"]ÿ=ÿMarkerStyle.InvTriangle;ÿ ÿ

LineXYÿCharts

AÿlineÿXYÿchartÿplotsÿpointsÿonÿtheÿXÿandÿYÿaxesÿasÿoneÿseriesÿandÿusesÿaÿlineÿtoÿconnectÿpointsÿtoÿeachÿother.

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

ÿ CustomÿProperties Noneÿ

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ58

PlotXYÿCharts

AÿplotÿXYÿchartÿshowsÿtheÿrelationshipsÿbetweenÿnumericÿvaluesÿinÿtwoÿorÿmoreÿseriesÿsetsÿofÿXYÿvalues.

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿpoint 1ÿ

#ÿofÿSeries 1ÿorÿmoreÿ

MarkerÿSupport SeriesÿorÿDataÿPointÿ

CustomÿProperties Noneÿ

ÿ

ÿ

FinancialÿCharts

TheseÿtopicsÿtakeÿyouÿthroughÿsomeÿofÿtheÿfinancialÿchartÿtypesÿthatÿyouÿcanÿcreateÿwithÿtheÿChartÿcontrol. CandleÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿCandleÿChart.ÿ HiLoÿCharts LearnÿaboutÿtheÿfeaturesÿofÿaÿHiLoÿChart.ÿ HiLoOpenCloseÿCharts ÿ LearnÿaboutÿtheÿfeaturesÿofÿaÿHiLoOpenCloseÿChart.ÿ

CandleÿCharts ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ59

AÿcandleÿchartÿdisplaysÿstockÿinformationÿusingÿHigh,ÿLow,ÿOpenÿandÿCloseÿvalues.ÿTheÿsizeÿofÿtheÿwickÿlineÿisÿ determinedÿbyÿtheÿHighÿandÿLowÿvalues,ÿwhileÿtheÿsizeÿofÿtheÿbarÿisÿdeterminedÿbyÿtheÿOpenÿandÿCloseÿ values.ÿTheÿbarÿisÿdisplayedÿusingÿdifferentÿcolors,ÿdependingÿonÿwhetherÿtheÿpriceÿofÿtheÿstockÿhasÿgoneÿupÿ orÿdown.

ÿ

ChartÿInformation

#ÿofÿYÿ 4ÿ(Theÿfirstÿvalueÿisÿtheÿhighÿfigure,ÿtheÿsecondÿisÿtheÿlowÿfigure,ÿtheÿ values/dataÿ thirdÿisÿtheÿopeningÿfigure,ÿandÿtheÿfourthÿisÿtheÿclosingÿfigure.) point

#ÿofÿSeries 1ÿorÿmoreÿ

SeriesÿorÿDataÿPoint.ÿMarkerÿlabelsÿuseÿtheÿfirstÿYÿvalueÿasÿtheÿdefaultÿ MarkerÿSupport value.ÿ

BodyDownswingBackdrop getsÿorÿsetsÿtheÿbackdropÿinformationÿusedÿ toÿfillÿtheÿrectangleÿforÿdataÿpointsÿinÿwhichÿtheÿclosingÿfigureÿisÿlowerÿ thanÿtheÿopeningÿfigure. BodyUpswingBackdrop getsÿorÿsetsÿtheÿbackdropÿinformationÿusedÿtoÿ fillÿtheÿrectangleÿforÿdataÿpointsÿinÿwhichÿtheÿclosingÿfigureÿisÿhigherÿthanÿ theÿopeningÿfigure. BodyWidth getsÿorÿsetsÿtheÿwidthÿofÿtheÿrectangleÿusedÿtoÿshowÿ Customÿ upswingÿorÿdownswing. Properties Wickline getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿwickÿline.ÿ

ÿ Belowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿcandleÿchartÿasÿshownÿinÿtheÿ imageÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("BodyDownswingBackdrop")ÿ=ÿNewÿBackdrop(Color.FromArgbÿ_ (CType(101,ÿByte),ÿCType(43,ÿByte),ÿCType(87,ÿByte)),ÿCType(200,ÿByte)) Me.ChartControl1.Series(0).Properties("BodyUpswingBackdrop")ÿ=ÿNewÿBackdrop(Color.FromArgbÿ_ (CType(121,ÿByte),ÿCType(113,ÿByte),ÿCType(60,ÿByte)),ÿCType(200,ÿByte)) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ60

Me.ChartControl1.Series(0).Properties("WickLine")ÿ=ÿNewÿLine(Color.FromArgb(CType(145,ÿByte),ÿ_ CType(141,ÿByte),ÿCType(127,ÿByte))) Me.ChartControl1.Series(0).Properties("BodyWidth")ÿ=ÿ10.0F

//ÿC# this.ChartControl1.Series[0].Properties["BodyDownswingBackdrop"]=ÿnewÿBackdrop(Color.FromArgb (((System.Byte)(101)),ÿ((System.Byte)(43)),ÿ((System.Byte)(87))),ÿ ((System.Byte)(200))); this.ChartControl1.Series[0].Properties["BodyUpswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.FromArgb (((System.Byte)(121)),ÿ((System.Byte)(113)),ÿ((System.Byte)(60))),ÿ ((System.Byte)(200))); this.ChartControl1.Series[0].Properties["WickLine"]ÿ=ÿnewÿLine(Color.FromArgb(((System.Byte) (145)),ÿ((System.Byte)(141)),ÿ((System.Byte)(127)))); this.ChartControl1.Series[0].Properties["BodyWidth"]ÿ=ÿ10f;ÿ ÿ

HiLoÿCharts

AÿHiLoÿchartÿdisplaysÿstockÿinformationÿusingÿHighÿandÿLowÿorÿOpenÿandÿCloseÿvalues.ÿTheÿlengthÿofÿtheÿHiLoÿ lineÿisÿdeterminedÿbyÿtheÿHighÿandÿLowÿvaluesÿorÿtheÿOpenÿandÿCloseÿvalues.

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 2ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

SeriesÿorÿDataÿPoint.ÿMarkerÿlabelsÿuseÿtheÿfirstÿYÿvalueÿasÿtheÿ MarkerÿSupport defaultÿvalue.ÿ

CustomÿProperties HiLoLine getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿHiLoÿline.ÿ

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ61

BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿHiLoÿchartÿasÿshownÿinÿtheÿ imageÿabove. 'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("HiLoLine")ÿ=ÿNewÿLine(Color.Teal,ÿ4)

//ÿC# this.ChartControl1.Series[0].Properties["HiLoLine"]ÿ=ÿnewÿLine(Color.Teal,ÿ4);ÿ ÿ

HiLoOpenCloseÿCharts

AÿHiLoÿOpenCloseÿchartÿdisplaysÿstockÿinformationÿusingÿHigh,ÿLow,ÿOpenÿandÿCloseÿvalues.ÿOpeningÿvaluesÿ areÿdisplayedÿusingÿlinesÿtoÿtheÿleft,ÿwhileÿlinesÿtoÿtheÿrightÿindicateÿclosingÿvalues.

ÿ

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 4ÿ point

#ÿofÿSeries 1ÿorÿmoreÿ

SeriesÿorÿDataÿPoint.ÿMarkerÿlabelsÿuseÿtheÿfirstÿYÿvalueÿasÿtheÿ MarkerÿSupport defaultÿvalue.ÿ

HiLoLine getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿHiLoÿline. CloseLine getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿcloseÿline. OpenLine getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿopenÿline. TickLen getsÿorÿsetsÿtheÿlengthÿofÿtheÿtickÿforÿtheÿopenÿandÿcloseÿ CustomÿProperties lines.ÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿHiLoOpenCloseÿchartÿasÿshownÿinÿ theÿimageÿabove. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ62

'ÿVisualÿBasic Me.ChartControl1.Series(0).Properties("CloseLine")ÿ=ÿNewÿLine(Color.FromArgb(CTypeÿ_ (38,ÿByte),ÿCType(110,ÿByte),ÿCType(0,ÿByte)),ÿ6) Me.ChartControl1.Series(0).Properties("HiloLine")ÿ=ÿNewÿLine(Color.FromArgb(CTypeÿ_ (255,ÿByte),ÿCType(226,ÿByte),ÿCType(233,ÿByte))) Me.ChartControl1.Series(0).Properties("OpenLine")ÿ=ÿNewÿLine(Color.FromArgb(CTypeÿ_ (187,ÿByte),ÿCType(16,ÿByte),ÿCType(82,ÿByte)),ÿ6) Me.ChartControl1.Series(0).Properties("TickLen")ÿ=ÿ10.0F

//ÿC# this.ChartControl1.Series[0].Properties["CloseLine"]ÿ=ÿnewÿLine(Color.FromArgb(((System.Byte) (38)),ÿ((System.Byte)(110)),ÿ((System.Byte)(0))),ÿ6); this.ChartControl1.Series[0].Properties["HiloLine"]ÿ=ÿnewÿLine(Color.FromArgb(((System.Byte) (255)),ÿ((System.Byte)(226)),ÿ((System.Byte)(233)))); this.ChartControl1.Series[0].Properties["OpenLine"]ÿ=ÿnewÿLine(Color.FromArgb(((System.Byte) (187)),ÿ((System.Byte)(16)),ÿ((System.Byte)(82))),ÿ6); this.ChartControl1.Series[0].Properties["TickLen"]ÿ=ÿ10f;ÿ ÿ

KagiÿCharts

AÿKagiÿchartÿdisplaysÿsupplyÿandÿdemandÿtrendsÿusingÿaÿsequenceÿofÿlinkedÿverticalÿlines.ÿTheÿthicknessÿandÿ directionÿofÿtheÿlinesÿvaryÿdependingÿonÿtheÿpriceÿmovement.ÿIfÿclosingÿpricesÿgoÿinÿtheÿdirectionÿofÿtheÿ previousÿKagiÿline,ÿthenÿthatÿKagiÿlineÿisÿextended.ÿHowever,ÿifÿtheÿclosingÿpriceÿreversesÿbyÿtheÿpresetÿ reversalÿamount,ÿaÿnewÿKagiÿlineÿisÿchartedÿinÿtheÿnextÿcolumnÿinÿtheÿoppositeÿdirection.ÿThinÿlinesÿindicateÿ thatÿtheÿpriceÿbreaksÿtheÿpreviousÿlowÿ(supply)ÿwhileÿthickÿlinesÿindicateÿthatÿtheÿpriceÿbreaksÿtheÿpreviousÿ highÿ(demand).

ChartÿInformation

#ÿofÿYÿ 1 values/dataÿ point ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ63

#ÿofÿSeries 1

Markerÿ SeriesÿorÿDataÿPoints Support

BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿ theÿthree-dimensionalÿsideÿviewÿofÿdownswingÿKagiÿlines.ÿThisÿpropertyÿisÿ onlyÿavailableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿisÿonlyÿeffectiveÿwhenÿtheÿ Widthÿpropertyÿisÿsetÿtoÿaÿvalueÿhigherÿthanÿ25. BodyUpswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿ three-dimensionalÿsideÿviewÿofÿupswingÿKagiÿlines.ÿThisÿpropertyÿisÿonlyÿ availableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿisÿonlyÿeffectiveÿwhenÿtheÿ Widthÿpropertyÿisÿsetÿtoÿaÿvalueÿhigherÿthanÿ25. DownswingLine Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿtoÿuseÿforÿaÿ Kagiÿlineÿwhichÿchartsÿaÿpriceÿdecrease. ReversalAmount Getsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿ orderÿforÿtheÿKagiÿlineÿtoÿchangeÿdirection. UpswingLine GetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿtoÿuseÿforÿaÿKagiÿ lineÿwhichÿchartsÿaÿpriceÿincrease. Width Getsÿorÿsetsÿtheÿwidthÿofÿtheÿthree-dimensionalÿsideÿviewÿofÿtheÿ Kagiÿlines.ThisÿpropertyÿisÿonlyÿavailableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿ Customÿ mustÿbeÿsetÿhigherÿthanÿitsÿdefaultÿvalueÿofÿ1ÿinÿorderÿtoÿdisplayÿbodyÿ Properties downswingÿandÿupswingÿbackdrops.ÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿKagiÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl1.Series(0) .Properties("BodyDownswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Red) .Properties("BodyUpswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Blue) .Properties("DownswingLine")ÿ=ÿNewÿChart.Graphics.Line(Color.DarkRed) .Properties("ReversalAmount")ÿ=ÿ"25" .Properties("UpswingLine")ÿ=ÿNewÿChart.Graphics.Line(Color.DarkBlue) .Properties("Width")ÿ=ÿ50.0F EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["BodyDownswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Red); this.ChartControl1.Series[0].Properties["BodyUpswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Blue); this.ChartControl1.Series[0].Properties["DownswingLine"]ÿ=ÿnewÿChart.Graphics.Line(Color.DarkRed); this.ChartControl1.Series[0].Properties["ReversalAmount"]ÿ=ÿ"25";ÿ this.ChartControl1.Series[0].Properties["UpswingLine"]ÿ=ÿnewÿChart.Graphics.Line(Color.DarkBlue);ÿ this.ChartControl1.Series[0].Properties["Width"]ÿ=ÿ50f;

PointÿAndÿFigureÿCharts

TheÿpointÿandÿfigureÿchartÿusesÿstackedÿcolumnsÿofÿXsÿtoÿindicateÿthatÿdemandÿexceedsÿsupplyÿandÿcolumnsÿ ofÿOsÿtoÿindicateÿthatÿsupplyÿexceedsÿdemandÿtoÿdefineÿpricingÿtrends.ÿAÿnewÿXÿorÿOÿisÿaddedÿtoÿtheÿchartÿifÿ theÿpriceÿmovesÿhigherÿorÿlowerÿthanÿtheÿBoxSizeÿvalueÿyouÿset.ÿAÿnewÿcolumnÿisÿaddedÿwhenÿtheÿpriceÿ reversesÿtoÿtheÿlevelÿofÿtheÿBoxSizeÿvalueÿmultipliedÿbyÿtheÿReversalAmountÿyouÿset.ÿTheÿuseÿofÿtheseÿvaluesÿ inÿtheÿpointÿandÿfigureÿchartÿtoÿcalculateÿpricingÿtrendsÿmakesÿthisÿchartÿbestÿsuitedÿforÿlongÿtermÿfinancialÿ analysis. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ64

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 2 point

#ÿofÿSeries 1

MarkerÿSupport SeriesÿorÿDataÿPoints

BoxSize Getsÿorÿsetsÿtheÿamountÿaÿpriceÿmustÿchangeÿinÿorderÿtoÿ createÿanotherÿXÿorÿO. DownswingLine Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿ downswingÿOs. ReversalAmount Getsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿ orderÿforÿaÿnewÿcolumnÿtoÿbeÿadded. UpswingLine Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿ CustomÿProperties upswingÿXs.ÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿPointÿandÿFigureÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl1.Series(0) .Properties("DownswingLine")ÿ=ÿNewÿChart.Graphics.Line(Color.Red) .Properties("UpswingLine")ÿ=ÿNewÿChart.Graphics.Line(Color.Blue) .Properties("BoxSize")ÿ=ÿ3.0F EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["DownswingLine"]ÿ=ÿnewÿChart.Graphics.Line(Color.Red); this.ChartControl1.Series[0].Properties["UpswingLine"]ÿ=ÿnewÿChart.Graphics.Line(Color.Blue);ÿ this.ChartControl1.Series[0].Properties["BoxSize"]ÿ=ÿ3f; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ65

RenkoÿCharts

TheÿRenkoÿchartÿusesÿbricksÿofÿuniformÿsizeÿtoÿchartÿpriceÿmovement.ÿWhenÿaÿpriceÿmovesÿtoÿaÿgreaterÿorÿ lesserÿvalueÿthanÿtheÿpresetÿBoxSizeÿvalueÿrequiredÿtoÿdrawÿaÿnewÿbrick,ÿaÿnewÿbrickÿisÿdrawnÿinÿtheÿ succeedingÿcolumn.ÿTheÿchangeÿinÿboxÿcolorÿandÿdirectionÿsignifiesÿaÿtrendÿreversal.

ChartÿInformation

#ÿofÿYÿvalues/dataÿ 2 point

#ÿofÿSeries 1

MarkerÿSupport SeriesÿorÿDataÿPoints

BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿ settingsÿforÿtheÿdownswingÿbricks. BodyUpswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿ forÿtheÿupswingÿbricks. BoxSize Getsÿorÿsetsÿtheÿamountÿaÿpriceÿmustÿchangeÿinÿorderÿtoÿ CustomÿProperties createÿanotherÿbrick.ÿ

ÿ BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿRenkoÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl1.Series(0) .Properties("BodyDownswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Red) .Properties("BodyUpswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Blue) .Properties("BoxSize")ÿ=ÿ3.0F ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ66

EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["BodyDownswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Red); this.ChartControl1.Series[0].Properties["BodyUpswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Blue);ÿ this.ChartControl1.Series[0].Properties["BoxSize"]ÿ=ÿ3f;

ThreeÿLineÿBreakÿCharts

Aÿthreeÿlineÿbreakÿchartÿusesÿverticalÿboxesÿorÿlinesÿtoÿillustrateÿpriceÿchangesÿofÿanÿassetÿorÿmarket.ÿTheÿ priceÿinÿaÿthreeÿlineÿbreakÿgraphÿmustÿbreakÿtheÿpriorÿhighÿorÿlowÿsetÿinÿtheÿNewLineBreakÿpropertyÿinÿorderÿ toÿreverseÿtheÿdirectionÿofÿtheÿgraph.

ChartÿInformation

#ÿofÿYÿ 1 values/dataÿ point

#ÿofÿSeries 1

MarkerÿSupport SeriesÿorÿDataÿPoints

BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿ forÿtheÿdownswingÿboxes. BodyUpswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿ theÿupswingÿboxes. Customÿ NewLineBreak Getsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿ Properties orderÿforÿtheÿdirectionÿtoÿchange.ÿTheÿdefaultÿvalueÿisÿ3.ÿ

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ67

BelowÿisÿanÿexampleÿofÿsettingÿtheÿcustomÿchartÿpropertiesÿatÿrunÿtimeÿforÿaÿThreeÿLineÿBreakÿchart. 'VisualÿBasic ImportsÿDataDynamics.ActiveReports.Chart.Graphics

WithÿMe.ChartControl2.Series(0) .Properties("BodyDownswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Red) .Properties("BodyUpswingBackdrop")ÿ=ÿNewÿBackdrop(Color.Blue) .Properties("NewLineBreak")ÿ=ÿ5 EndÿWith

//C# usingÿDataDynamics.ActiveReports.Chart.Graphics; this.ChartControl1.Series[0].Properties["BodyDownswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Red); this.ChartControl1.Series[0].Properties["BodyUpswingBackdrop"]ÿ=ÿnewÿBackdrop(Color.Blue);ÿ this.ChartControl1.Series[0].Properties["NewLineBreak"]ÿ=ÿ5;

ChartÿAppearance

TheseÿtopicsÿwillÿintroduceÿyouÿtoÿsomeÿbasicÿinformationÿaboutÿmanipulatingÿtheÿappearanceÿofÿCharts. ChartÿEffectsÿ LearnÿaboutÿtheÿvisualÿeffectsÿpossibleÿwithÿtheÿChartÿcontrol.ÿ ChartÿControlÿItemsÿ LearnÿaboutÿChartÿcontrolÿitemsÿthatÿcanÿbeÿusedÿtoÿcustomizeÿyourÿchart.ÿ ChartÿAxesÿandÿWalls LearnÿsomeÿbasicÿinformationÿaboutÿChartÿaxesÿandÿwalls.ÿ ChartÿWizardÿ LearnÿwhatÿyouÿcanÿaccomplishÿwithÿtheÿChartÿWizard.ÿ Chart-SpecificÿPropertiesÿ ÿ LearnÿwhichÿpropertiesÿapplyÿtoÿeachÿofÿtheÿChartÿTypes.

ChartÿEffects

TheseÿtopicsÿwillÿintroduceÿyouÿtoÿtheÿdifferentÿvisualÿeffectsÿyouÿcanÿcreateÿwithÿtheÿChartÿcontrol. Colors Learnÿaboutÿcolorsÿandÿgradients.ÿ 3DÿEffects Findÿoutÿaboutÿ3Dÿeffects.ÿ Lighting Findÿoutÿaboutÿdirectionalÿlightÿratio,ÿlightÿtype,ÿandÿlightÿsource.ÿ AlphaÿBlending ÿ FindÿoutÿaboutÿAlphaÿblending.ÿ

Colors

InÿtheÿChartÿcontrol,ÿcolorsÿcanÿbeÿusedÿinÿdifferentÿwaysÿtoÿenhanceÿtheÿchart'sÿappearance,ÿdistinguishÿ differentÿseries,ÿpointÿoutÿorÿdrawÿattentionÿtoÿdataÿinformationÿsuchÿasÿaverages,ÿandÿmore.ÿ

ColorÿPalettes TheÿChartÿcontrolÿincludesÿseveralÿpre-definedÿcolorÿpalettesÿthatÿcanÿbeÿusedÿtoÿautomaticallyÿsetÿtheÿcolorsÿ forÿdataÿvaluesÿinÿaÿseries.ÿTheÿpre-definedÿpalettesÿareÿasÿfollows: ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ68

l Cascade (default)ÿAÿcascadeÿofÿeightÿcoolÿcolorsÿrangingÿfromÿdeepÿtealÿdownÿthroughÿpaleÿorchid.ÿ l Confetti Aÿsprinklingÿofÿbrightÿandÿpastelÿcolors.ÿ l Iceberg Aÿrangeÿofÿtheÿsoftÿbluesÿandÿgreysÿfoundÿinÿanÿiceberg.ÿ

l Springtime Theÿcolorsÿofÿspring,ÿinÿdeepÿgreen,ÿtwoÿvividÿcolorsÿandÿfiveÿpastels.ÿ l None Allÿdataÿisÿdrawnÿusingÿtheÿsameÿtealÿcolor.ÿ TheseÿenumeratedÿvaluesÿareÿaccessedÿthroughÿtheÿSeriesÿclassÿwithÿcodeÿlikeÿtheÿfollowing. 'ÿVisualÿBasic Me.ChartControl1.Series(0).ColorPaletteÿ=ÿChart.ColorPalette.Iceburg ÿ //ÿC# this.ChartControl1.Series[0].ColorPaletteÿ=ÿDataDynamics.ActiveReports.Chart. ColorPalette.Iceburg;

Gradients Gradientsÿcanÿbeÿusedÿinÿobjectÿbackdropsÿtoÿenhanceÿtheÿvisualÿappearanceÿofÿvariousÿchartÿitems.ÿ Gradientsÿcanÿbeÿusedÿinÿtheÿfollowingÿchartÿsections:

l Chartÿbackdropÿ l Chartÿareaÿbackdropsÿ l Wallÿbackdropsÿ

l Titleÿbackdropsÿ l Legendÿbackdropsÿ

l Legendÿitemÿbackdropsÿ(forÿcustomÿlegendÿitems)ÿ

l WallRangeÿbackdropsÿ l Seriesÿbackdropsÿ

l Dataÿpointÿbackdropsÿ l Markerÿbackdropsÿ l Markerÿlabelÿbackdropsÿ

l AnnotationÿTextBarÿbackdropsÿ

YouÿcanÿsetÿgradientsÿforÿaÿbackdropÿatÿrunÿtimeÿbyÿcreatingÿaÿBackdropItem,ÿsettingÿitsÿStyleÿpropertyÿtoÿ Gradient,ÿsettingÿtheÿGradientType,ÿandÿsettingÿtheÿtwoÿcolorsÿtoÿuseÿforÿtheÿgradientÿasÿshownÿinÿtheÿ followingÿexample. 'ÿVisualÿBasic DimÿbItemÿAsÿNewÿDataDynamics.ActiveReports.Chart.BackdropItem bItem.Styleÿ=ÿChart.Graphics.BackdropStyle.Gradient bItem.Gradientÿ=ÿChart.Graphics.GradientType.Vertical bItem.Colorÿ=ÿColor.Purple bItem.Color2ÿ=ÿColor.White Me.ChartControl1.Backdropÿ=ÿbItem ÿ //ÿC# DataDynamics.ActiveReports.Chart.BackdropItemÿbItemÿ=ÿnewÿDataDynamics.ActiveReports. Chart.BackdropItem(); bItem.Styleÿ=ÿChart.Graphics.BackdropStyle.Gradient; bItem.Gradientÿ=ÿGradientType.Vertical; bItem.Colorÿ=ÿColor.Purple; bItem.Color2ÿ=ÿColor.White;ÿ this.ChartControl1.Backdropÿ=ÿbItem;

3DÿEffects

Usingÿtheÿprojectionÿandÿviewpointÿsettings,ÿyouÿhaveÿtheÿabilityÿtoÿdisplayÿyourÿ3Dÿchartÿatÿorÿfromÿanyÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ69 angleÿneededÿtoÿprovideÿtheÿdesiredÿviewÿorÿcallÿattentionÿtoÿaÿspecificÿchartÿsection.ÿ

Projection Determineÿtheÿprojectionÿforÿaÿ3Dÿchartÿusingÿthreeÿfactors:ÿtheÿZDepthÿratio,ÿtheÿprojectionÿtype,ÿandÿtheÿ projectionÿDXÿandÿDYÿvalues.ÿ

l ZDepthÿratio TheÿZÿdepthÿratioÿisÿtheÿlevelÿofÿdepthÿtheÿZÿaxisÿhasÿinÿtheÿchart.ÿValuesÿrangeÿfromÿ0ÿ(forÿ aÿ2Dÿchart)ÿtoÿ1.0.ÿ

l ProjectionType Theÿtypeÿofÿprojectionÿusedÿforÿtheÿchart.ÿInÿorderÿtoÿshowÿchartsÿthreeÿdimensionally,ÿ theÿProjectionTypeÿinÿtheÿChartAreaÿCollectionÿeditorÿmustÿbeÿsetÿtoÿOrthogonal.ÿToÿaccessÿthisÿdialogÿ box,ÿclickÿtheÿellipsisÿbuttonÿnextÿtoÿtheÿChartAreasÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow.ÿ

l ProjectionDX TheÿoriginÿpositionÿofÿtheÿZÿaxisÿinÿrelationÿtoÿtheÿXÿaxis.ÿThisÿpropertyÿisÿvalidÿonlyÿwhenÿ theÿProjectionTypeÿisÿOrthogonal.ÿ

l ProjectionDY TheÿoriginÿpositionÿofÿtheÿZÿaxisÿinÿrelationÿtoÿtheÿYÿaxis.ÿThisÿpropertyÿisÿvalidÿonlyÿwhenÿ theÿProjectionTypeÿisÿOrthogonal.ÿ

l HorizontalRotationÿTheÿHorizontalRotationÿpropertyÿallowsÿyouÿtoÿsetÿtheÿdegreeÿ(-90° toÿ90°)ÿ ofÿhorizontalÿrotationÿfromÿwhichÿtheÿchartÿisÿseen.ÿ

ÿ l VerticalRotation TheÿVerticalRotationÿpropertyÿallowsÿyouÿtoÿsetÿtheÿdegreeÿ(-90° toÿ90°)ÿofÿverticalÿ rotationÿfromÿwhichÿtheÿchartÿisÿseen.

AlphaÿBlending

TheÿBackdropÿclassÿinÿtheÿChartÿcontrolÿhasÿanÿAlphaÿpropertyÿwhichÿemploysÿGDI+,ÿandÿisÿusedÿtoÿsetÿtheÿ transparencyÿlevelÿofÿeachÿobject'sÿbackdrop.ÿGDI+ÿusesÿ32ÿbitsÿoverallÿandÿ8ÿbitsÿperÿalpha,ÿred,ÿgreen,ÿandÿ blueÿchannelsÿrespectivelyÿtoÿindicateÿtheÿtransparencyÿandÿcolorÿofÿanÿobject.ÿLikeÿaÿcolorÿchannel'sÿlevelsÿofÿ color,ÿtheÿalphaÿchannelÿrepresentsÿ256ÿlevelsÿofÿtransparency.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ70

TheÿdefaultÿvalueÿofÿtheÿAlphaÿpropertyÿisÿ255,ÿwhichÿrepresentsÿaÿfullyÿopaqueÿcolor.ÿForÿaÿfullyÿtransparentÿ color,ÿsetÿthisÿvalueÿtoÿ0.ÿToÿblendÿtheÿcolorÿofÿtheÿobject'sÿbackdropÿwithÿtheÿbackgroundÿcolor,ÿuseÿaÿsettingÿ betweenÿ0ÿandÿ255. InÿtheÿChartÿcontrol,ÿyouÿcanÿuseÿtheÿColor.FromArgbÿmethodÿtoÿsetÿtheÿalphaÿandÿcolorÿlevelsÿforÿaÿ particularÿchartÿelement.ÿTheÿfollowingÿexampleÿshowsÿhowÿyouÿcanÿuseÿtheÿmethodÿtoÿsetÿtheÿalphaÿandÿ colorÿvaluesÿforÿtheÿchartÿbackdrop. 'ÿVisualÿBasic Me.ChartControl1.Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.BackdropItemÿ_ (Color.FromArgb(100,ÿ0,ÿ11,ÿ220))

//ÿC# this.ChartControl1.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart. BackdropItem(Color.FromArgb(100,ÿ0,ÿ11,ÿ220)); Changingÿtheÿalphaÿlevelÿofÿaÿchartÿelementÿrevealsÿotherÿitemsÿthatÿareÿbeneathÿtheÿobject.ÿBecauseÿyouÿcanÿ setÿtheÿalphaÿlevelÿforÿanyÿchartÿelementÿthatÿsupportsÿcolor,ÿyouÿcanÿcreateÿcustomÿeffectsÿforÿanyÿchart.ÿForÿ example,ÿyouÿcanÿuseÿalphaÿblendingÿtoÿcombineÿbackgroundÿimagesÿwithÿaÿsemiÿ -transparentÿchartÿbackdropÿ toÿcreateÿaÿwatermarkÿlook.ÿ

Lighting

TheÿChartÿcontrolÿprovidesÿtheÿabilityÿtoÿcompletelyÿcustomizeÿlightingÿoptionsÿforÿ3Dÿcharts.ÿ

DirectionalÿLightÿRatio UsingÿtheÿDirectionalLightRatioÿproperty,ÿyouÿcanÿcontrolÿtheÿdirectionalÿorÿambientÿintensityÿratio.ÿ

LightÿType ByÿsettingÿtheÿTypeÿpropertyÿtoÿoneÿofÿtheÿenumeratedÿLightTypeÿvalues,ÿyouÿcanÿcontrolÿtheÿtypeÿofÿlightingÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ71 usedÿinÿtheÿchart.ÿTheÿsettingsÿareÿasÿfollows: l Ambient Anÿambientÿlightÿsourceÿisÿused.ÿItÿisÿequalÿtoÿDirectionalLightRatioÿ=ÿ0.ÿ

l InfiniteDirectional Anÿinfiniteÿdirectionalÿlightÿsourceÿ(likeÿtheÿsun)ÿisÿused.ÿ l FiniteDirectional Aÿpointÿlightÿsourceÿisÿused.ÿÿÿ

LightÿSourceÿ YouÿcanÿalsoÿsetÿtheÿSourceÿpropertyÿtoÿaÿPoint3dÿobject,ÿwhichÿcontrolsÿtheÿlocationÿofÿtheÿlightÿsource.

ChartÿControlÿItems

TheseÿtopicsÿwillÿintroduceÿyouÿtoÿtheÿChartÿcontrolÿitemsÿthatÿcanÿbeÿusedÿtoÿcustomizeÿyourÿchart. ÿ Annotations Findÿoutÿhowÿannotationsÿcanÿbeÿaddedÿtoÿaÿchart.ÿ TitlesÿandÿFooters Findÿoutÿhowÿcustomÿtitlesÿandÿfootersÿcanÿbeÿaddedÿtoÿaÿchart.ÿ Legends Findÿoutÿhowÿtoÿaddÿaÿlegendÿtoÿaÿchart.ÿ Markers Findÿoutÿhowÿtoÿcreateÿcustomÿmarkersÿtoÿshowÿdataÿvalues.ÿ

ÿ ConstantÿLinesÿandÿStripes Findÿoutÿhowÿtoÿuseÿconstantÿlinesÿandÿstripesÿinÿaÿchart.ÿ

Annotations

TheÿChartÿcontrolÿoffersÿaÿbuilt-inÿannotationÿtoolÿtoÿallowÿyouÿtoÿincludeÿfloatingÿtextÿbarsÿorÿimagesÿinÿyourÿ chartsÿorÿcallÿattentionÿtoÿspecificÿitemsÿorÿvaluesÿinÿyourÿchartsÿusingÿtheÿlineÿandÿtextÿbarÿcontrolsÿincludedÿ inÿtheÿAnnotationÿCollectionÿEditor.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ72

ÿ Theÿfollowingÿpropertiesÿareÿimportantÿwhenÿsettingÿupÿannotationsÿforÿyourÿchart:ÿ

l StartÿPoint:ÿsetsÿtheÿstartingÿpointÿ(XÿandÿYÿaxisÿvalues)ÿforÿanÿannotationÿline.ÿ l EndÿPoint:ÿsetsÿtheÿendÿpointÿ(XÿandÿYÿaxisÿvalues)ÿforÿanÿannotationÿline.ÿ l AnchorÿPlacement:ÿsetsÿtheÿpositionÿofÿtheÿanchorÿpointÿforÿtheÿtextÿbarÿonÿtheÿchartÿsurface.ÿ

l AnchorÿPoint:ÿsetsÿtheÿpointÿ(XÿandÿYÿaxisÿvalues)ÿwhereÿtheÿtextÿbarÿwillÿbeÿanchoredÿbasedÿonÿtheÿ anchorÿplacementÿselected.ÿ ÿ Theÿfollowingÿcodeÿdemonstratesÿcreatingÿannotationÿlinesÿandÿtextÿbars,ÿsettingÿtheirÿproperties,ÿandÿaddingÿ themÿtoÿtheÿseriesÿannotationsÿcollectionÿatÿrunÿtime.ÿTheÿresultsÿareÿshownÿinÿtheÿscreenshotÿabove.ÿÿ 'ÿVisualÿBasic

'ÿcreateÿtheÿannotationÿlinesÿandÿtextÿbars DimÿaLine1ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Annotations.AnnotationLine DimÿaLine2ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Annotations.AnnotationLine DimÿaText1ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar DimÿaText2ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBar

'ÿsetÿtheÿpropertiesÿforÿeachÿlineÿandÿtextÿbar WithÿaLine1 .EndPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ30.0F) .Lineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Colorÿ_ ÿ .Red,ÿ2) .StartPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ15.0F) EndÿWith WithÿaLine2 .EndPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(4.6F,ÿ47.0F) .Lineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Colorÿ_ ÿ .Red,ÿ2) .StartPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(3.6F,ÿ45.0F) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ73

EndÿWith WithÿaText1 .AnchorPlacementÿ=ÿDataDynamics.ActiveReports.Chart.Annotationsÿ_ ÿ .AnchorPlacementType.Bottom .AnchorPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ31.0F) .Heightÿ=ÿ25.0F .Lineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Colorÿ_ ÿ .Red,ÿ2) .Textÿ=ÿ"MinÿValue" .Widthÿ=ÿ100.0F EndÿWith WithÿaText2 .AnchorPlacementÿ=ÿDataDynamics.ActiveReports.Chart.Annotationsÿ_ ÿ .AnchorPlacementType.Left .AnchorPointÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(4.7F,ÿ47.0F) .Heightÿ=ÿ25.0F .Lineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Colorÿ_ ÿ .Red,ÿ2) .Textÿ=ÿ"MaxÿValue" .Widthÿ=ÿ100.0F EndÿWith

'ÿaddÿtheÿannotationÿlinesÿandÿtextÿbarsÿtoÿtheÿannotationsÿcollectionÿforÿtheÿseries Me.ChartControl1.Series(0).Annotations.AddRange(NewÿDataDynamics.ActiveReports.Chartÿ_ .Annotations.Annotation()ÿ{aLine1,ÿaLine2,ÿaText1,ÿaText2}) ÿ //ÿC#

//ÿcreateÿtheÿannotationÿlinesÿandÿtextÿbars DataDynamics.ActiveReports.Chart.Annotations.AnnotationLineÿaLine1ÿ=ÿnewÿ DataDynamics.SharpGraph.Windows.Annotations.AnnotationLine(); DataDynamics.ActiveReports.Chart.Annotations.AnnotationLineÿaLine2ÿ=ÿnewÿ DataDynamics.SharpGraph.Windows.Annotations.AnnotationLine(); DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBarÿaText1ÿ=ÿnewÿ DataDynamics.SharpGraph.Windows.Annotations.AnnotationTextBar(); DataDynamics.ActiveReports.Chart.Annotations.AnnotationTextBarÿaText2ÿ=ÿnewÿ DataDynamics.SharpGraph.Windows.Annotations.AnnotationTextBar();

//ÿsetÿtheÿpropertiesÿforÿeachÿlineÿandÿtextÿbar aLine1.EndPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ30F); aLine1.Lineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red,ÿ 2); aLine1.StartPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ15F); aLine2.EndPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(4.6F,ÿ47F); aLine2.Lineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red,ÿ 2); aLine2.StartPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(3.6F,ÿ45F); aText1.AnchorPlacementÿ=ÿDataDynamics.ActiveReports.Chart.Annotations.AnchorPlacementType .Bottom; aText1.AnchorPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(1.5F,ÿ31F); aText1.Heightÿ=ÿ25F; aText1.Lineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red,ÿ 2); aText1.Textÿ=ÿ"MinÿValue"; aText1.Widthÿ=ÿ100F; aText2.AnchorPlacementÿ=ÿDataDynamics.ActiveReports.Chart.Annotations.AnchorPlacementType .Left; aText2.AnchorPointÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Point2d(4.7F,ÿ47F); aText2.Heightÿ=ÿ25F; aText2.Lineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Red,ÿ 2); aText2.Textÿ=ÿ"MaxÿValue"; aText2.Widthÿ=ÿ100F;

//ÿaddÿtheÿannotationÿlinesÿandÿtextÿbarsÿtoÿtheÿannotationsÿcollectionÿforÿtheÿseries this.ChartControl1.Series[0].Annotations.AddRange(newÿDataDynamics.ActiveReports.Chart .Annotations.Annotation[]ÿ{aLine1,ÿaLine2,ÿaText1,ÿaText2});

ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ74

ÿ

TitlesÿandÿFooters

TheÿChartÿcontrolÿallowsÿyouÿtoÿaddÿcustomÿtitlesÿtoÿyourÿcharts.ÿTheÿTitlesÿcollectionÿisÿaccessibleÿfromÿtheÿ SharpGraphÿobject.ÿWithÿtheÿabilityÿtoÿaddÿasÿmanyÿtitlesÿasÿneeded,ÿdockÿthemÿtoÿanyÿsideÿofÿaÿchartÿarea,ÿ changeÿallÿofÿtheÿfontÿproperties,ÿaddÿbordersÿandÿshadows,ÿmakeÿtheÿbackgroundÿlookÿtheÿwayÿyouÿwantÿit,ÿ andÿchangeÿtheÿlocationÿofÿtheÿtext,ÿyouÿcanÿeasilyÿmakeÿyourÿtitlesÿlookÿtheÿwayÿyouÿwantÿthemÿtoÿlook.ÿ

ÿ Theÿfollowingÿcodeÿdemonstratesÿcreatingÿheaderÿandÿfooterÿtitles,ÿsettingÿtheirÿproperties,ÿandÿaddingÿthemÿ toÿtheÿtitlesÿcollectionÿatÿrunÿtime. 'ÿVisualÿBasic

'ÿcreateÿtheÿheaderÿandÿfooterÿtitles DimÿtHeaderÿAsÿNewÿDataDynamics.ActiveReports.Chart.Title DimÿtFooterÿAsÿNewÿDataDynamics.ActiveReports.Chart.Title

'ÿsetÿtheÿpropertiesÿforÿtheÿheader tHeader.Alignmentÿ=ÿChart.Alignment.Center tHeader.Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawingÿ_ .Color.Thistle) tHeader.Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿDataDynamics.ActiveReportsÿ_ .Chart.Graphics.Line(System.Drawing.Color.DimGray),ÿ3) tHeader.DockAreaÿ=ÿMe.ChartControl1.ChartAreas(0) tHeader.Dockingÿ=ÿChart.DockType.Top tHeader.Fontÿ=ÿNewÿDataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.White,ÿ_ NewÿSystem.Drawing.Font("Arial",ÿ25.0F)) tHeader.Textÿ=ÿ"ChartÿTitle" tHeader.Visibleÿ=ÿTrue

'ÿsetÿtheÿpropertiesÿforÿtheÿfooter tFooter.Alignmentÿ=ÿChart.Alignment.Center tFooter.Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawingÿ_ .Color.Thistle) tFooter.Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿDataDynamics.ActiveReportsÿ_ .Chart.Graphics.Line(System.Drawing.Color.Indigo),ÿ0,ÿSystem.Drawing.Color.Black) tFooter.DockAreaÿ=ÿMe.ChartControl1.ChartAreas(0) tFooter.Dockingÿ=ÿChart.DockType.Bottom tFooter.Fontÿ=ÿNewÿDataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.DimGray,ÿ_ NewÿSystem.Drawing.Font("Arial",ÿ12.0F,ÿSystem.Drawing.FontStyle.Bold)) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ75 tFooter.Textÿ=ÿ"ChartÿFooter" tFooter.Visibleÿ=ÿTrue

'ÿaddÿtheÿheaderÿandÿfooterÿtitlesÿtoÿtheÿtitlesÿcollection Me.ChartControl1.Titles.AddRange(NewÿDataDynamics.ActiveReports.Chart.Title()ÿ{tHeader,ÿ_ tFooter}) ÿ //ÿC#

//ÿcreateÿtheÿheaderÿandÿfooterÿtitles DataDynamics.ActiveReports.Chart.TitleÿtHeaderÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Title(); DataDynamics.ActiveReports.Chart.TitleÿtFooterÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Title();

//ÿsetÿtheÿpropertiesÿforÿtheÿheader tHeader.Alignmentÿ=ÿChart.Alignment.Center; tHeader.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawing .Color.Thistle); tHeader.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿDataDynamics.ActiveReports .Chart.Graphics.Line(System.Drawing.Color.DimGray),ÿ3); tHeader.DockAreaÿ=ÿthis.ChartControl1.ChartAreas[0]; tHeader.Dockingÿ=ÿChart.DockType.Top; tHeader.Fontÿ=ÿnewÿDataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.White,ÿ newÿSystem.Drawing.Font("Arial",ÿ25F)); tHeader.Textÿ=ÿ"ChartÿTitle"; tHeader.Visibleÿ=ÿtrue;

//ÿsetÿtheÿpropertiesÿforÿtheÿfooter tFooter.Alignmentÿ=ÿChart.Alignment.Center; tFooter.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawing .Color.Thistle); tFooter.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿDataDynamics.ActiveReports .Chart.Graphics.Line(System.Drawing.Color.Indigo),ÿ0,ÿSystem.Drawing.Color.Black); tFooter.DockAreaÿ=ÿthis.ChartControl1.ChartAreas[0]; tFooter.Dockingÿ=ÿChart.DockType.Bottom; tFooter.Fontÿ=ÿnewÿDataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.DimGray,ÿ newÿSystem.Drawing.Font("Arial",ÿ12F,ÿSystem.Drawing.FontStyle.Bold)); tFooter.Textÿ=ÿ"ChartÿFooter"; tFooter.Visibleÿ=ÿtrue;

//ÿaddÿtheÿheaderÿandÿfooterÿtitlesÿtoÿtheÿtitlesÿcollection this.ChartControl1.Titles.AddRange(newÿDataDynamics.ActiveReports.Chart.Title[]ÿ{tHeader,

ÿ tFooter}); ÿ

Legends

TheÿChartÿcontrolÿautomaticallyÿcreatesÿaÿlegendÿitemÿforÿeachÿseriesÿaddedÿtoÿaÿchartÿatÿdesignÿtimeÿandÿ setsÿtheÿLegendÿpropertyÿforÿeachÿseriesÿbyÿdefault.ÿHowever,ÿtheÿlegend'sÿVisibleÿpropertyÿmustÿbeÿsetÿ toÿTrueÿforÿtheÿlegendÿtoÿshowÿwithÿtheÿchart.ÿTheÿtextÿforÿeachÿdefaultÿlegendÿentryÿisÿtakenÿfromÿtheÿ Nameÿpropertyÿonÿtheÿseries.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ76

Theÿfollowingÿcodeÿdemonstratesÿhowÿtoÿcreateÿaÿlegendÿatÿrunÿtime,ÿaddÿitÿtoÿtheÿlegendsÿcollectionÿforÿtheÿ Chartÿobjectÿandÿsetÿtheÿlegendÿpropertyÿofÿtheÿseriesÿtoÿtheÿnewÿlegend,ÿresultingÿinÿtheÿlegendÿshownÿ above. Note: EachÿSeriesÿtoÿbeÿshownÿinÿtheÿLegendÿmustÿhaveÿaÿName.ÿIfÿtheÿNameÿpropertyÿisÿnotÿset,ÿtheÿ SeriesÿdoesÿnotÿshowÿupÿinÿtheÿLegend. 'ÿVisualÿBasic 'ÿcreateÿtheÿlegendÿandÿtitleÿforÿtheÿlegend Dimÿlegend1ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Legend DimÿlHeaderÿAsÿNewÿDataDynamics.ActiveReports.Chart.Title 'ÿsetÿtheÿpropertiesÿforÿtheÿlegendÿtitle lHeader.Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(Chart.Graphicsÿ_ .BackdropStyle.Transparent,ÿColor.White,ÿColor.White,ÿChart.Graphics.GradientTypeÿ_ .Vertical,ÿDrawing2D.HatchStyle.DottedGrid,ÿNothing,ÿChart.Graphics.PicturePutStyleÿ_ .Stretched) lHeader.Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿChart.Graphics.Line(Colorÿ_ .White,ÿ2,ÿChart.Graphics.LineStyle.None),ÿ0,ÿColor.Black) lHeader.Fontÿ=ÿNewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.White,ÿNewÿ_ System.Drawing.Font("Arial",ÿ10.0F,ÿFontStyle.Bold)) lHeader.Textÿ=ÿ"Series:" 'ÿsetÿtheÿpropertiesÿforÿtheÿlegendÿandÿaddÿitÿtoÿtheÿlegendsÿcollection legend1.Alignmentÿ=ÿDataDynamics.ActiveReports.Chart.Alignment.TopRight legend1.Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.BackdropItem(Chart.Graphicsÿ_ .BackdropStyle.Transparent,ÿColor.Gray,ÿColor.White,ÿChart.Graphics.GradientTypeÿ_ .Vertical,ÿDrawing2D.HatchStyle.DottedGrid,ÿNothing,ÿChart.Graphics.PicturePutStyleÿ_ .Stretched) legend1.Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿChart.Graphics.Line(Colorÿ_ .Navy,ÿ2),ÿ0,ÿColor.Black) legend1.DockAreaÿ=ÿMe.ChartControl1.ChartAreas(0) legend1.LabelsFontÿ=ÿNewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.White,ÿNewÿSystemÿ_ .Drawing.Font("Arial",ÿ9.0F)) legend1.Headerÿ=ÿlHeader ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ77 legend1.MarginXÿ=ÿ5 legend1.MarginYÿ=ÿ5 Me.ChartControl1.Legends.Add(legend1) 'ÿsetÿtheÿlegendÿpropertyÿofÿtheÿseriesÿtoÿtheÿlegendÿyouÿcreated Me.ChartControl1.Series(0).Legendÿ=ÿlegend1 Me.ChartControl1.Series(1).Legendÿ=ÿlegend1 Me.ChartControl1.Series(2).Legendÿ=ÿlegend1 ÿ //ÿC# //ÿcreateÿtheÿlegendÿandÿtitleÿforÿtheÿlegend DataDynamics.ActiveReports.Chart.Legendÿlegend1ÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Legend(); DataDynamics.ActiveReports.Chart.TitleÿlHeaderÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Title(); //ÿsetÿtheÿpropertiesÿforÿtheÿlegendÿtitle lHeader.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(Chart.Graphics .BackdropStyle.Transparent,ÿColor.White,ÿColor.White,ÿChart.Graphics.GradientType .Vertical,ÿSystem.Drawing.Drawing2D.HatchStyle.DottedGrid,ÿnull,ÿChart.Graphics .PicturePutStyle.Stretched); lHeader.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿChart.Graphics.Line(Color .White,ÿ2,ÿChart.Graphics.LineStyle.None),ÿ0,ÿColor.Black); lHeader.Fontÿ=ÿnewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.White,ÿnewÿFont("Arial",ÿ 10F,ÿFontStyle.Bold));ÿÿÿÿÿÿÿ lHeader.Textÿ=ÿ"Series:"; //ÿsetÿtheÿpropertiesÿforÿtheÿlegendÿandÿaddÿitÿtoÿtheÿlegendsÿcollection legend1.Alignmentÿ=ÿDataDynamics.ActiveReports.Chart.Alignment.TopRight; legend1.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.BackdropItem(Chart.Graphics .BackdropStyle.Transparent,ÿColor.Gray,ÿColor.White,ÿChart.Graphics.GradientType .Vertical,ÿSystem.Drawing.Drawing2D.HatchStyle.DottedGrid,ÿnull,ÿChart.Graphics .PicturePutStyle.Stretched); legend1.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿChart.Graphics.Line(Color .Navy,ÿ2),ÿ0,ÿColor.Black); legend1.DockAreaÿ=ÿthis.sharpGraph1.ChartAreas[0]; legend1.LabelsFontÿ=ÿnewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.White,ÿnewÿFont ("Arial",ÿ9F)); legend1.Headerÿ=ÿlHeader; legend1.MarginXÿ=ÿ5; legend1.MarginYÿ=ÿ5; this.ChartControl1.Legends.Add(legend1); ÿ //ÿsetÿtheÿlegendÿpropertyÿofÿtheÿseriesÿtoÿtheÿlegendÿyouÿcreated this.ChartControl1.Series[0].Legendÿ=ÿlegend1; this.ChartControl1.Series[1].Legendÿ=ÿlegend1;ÿ this.ChartControl1.Series[2].Legendÿ=ÿlegend1;

Markers

Markersÿareÿusedÿtoÿshowÿspecificÿdataÿseriesÿvaluesÿinÿaÿchart.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ78

TheÿfollowingÿcodeÿdemonstratesÿhowÿtoÿcreateÿaÿmarkerÿobjectÿatÿrunÿtimeÿandÿassignÿitÿtoÿtheÿMarkerÿ propertyÿofÿtheÿseries.ÿTheÿresultsÿareÿshownÿinÿtheÿimageÿabove.ÿ 'ÿVisualÿBasic 'ÿcreateÿtheÿmarkerÿobject Dimÿmarker1ÿAsÿNewÿDataDynamics.ActiveReports.Chart.Marker

'ÿsetÿtheÿmarkerÿproperties marker1.Backdropÿ=ÿNewÿChart.Graphics.Backdrop(Chart.Graphics.GradientType.Horizontal,ÿ_ Color.Navy,ÿColor.Black) marker1.Lineÿ=ÿNewÿChart.Graphics.Line(Color.White) marker1.Labelÿ=ÿNewÿChart.LabelInfo(NewÿChart.Graphics.Line(Color.Transparent,ÿ0,ÿChartÿ_ .Graphics.LineStyle.None),ÿNewÿChart.Graphics.Backdrop(Chart.Graphics.BackdropStyleÿ_ .Transparent,ÿColor.White,ÿColor.White,ÿChart.Graphics.GradientType.Vertical,ÿSystemÿ_ .Drawing.Drawing2D.HatchStyle.DottedGrid,ÿNothing,ÿChart.Graphics.PicturePutStyleÿ_ .Stretched),ÿNewÿChart.FontInfo(Color.White,ÿNewÿFont("Arial",ÿ8.0F)),ÿ"{Value}",ÿ_ Chart.Alignment.Center) marker1.Sizeÿ=ÿ24 marker1.Styleÿ=ÿChart.MarkerStyle.Diamond

'ÿassignÿtheÿmarkerÿtoÿtheÿseriesÿMarkerÿproperty Me.ChartControl1.Series(0).Markerÿ=ÿmarker1 ÿ //ÿC# //ÿcreateÿtheÿmarkerÿobject DataDynamics.ActiveReports.Chart.Markerÿmarker1ÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Marker();

//ÿsetÿtheÿmarkerÿproperties marker1.Backdropÿ=ÿnewÿChart.Graphics.Backdrop(Chart.Graphics.GradientType.Horizontal,ÿ Color.Navy,ÿColor.Black); marker1.Lineÿ=ÿnewÿChart.Graphics.Line(Color.White); marker1.Labelÿ=ÿnewÿChart.LabelInfo(newÿChart.Graphics.Line(Color.Transparent,ÿ0,ÿChart ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ79

.Graphics.LineStyle.None),ÿnewÿChart.Graphics.Backdrop(Chart.Graphics.BackdropStyle .Transparent,ÿColor.White,ÿColor.White,ÿChart.Graphics.GradientType.Vertical,ÿSystem .Drawing.Drawing2D.HatchStyle.DottedGrid,ÿnull,ÿChart.Graphics.PicturePutStyle .Stretched),ÿnewÿChart.FontInfo(Color.White,ÿnewÿFont("Arial",ÿ8F)),ÿ"{Value}",ÿChart .Alignment.Center); marker1.Sizeÿ=ÿ24; marker1.Styleÿ=ÿChart.MarkerStyle.Diamond;

//ÿassignÿtheÿmarkerÿtoÿtheÿseriesÿMarkerÿpropertyÿ this.ChartControl1.Series[0].Markerÿ=ÿmarker1;

ConstantÿLinesÿandÿStripes

TheÿChartÿcontrolÿsupportsÿconstantÿlinesÿandÿstripesÿthroughÿtheÿuseÿofÿtheÿWallRangesÿcollection.ÿItÿallowsÿ youÿtoÿdisplayÿhorizontalÿorÿverticalÿlinesÿorÿstripesÿinÿaÿchartÿtoÿhighlightÿcertainÿareas.ÿForÿexample,ÿyouÿ couldÿdrawÿaÿstripeÿinÿaÿchartÿtoÿdrawÿattentionÿtoÿaÿhighÿlevelÿinÿtheÿdataÿorÿdrawÿaÿlineÿtoÿshowÿtheÿaverageÿ valueÿofÿtheÿdataÿpresented.ÿ

Importantÿproperties l EndValue--Setsÿtheÿendÿvalueÿonÿtheÿprimaryÿaxisÿforÿtheÿwallÿrange.ÿÿ l StartValueÿ--Setsÿtheÿstartÿvalueÿonÿtheÿprimaryÿaxisÿforÿtheÿwallÿrange.ÿ

l PrimaryAxis--Setsÿtheÿaxisÿonÿwhichÿtheÿwallÿrangeÿshouldÿappear.ÿÿ ÿ Theÿfollowingÿcodeÿdemonstratesÿhowÿtoÿcreateÿwallÿranges,ÿsetÿtheirÿproperties,ÿandÿassignÿthemÿtoÿaÿchartÿ areaÿatÿrunÿtime.ÿTheÿresultsÿareÿshownÿinÿtheÿimageÿabove.ÿ 'ÿVisualÿBasic 'ÿcreateÿtheÿwallÿrangeÿobjects DimÿwallRange1ÿAsÿNewÿDataDynamics.ActiveReports.Chart.WallRange ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ80

DimÿwallRange2ÿAsÿNewÿDataDynamics.ActiveReports.Chart.WallRange DimÿwallRange3ÿAsÿNewÿDataDynamics.ActiveReports.Chart.WallRange

'ÿsetÿtheÿwallÿrangeÿproperties WithÿwallRange1 .Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(Color.White) .Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿDataDynamics.ActiveReportsÿ_ ÿ .Chart.Graphics.Line(Color.Transparent,ÿ0,ÿDataDynamics.ActiveReports.Chartÿ_ ÿ .Graphics.LineStyle.None),ÿ0,ÿColor.Black) .EndValueÿ=ÿ40 .PrimaryAxisÿ=ÿ((CType(Me.ChartControl1.ChartAreas(0).Axes("AxisY"),ÿDataDynamicsÿ_ ÿ .ActiveReports.Chart.Axis))) .StartValueÿ=ÿ30 EndÿWith WithÿwallRange2 .Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(Color.Lime) .Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿDataDynamics.ActiveReportsÿ_ ÿ .Chart.Graphics.Line(Color.Transparent,ÿ0,ÿDataDynamics.ActiveReports.Chartÿ_ ÿ .Graphics.LineStyle.None),ÿ0,ÿColor.Black) .EndValueÿ=ÿ34 .PrimaryAxisÿ=ÿ((CType(Me.ChartControl1.ChartAreas(0).Axes("AxisY"),ÿDataDynamicsÿ_ ÿ .ActiveReports.Chart.Axis))) .StartValueÿ=ÿ33 EndÿWith WithÿwallRange3 .Backdropÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(Color.DarkGreen,ÿ_ ÿ CType(150,ÿByte)) .Borderÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Border(NewÿDataDynamics.ActiveReportsÿ_ ÿ .Chart.Graphics.Line(Color.Transparent,ÿ0,ÿDataDynamics.ActiveReports.Chartÿ_ ÿ .Graphics.LineStyle.None),ÿ0,ÿColor.Black) .EndValueÿ=ÿ40 .PrimaryAxisÿ=ÿ((CType(Me.ChartControl1.ChartAreas(0).Axes("AxisZ"),ÿDataDynamicsÿ_ ÿ .ActiveReports.Chart.Axis))) .StartValueÿ=ÿ20 EndÿWith

'ÿaddÿtheÿwallÿrangesÿtoÿtheÿchartÿareaÿandÿsetÿwallÿandÿZÿaxisÿpropertiesÿtoÿshowÿlines WithÿChartControl1.ChartAreas(0) .WallRanges.AddRange(NewÿDataDynamics.ActiveReports.Chart.WallRange()ÿ{wallRange1,ÿ_ ÿ wallRange2,ÿwallRange3}) .WallXY.Backdrop.Alphaÿ=ÿ100 .WallXZ.Backdrop.Alphaÿ=ÿ100 .WallYZ.Backdrop.Alphaÿ=ÿ100 .Axes(4).MajorTick.Stepÿ=ÿ20 .Axes(4).Maxÿ=ÿ60 .Axes(4).Minÿ=ÿ0 .Axes(4).Visibleÿ=ÿTrue EndÿWith //ÿC# //ÿcreateÿtheÿwallÿrangeÿobjects DataDynamics.ActiveReports.Chart.WallRangeÿwallRange1ÿ=ÿnewÿDataDynamics.ActiveReports .Chart.WallRange(); DataDynamics.ActiveReports.Chart.WallRangeÿwallRange2ÿ=ÿnewÿDataDynamics.ActiveReports .Chart.WallRange(); DataDynamics.ActiveReports.Chart.WallRangeÿwallRange3ÿ=ÿnewÿDataDynamics.ActiveReports .Chart.WallRange();

//ÿsetÿtheÿwallÿrangeÿproperties wallRange1.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawing .Color.White); wallRange1.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿDataDynamics .ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent,ÿ0,ÿDataDynamics .ActiveReports.Chart.Graphics.LineStyle.None),ÿ0,ÿSystem.Drawing.Color.Black); wallRange1.EndValueÿ=ÿ40; wallRange1.PrimaryAxisÿ=ÿ(DataDynamics.ActiveReports.Chart.Axis)this.ChartControl1 .ChartAreas[0].Axes["AxisY"]; wallRange1.StartValueÿ=ÿ30; wallRange2.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawing ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ81

.Color.Lime); wallRange2.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿDataDynamics .ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent,ÿ0,ÿDataDynamics .ActiveReports.Chart.Graphics.LineStyle.None),ÿ0,ÿSystem.Drawing.Color.Black); wallRange2.EndValueÿ=ÿ34; wallRange2.PrimaryAxisÿ=ÿ(DataDynamics.ActiveReports.Chart.Axis)this.ChartControl1 .ChartAreas[0].Axes["AxisY"]; wallRange2.StartValueÿ=ÿ33; wallRange3.Backdropÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Backdrop(System.Drawing .Color.DarkGreen); wallRange3.Borderÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Border(newÿDataDynamics .ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent,ÿ0,ÿDataDynamics .ActiveReports.Chart.Graphics.LineStyle.None),ÿ0,ÿSystem.Drawing.Color.Black); wallRange3.EndValueÿ=ÿ40; wallRange3.PrimaryAxisÿ=ÿ(DataDynamics.ActiveReports.Chart.Axis)this.ChartControl1 .ChartAreas[0].Axes["AxisZ"]; wallRange3.StartValueÿ=ÿ20;

//ÿaddÿtheÿwallÿrangesÿtoÿtheÿchartÿareaÿÿandÿsetÿwallÿandÿZÿaxisÿpropertiesÿtoÿshowÿlines this.ChartControl1.ChartAreas[0].WallRanges.AddRange(newÿDataDynamics.ActiveReports.Chart .WallRange[]ÿ{wallRange1,wallRange2,wallRange3}); this.ChartControl1.ChartAreas[0].WallXY.Backdrop.Alphaÿ=ÿ100; this.ChartControl1.ChartAreas[0].WallXZ.Backdrop.Alphaÿ=ÿ100; this.ChartControl1.ChartAreas[0].WallYZ.Backdrop.Alphaÿ=ÿ100; this.ChartControl1.ChartAreas[0].Axes[4].MajorTick.Stepÿ=ÿ20; this.ChartControl1.ChartAreas[0].Axes[4].Maxÿ=ÿ60; this.ChartControl1.ChartAreas[0].Axes[4].Minÿ=ÿ0; this.ChartControl1.ChartAreas[0].Axes[4].Visibleÿ=ÿtrue;ÿ ÿ

ChartÿAxesÿandÿWalls

TheseÿtopicsÿwillÿintroduceÿyouÿtoÿsomeÿbasicÿinformationÿaboutÿChartÿaxesÿandÿwalls. ÿ StandardÿAxes Learnÿaboutÿtheÿpropertiesÿandÿcharacteristicsÿofÿstandardÿaxes.ÿ CustomÿAxes Learnÿaboutÿhowÿtoÿcreateÿcustomÿaxes.ÿ

ÿ GridlinesÿandÿTickÿMarks Learnÿaboutÿusingÿgridlinesÿandÿtickÿmarks.ÿ

StandardÿAxes

TheÿChartÿcontrolÿprovidesÿtheÿmeansÿtoÿchangeÿaxisÿsettingsÿatÿdesignÿtimeÿorÿrunÿtime.ÿChartÿaxesÿmakeÿitÿ possibleÿtoÿviewÿandÿunderstandÿtheÿdataÿplottedÿinÿaÿgraph. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ82

AxisÿTypes Mostÿ2Dÿchartsÿcontainÿaÿnumericalÿaxisÿ(AxisY)ÿandÿaÿcategoricalÿaxisÿ(AxisX).ÿ3Dÿchartsÿincludeÿanotherÿ numericalÿaxisÿ(AxisZ).ÿTheseÿaxesÿareÿaccessibleÿatÿrunÿtimeÿfromÿtheÿChartAreaÿobjectÿandÿallowÿyouÿtoÿ controlÿtheÿsettingsÿforÿeach,ÿincludingÿscaling,ÿlabels,ÿandÿvariousÿformattingÿproperties.ÿForÿanyÿofÿtheÿ scalingÿorÿlabelingÿpropertiesÿyouÿsetÿtoÿshowÿupÿatÿrunÿtime,ÿyouÿwillÿneedÿtoÿsetÿtheÿVisibleÿpropertyÿofÿtheÿ axisÿtoÿTrue.

ChangingÿAxisÿSettings AxisÿsettingsÿcanÿbeÿchangedÿatÿdesignÿtimeÿbyÿclickingÿonÿaÿChartÿcontrolÿandÿusingÿtheÿPropertiesÿWindowÿ orÿatÿrunÿtimeÿinÿcodeÿfromÿtheÿchart'sÿChartAreaÿobject.

Scaling Forÿnormalÿlinearÿscalingÿonÿaÿnumericÿaxis,ÿyouÿwillÿneedÿtoÿsetÿtheÿMaxÿandÿMinÿpropertiesÿforÿtheÿaxis,ÿ whichÿcorrespondÿtoÿtheÿnumericalÿvaluesÿinÿtheÿchart'sÿdataÿseries.ÿYouÿwillÿalsoÿneedÿtoÿsetÿtheÿStepÿ propertyÿofÿtheÿMajorTickÿtoÿshowÿtheÿmajorÿnumericalÿunitÿvalues.ÿTheÿStepÿpropertyÿcontrolsÿwhereÿlabelsÿ and/orÿtickÿmarksÿareÿshownÿonÿtheÿnumericalÿaxis. 'ÿVisualÿBasic WithÿMe.ChartControl1.ChartAreas(0).Axes("AxisY") .Maxÿ=ÿ100 .Minÿ=ÿ0 .MajorTick.Stepÿ=ÿ10 EndÿWith

//ÿC# this.ChartControl1.ChartAreas[0].Axes["AxisY"].Maxÿ=ÿ100; this.ChartControl1.ChartAreas[0].Axes["AxisY"].Minÿ=ÿ0; this.ChartControl1.ChartAreas[0].Axes["AxisY"].MajorTick.Stepÿ=ÿ10; TheÿChartÿcontrolÿalsoÿsupportsÿlogarithmicÿscalingÿwhichÿallowsÿyouÿtoÿshowÿtheÿverticalÿspacingÿbetweenÿ twoÿpointsÿthatÿcorrespondsÿtoÿtheÿpercentageÿofÿchangeÿbetweenÿthoseÿnumbers.ÿYouÿcanÿsetÿyourÿnumericÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ83 axisÿtoÿscaleÿlogarithmicallyÿbyÿsettingÿtheÿIsLogarithmicÿpropertyÿonÿtheÿaxisÿtoÿTrueÿandÿsettingÿtheÿMaxÿandÿ Minÿpropertiesÿofÿtheÿaxis.ÿ

Labeling Toÿshowÿlabelsÿonÿanÿaxis,ÿyouÿwillÿneedÿtoÿspecifyÿtheÿvalueÿforÿtheÿLabelsGapÿproperty,ÿsetÿyourÿLabelsFontÿ properties,ÿandÿsetÿLabelsVisibleÿtoÿTrue.ÿTheseÿpropertiesÿcanÿbeÿsetÿinÿtheÿAxisBaseÿCollectionÿeditor,ÿwhichÿ isÿaccessedÿatÿdesignÿtimeÿbyÿclickingÿtheÿellipsisÿbuttonÿnextÿtoÿtheÿChartAreasÿ(Collection)ÿproperty,ÿthenÿ theÿAxesÿ(Collection)ÿpropertyÿofÿtheÿChartArea.ÿ NOTE: Labelsÿrenderÿfirst,ÿandÿthenÿtheÿchartÿfillsÿinÿtheÿremainingÿarea,ÿsoÿbeÿsureÿtoÿmakeÿtheÿ chartÿlargeÿenoughÿifÿyouÿuseÿangledÿlabels. YouÿcanÿspecifyÿstringsÿtoÿbeÿusedÿforÿtheÿlabelsÿinsteadÿofÿnumericalÿvaluesÿonÿanÿaxisÿbyÿusingÿtheÿLabelsÿ collectionÿpropertyÿatÿdesignÿtimeÿorÿassigningÿaÿstringÿarrayÿtoÿtheÿLabelsÿpropertyÿatÿrunÿtime.ÿYouÿcanÿalsoÿ specifyÿwhetherÿyouÿwantÿyourÿaxisÿlabelsÿtoÿappearÿonÿtheÿoutsideÿorÿinsideÿofÿtheÿaxisÿlineÿusingÿtheÿ LabelsInsideÿproperty.ÿByÿdefault,ÿlabelsÿappearÿoutsideÿtheÿaxisÿline.

SecondaryÿAxes Byÿdefault,ÿaÿChartÿobjectÿincludesÿsecondaryÿXÿandÿYÿaxesÿ(AxisX2ÿandÿAxisY2).ÿAtÿdesignÿtimeÿorÿrunÿtime,ÿ youÿcanÿspecifyÿaÿsecondaryÿaxisÿtoÿplotÿdataÿagainstÿbyÿsettingÿallÿofÿtheÿappropriateÿpropertiesÿforÿAxisX2ÿorÿ AxisY2,ÿincludingÿtheÿVisibleÿproperty.ÿ Ifÿyouÿwantÿtoÿuseÿtwoÿaxesÿtoÿshowÿtheÿsameÿdataÿasÿitÿappearsÿonÿtwoÿdifferentÿscales,ÿyouÿcanÿsetÿ theÿprimaryÿaxisÿtoÿshowÿtheÿactualÿdataÿvalueÿscale,ÿforÿexample,ÿandÿsetÿtheÿsecondaryÿaxisÿtoÿshowÿaÿ logarithmicÿscale. 'ÿVisualÿBasic 'ÿsetÿpropertiesÿforÿAxisYÿ(primaryÿaxis) WithÿMe.ChartControl1.ChartAreas(0).Axes("AxisY") .Maxÿ=ÿ25 .Minÿ=ÿ0 .MajorTick.Stepÿ=ÿ5 EndÿWith

'ÿsetÿpropertiesÿforÿAxisY2ÿ(secondaryÿYÿaxis) WithÿMe.ChartControl1.ChartAreas(0).Axes("AxisY2") .Maxÿ=ÿ1000 .Minÿ=ÿ0 .MajorTick.Stepÿ=ÿ200 'ÿsetÿtheÿscalingÿforÿtheÿsecondaryÿaxisÿtoÿlogarithmic .AxisTypeÿ=ÿDataDynamics.ActiveReports.Chart.AxisType.Logarithmic .Visibleÿ=ÿTrue EndÿWith

//ÿC# //ÿsetÿpropertiesÿforÿAxisYÿ(primaryÿaxis) this.ChartControl1.ChartAreas[0].Axes["AxisY"].Maxÿ=ÿ25; this.ChartControl1.ChartAreas[0].Axes["AxisY"].Minÿ=ÿ0; this.ChartControl1.ChartAreas[0].Axes["AxisY"].MajorTick.Stepÿ=ÿ5;

//ÿsetÿpropertiesÿforÿAxisY2ÿ(secondaryÿYÿaxis) this.ChartControl1.ChartAreas[0].Axes["AxisY2"].Maxÿ=ÿ1000; this.ChartControl1.ChartAreas[0].Axes["AxisY2"].Minÿ=ÿ0; this.ChartControl1.ChartAreas[0].Axes["AxisY2"].MajorTick.Stepÿ=ÿ200; //ÿsetÿtheÿaxisÿtypeÿforÿtheÿsecondaryÿaxisÿtoÿlogarithmic this.ChartControl1.ChartAreas[0].Axes["AxisY2"].AxisTypeÿ=ÿDataDynamics.ActiveReports.Chart ÿ .AxisType.Logarithmic; this.ChartControl1.ChartAreas[0].Axes["AxisY2"].Visibleÿ=ÿtrue;

CustomÿAxes

TheÿChartÿcontrolÿsupportsÿtheÿcreationÿofÿadditionalÿcustomÿaxesÿthroughÿtheÿuseÿofÿtheÿchart'sÿCustomAxesÿ collection.ÿÿOnceÿaÿcustomÿaxisÿhasÿbeenÿaddedÿtoÿtheÿcollection,ÿinÿadditionÿtoÿsettingÿtheÿnormalÿaxisÿ properties,ÿyouÿwillÿneedÿtoÿsetÿtheÿfollowingÿproperties:ÿ

l Parentÿ- TheÿParentÿpropertyÿallowsÿyouÿtoÿchooseÿtheÿprimaryÿorÿsecondaryÿaxisÿonÿwhichÿyourÿcustomÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ84

axisÿresides.ÿ l PlacementLengthÿ- TheÿPlacementLengthÿpropertyÿallowsÿyouÿtoÿsetÿtheÿlengthÿofÿtheÿcustomÿaxisÿinÿ proportionÿtoÿtheÿMinÿandÿMaxÿpropertyÿvaluesÿyouÿhaveÿalreadyÿsetÿforÿtheÿparentÿaxis.ÿ

l PlacementLocationÿ- TheÿPlacementLocationÿpropertyÿallowsÿyouÿtoÿsetÿtheÿstartingÿlocationÿvalueÿforÿtheÿ customÿaxisÿtoÿappearÿinÿrelationÿtoÿtheÿparentÿaxis.ÿ

Theÿfollowingÿcodeÿsampleÿdemonstratesÿcreatingÿaÿcustomÿaxis,ÿaddingÿitÿtoÿtheÿAxesÿcollectionÿforÿtheÿ ChartArea,ÿandÿsettingÿitsÿproperties. 'ÿVisualÿBasicÿ 'ÿcreateÿtheÿcustomÿaxisÿandÿaddÿitÿtoÿtheÿChartArea'sÿAxesÿcollection DimÿcustomAxisYÿAsÿNewÿDataDynamics.ActiveReports.Chart.CustomAxis Me.ChartControl1.ChartAreas(0).Axes.Add(customAxisY)

'ÿsetÿtheÿbasicÿaxisÿpropertiesÿforÿcustomAxisY customAxisY.LabelFontÿ=ÿNewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.Red,ÿNewÿFontÿ_ ("Arial",ÿ7.0!)) customAxisY.LabelsGapÿ=ÿ1 customAxisY.LabelsVisibleÿ=ÿTrue customAxisY.Lineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(Color.Red) customAxisY.MajorTickÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Tick(NewÿDataDynamicsÿ_ .ActiveReports.Chart.Graphics.Line(Color.Red,ÿ1),ÿNewÿDataDynamics.ActiveReports.Chartÿ_ .Graphics.Line(Color.Red,ÿ1),ÿ1,ÿ2.0F,ÿTrue) customAxisY.MajorTick.GridLineÿ=ÿNewÿDataDynamics.ActiveReports.Chart.Graphics.Line(Colorÿ_ .Red,ÿ1,ÿLineStyle.Solid) customAxisY.MajorTick.Visibleÿ=ÿTrue customAxisY.Maxÿ=ÿ5 customAxisY.MaxDerivedÿ=ÿFalse customAxisY.Minÿ=ÿ0 customAxisY.Visibleÿ=ÿTrue

'ÿsetÿtheÿspecialÿcustomÿaxisÿproperties customAxisY.Parentÿ=ÿ((CType(Me.ChartControl1.ChartAreas(0).Axes("AxisY"),ÿDataDynamicsÿ_ .ActiveReports.Chart.Axis))) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ85 customAxisY.PlacementLengthÿ=ÿ20 customAxisY.PlacementLocationÿ=ÿ30

//ÿC# //ÿcreateÿtheÿcustomÿaxisÿandÿaddÿitÿtoÿtheÿChartArea'sÿAxesÿcollection DataDynamics.ActiveReports.Chart.CustomAxisÿcustomAxisYÿ=ÿnewÿDataDynamics.ActiveReports .Chart.CustomAxis(); this.ChartControl1.ChartAreas[0].Axes.Add(customAxisY);

//ÿsetÿtheÿbasicÿaxisÿpropertiesÿforÿcustomAxisY customAxisY.LabelFontÿ=ÿnewÿDataDynamics.ActiveReports.Chart.FontInfo(Color.Red,ÿnewÿFont ("Arial",ÿ7F,ÿFontStyle.Regular,ÿGraphicsUnit.Point,ÿ((System.Byte)(0)))); customAxisY.LabelsGapÿ=ÿ1; customAxisY.LabelsVisibleÿ=ÿtrue; customAxisY.Lineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(Color.Red); customAxisY.MajorTickÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Tick(newÿDataDynamics .ActiveReports.Chart.Graphics.Line(Color.Red,ÿ1),ÿnewÿDataDynamics.ActiveReports.Chart .Graphics.Line(Color.Red,ÿ1),ÿ1,ÿ2F,ÿtrue); customAxisY.MajorTick.GridLineÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Graphics.Line(Color .Red,ÿ1,ÿLineStyle.Solid); customAxisY.MajorTick.Visibleÿ=ÿtrue; customAxisY.Maxÿ=ÿ5; customAxisY.MaxDerivedÿ=ÿfalse; customAxisY.Minÿ=ÿ0; customAxisY.Visibleÿ=ÿtrue;

//ÿsetÿtheÿspecialÿcustomÿaxisÿproperties customAxisY.Parentÿ=ÿ(DataDynamics.ActiveReports.Chart.Axis)this.ChartControl1.ChartAreas[0] .Axes["AxisY"]; customAxisY.PlacementLengthÿ=ÿ20; customAxisY.PlacementLocationÿ=ÿ30;ÿ ÿ

GridÿlinesÿandÿTickÿMarks

Gridlinesÿandÿtickÿmarksÿareÿgenerallyÿusedÿtoÿhelpÿincreaseÿtheÿreadabilityÿofÿaÿchart.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ86

Types ThereÿareÿtwoÿkindsÿofÿgridlinesÿandÿtickÿmarksÿinÿtheÿChartÿcontrol:ÿmajorÿandÿminor.ÿTheÿpropertiesÿforÿtheÿ majorÿgridlinesÿandÿtickÿmarksÿareÿsetÿonÿtheÿMajorTickÿobjectÿofÿtheÿparticularÿaxisÿandÿtheÿpropertiesÿforÿ minorÿgridlinesÿandÿticksÿareÿsetÿonÿtheÿMinorTickÿobjectÿofÿtheÿaxis.ÿTheÿlocationÿforÿanyÿlabelsÿshownÿforÿtheÿ axisÿareÿdeterminedÿbyÿtheÿStepÿpropertyÿofÿtheÿMajorTickÿobject.

StepÿandÿTickLength ForÿeitherÿtheÿMajorTickÿorÿMinorTickÿobjects,ÿyouÿcanÿdefineÿwhereÿtheÿtickÿmarksÿandÿgridlinesÿwillÿappearÿ byÿsettingÿtheÿStepÿproperty.ÿTheÿTickLengthÿpropertyÿallowsÿyouÿtoÿsetÿhowÿfarÿoutsideÿofÿtheÿaxisÿlineÿtheÿ tickÿmarkÿwillÿextend.ÿ

Visible Toÿmakeÿanyÿdefinedÿmajorÿorÿminorÿtickÿmarksÿtoÿshowÿupÿatÿdesignÿtimeÿorÿrunÿtime,ÿtheÿVisibleÿpropertyÿofÿ theÿMajorTickÿorÿMinorTickÿobjectÿmustÿbeÿsetÿtoÿTrue.ÿToÿshowÿmajorÿorÿminorÿgridlinesÿatÿdesignÿtimeÿorÿrunÿ time,ÿtheÿVisibleÿpropertyÿofÿtheÿWallXYÿobjectÿasÿwellÿasÿthatÿofÿtheÿMajorTickÿorÿMinorTickÿobjectÿmustÿbeÿ

setÿtoÿTrue.ÿ ÿ

ChartÿData

TheseÿtopicsÿintroduceÿyouÿtoÿsomeÿbasicÿinformationÿaboutÿboundÿandÿunboundÿdataÿsupportÿinÿtheÿChartÿ control. ÿ BoundÿData LearnÿaboutÿdataÿbindingÿwithÿtheÿChartÿcontrol.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ87

UnboundÿData Learnÿhowÿtoÿuseÿunboundÿdata.ÿ CalculatedÿandÿSequenceÿSeries LearnÿaboutÿusingÿcalculatedÿandÿsequenceÿseriesÿinÿtheÿChartÿcontrol.ÿ

NOTE: TheÿChartÿcontrolÿhasÿitsÿownÿdataÿsourceÿwhichÿisÿdistinctÿfromÿtheÿreportÿdataÿsource.ÿÿToÿ ÿ accessÿtheÿchart'sÿdataÿsource,ÿclickÿtheÿDataÿSource. hyperlinkÿwhichÿappearsÿbelowÿtheÿPropertiesÿ windowÿwhenÿtheÿchartÿisÿselectedÿonÿtheÿreport.

DataÿBoundÿCharts

TheÿChartÿcontrolÿprovidesÿseveralÿwaysÿtoÿbindÿyourÿchartsÿtoÿdataÿatÿdesignÿtime.

AddingÿDataÿwithÿtheÿWizard ToÿopenÿtheÿChartÿWizard,ÿclickÿtheÿWizardÿverbÿbelowÿtheÿPropertiesÿwindow.ÿInÿtheÿChartÿWizard,ÿonceÿyouÿ haveÿaddedÿaÿseries,ÿyouÿcanÿcreateÿaÿdataÿadapterÿtoÿcontainÿtheÿdataÿforÿyourÿchart,ÿifÿneeded.ÿWhenÿaÿ dataÿsourceÿisÿavailable,ÿtheÿValueÿXÿandÿYÿvaluesÿcanÿbeÿsetÿforÿtheÿseriesÿinÿtheÿchartÿwizardÿfromÿtheÿ expressionsÿand/orÿdataÿcolumnsÿretrievedÿfromÿtheÿdataÿsource.

AddingÿDataÿwithÿtheÿChartÿDesigner Onceÿaÿdataÿsourceÿisÿsetÿup,ÿyouÿcanÿeasilyÿbindÿdataÿtoÿaÿseriesÿusingÿtheÿChartÿDesigner.ÿToÿopenÿtheÿ ChartÿDesigner,ÿclickÿtheÿCustomizeÿverbÿbelowÿtheÿPropertiesÿwindow.ÿChooseÿtheÿSeriesÿsectionÿonÿtheÿleft,ÿ andÿonÿtheÿGeneralÿtab,ÿafterÿaÿseriesÿhasÿbeenÿaddedÿtoÿtheÿchart,ÿsetÿtheÿValueYÿpropertyÿbyÿselectingÿtheÿ nameÿofÿtheÿdataÿexpressionÿyouÿwishÿtoÿassignÿtoÿtheÿseries. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ88

AddingÿDataÿthroughÿtheÿChartÿDataÿSourceÿDialog ToÿsetÿtheÿdataÿsourceÿforÿtheÿchartÿthroughÿtheÿChartÿDataÿSourceÿdialog,ÿclickÿtheÿDataSourceÿverbÿbelowÿ theÿPropertiesÿWindow. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ89

AfterÿtheÿDataSourceÿforÿtheÿchartÿisÿset,ÿaddÿaÿseriesÿtoÿtheÿchart.ÿToÿdoÿthis,ÿopenÿtheÿSeriesÿCollectionÿ EditorÿdialogÿbyÿclickingÿtheÿellipsisÿbuttonÿwhichÿappearsÿwhenÿyouÿclickÿnextÿtoÿtheÿSeriesÿpropertyÿinÿtheÿ PropertiesÿWindow,ÿthenÿclickÿtheÿ"Add"ÿbutton.ÿToÿbindÿtheÿseriesÿtoÿanÿexpressionÿorÿdatasetÿcolumnÿ returnedÿbyÿyourÿdataÿsource,ÿsetÿtheÿValueMembersYÿorÿValueMembersXÿpropertyÿofÿtheÿseriesÿbyÿselectingÿ itÿfromÿtheÿdrop-downÿlist. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ90

ÿ

UnboundÿCharts

TheÿChartÿcontrolÿmakesÿitÿeasyÿtoÿsetÿtheÿdataÿsourceÿforÿaÿchartÿcontrol,ÿseries,ÿorÿdataÿpointsÿcollectionÿatÿ runÿtime. Belowÿisÿaÿlistÿofÿobjectsÿthatÿcanÿbeÿusedÿasÿdataÿsources. l datasetÿ l datasetÿColumnÿ

l DataÿTableÿ l SqlCommand/OleDbCommandÿ l SqlDataAdapter/OleDbDataAdapterÿ

l Arrayÿ ÿ Belowÿareÿsomeÿexamplesÿofÿbindingÿtoÿdifferentÿdataÿsourcesÿatÿrunÿtime. dataset TheÿChartÿcontrol'sÿDataSourceÿpropertyÿcanÿbeÿsetÿtoÿaÿdatasetÿatÿrunÿtime.ÿTheÿfollowingÿcodeÿ demonstratesÿsettingÿupÿaÿdataset,ÿsettingÿtheÿDataSourceÿpropertyÿtoÿtheÿdataset,ÿcreatingÿaÿseries,ÿandÿ settingÿtheÿValueMembersYÿpropertyÿtoÿtheÿdatasetÿexpressionÿatÿrunÿtime. 'ÿVisualÿBasic 'ÿcreateÿtheÿseries DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series Dimÿm_cnnStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;ÿ_ PersistÿSecurityÿInfo=False" ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ91

Dimÿm_cnnÿAsÿNewÿSystem.Data.OleDb.OleDbConnection(m_cnnString) DimÿoDBAdapterÿAsÿSystem.Data.OleDb.OleDbDataAdapter

'ÿcreateÿtheÿdataset DimÿoDSÿAsÿDataSet oDBAdapterÿ=ÿNewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿShipCountry,ÿSUM(Freight)ÿASÿ_ Expr1ÿFROMÿOrdersÿGROUPÿBYÿShipCountry",ÿm_cnnString) oDSÿ=ÿNewÿDataSet oDBAdapter.Fill(oDS,ÿ"Expr1")

'ÿsetÿtheÿDataSourceÿandÿValueMembersYÿproperties Me.ChartControl1.DataSourceÿ=ÿoDS s.ValueMembersYÿ=ÿ"Expr1"

Me.ChartControl1.Series.Add(s) ÿ //ÿC# //ÿcreateÿtheÿseries DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); stringÿm_cnnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;Persistÿ SecurityÿInfo=False";ÿÿÿ System.Data.OleDb.OleDbConnectionÿm_cnnÿ=ÿnewÿSystem.Data.OleDb.OleDbConnection(m_cnnString);ÿÿÿÿÿÿÿ System.Data.OleDb.OleDbDataAdapterÿoDBAdapter;

//ÿcreateÿtheÿdataset System.Data.DataSetÿoDS; oDBAdapterÿ=ÿnewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿShipCountry,ÿSUM(Freight)ÿASÿ Expr1ÿFROMÿOrdersÿGROUPÿBYÿShipCountry",ÿm_cnnString); oDSÿ=ÿnewÿSystem.Data.DataSet(); oDBAdapter.Fill(oDS,ÿ"Expr1");

//ÿsetÿtheÿDataSourceÿandÿValueMembersYÿproperties this.ChartControl1.DataSourceÿ=ÿoDS; s.ValueMembersYÿ=ÿ"Expr1"; this.ChartControl1.Series.Add(s); datasetÿColumn InÿtheÿChartÿcontrol,ÿtheÿValueMembersXÿandÿValueMembersYÿpropertiesÿofÿaÿseriesÿcanÿbeÿsetÿtoÿaÿdatasetÿ column.ÿTheÿfollowingÿcodeÿdemonstratesÿcreatingÿaÿseries,ÿsettingÿupÿaÿdataset,ÿsettingÿtheÿDataSourceÿ propertyÿtoÿtheÿdataset,ÿandÿsettingÿtheÿValueMembersYÿandÿValueMembersXÿpropertiesÿtoÿdatasetÿcolumnsÿ atÿrunÿtime. 'ÿVisualÿBasic 'ÿcreateÿtheÿseries DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series Dimÿm_cnnStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;ÿ_ PersistÿSecurityÿInfo=False" Dimÿm_cnnÿAsÿNewÿSystem.Data.OleDb.OleDbConnection(m_cnnString) DimÿoDBAdapterÿAsÿSystem.Data.OleDb.OleDbDataAdapter

'ÿcreateÿtheÿdataset DimÿoDSÿAsÿDataSet oDBAdapterÿ=ÿNewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿ*ÿfromÿOrdersÿWHEREÿOrderDateÿ_ <ÿ#08/17/1994#",ÿm_cnnString) oDSÿ=ÿNewÿDataSet oDBAdapter.Fill(oDS,ÿ"Orders")

'ÿsetÿtheÿDataSource,ÿValueMembersY,ÿandÿValueMembersXÿproperties Me.ChartControl1.DataSourceÿ=ÿoDS Me.ChartControl1.Series.Add(s) Me.ChartControl1.Series(0).ValueMembersYÿ=ÿoDS.Tables("Orders").Columns(7).ColumnName Me.ChartControl1.Series(0).ValueMemberXÿ=ÿoDS.Tables("Orders").Columns(8).ColumnName ÿ //ÿC# //ÿcreateÿtheÿseries ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ92

DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); stringÿm_cnnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;Persistÿ SecurityÿInfo=False";ÿÿÿ System.Data.OleDb.OleDbConnectionÿm_cnnÿ=ÿnewÿSystem.Data.OleDb.OleDbConnection(m_cnnString);ÿÿÿÿÿÿÿ System.Data.OleDb.OleDbDataAdapterÿoDBAdapter;

//ÿcreateÿtheÿdataset System.Data.DataSetÿoDS; oDBAdapterÿ=ÿnewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿ*ÿfromÿOrdersÿWHEREÿOrderDateÿ <ÿ#08/17/1994#",ÿm_cnnString); oDSÿ=ÿnewÿSystem.Data.DataSet(); oDBAdapter.Fill(oDS,ÿ"Orders");

//ÿsetÿtheÿDataSource,ÿValueMembersY,ÿandÿValueMembersXÿproperties this.ChartControl1.DataSourceÿ=ÿoDS; this.ChartControl1.Series.Add(s); this.ChartControl1.Series[0].ValueMembersYÿ=ÿoDS.Tables["Orders"].Columns[7].ColumnName; this.ChartControl1.Series[0].ValueMemberXÿ=ÿoDS.Tables["Orders"].Columns[8].ColumnName;

DataÿCommand Aÿchart'sÿdataÿsourceÿcanÿbeÿsetÿtoÿaÿSqlCommandÿorÿOleDbCommand.ÿTheÿfollowingÿcodeÿdemonstratesÿ creatingÿaÿseries,ÿcreatingÿanÿOleDbCommand,ÿsettingÿtheÿDataSourceÿpropertyÿtoÿtheÿdataÿcommand,ÿandÿ settingÿtheÿValueMembersYÿpropertyÿforÿtheÿseriesÿatÿrunÿtime. 'ÿVisualÿBasicÿÿÿÿÿÿÿÿ 'ÿcreateÿtheÿseries DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series Dimÿm_cnnStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;ÿ_ PersistÿSecurityÿInfo=False" Dimÿm_cnnÿAsÿNewÿSystem.Data.Oledb.OleDbConnection(m_cnnString) DimÿqueryÿAsÿStringÿ=ÿ"SELECTÿShipCountry,ÿSUM(Freight)ÿASÿExpr1ÿFROMÿOrdersÿGROUPÿBYÿ_ ShipCountry"

'ÿcreateÿtheÿOleDbCommandÿandÿopenÿtheÿconnection DimÿcommandÿAsÿNewÿSystem.Data.Oledb.OleDbCommand(query,ÿm_cnn) command.Connection.Open()

'ÿsetÿtheÿDataSourceÿandÿValueMembersYÿproperties Me.ChartControl1.DataSourceÿ=ÿcommand Me.ChartControl1.Series.Add(s) Me.ChartControl1.Series(0).ValueMembersYÿ=ÿ"Expr1"

'ÿcloseÿtheÿconnection m_cnn.Close()

//ÿC# //ÿcreateÿtheÿseries DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); stringÿm_cnnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;Persistÿ SecurityÿInfo=False";ÿÿÿ System.Data.Oledb.OleDbConnectionÿm_cnnÿ=ÿnewÿSystem.Data.Oledb.OleDbConnection(m_cnnString);ÿÿÿÿÿÿÿ stringÿqueryÿ=ÿ"SELECTÿShipCountry,ÿSUM(Freight)ÿASÿExpr1ÿFROMÿOrdersÿGROUPÿBYÿShipCountry";

//ÿcreateÿtheÿOleDbCommandÿandÿopentÿtheÿconnection System.Data.Oledb.OleDbCommandÿcommandÿ=ÿnewÿSystem.Data.Oledb.OleDbCommand(query,ÿm_cnn); command.Connection.Open();

//ÿsetÿtheÿDataSourceÿandÿValueMembersYÿproperties this.ChartControl1.DataSourceÿ=ÿcommand; this.ChartControl1.Series.Add(s); this.ChartControl1.Series[0].ValueMembersYÿ=ÿ"Expr1";

//ÿcloseÿtheÿconnectionÿÿÿÿÿÿÿÿÿ m_cnn.Close();

Array TheÿChartÿcontrolÿallowsÿtheÿdataÿsourceÿforÿtheÿdataÿpointsÿcollectionÿtoÿbeÿsetÿtoÿanÿarray.ÿTheÿfollowingÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ93 codeÿdemonstratesÿcreatingÿaÿseries,ÿcreatingÿanÿarray,ÿandÿusingÿtheÿDataBindYÿmethodÿtoÿsetÿtheÿdataÿ sourceÿforÿtheÿdataÿpointsÿcollectionÿatÿrunÿtime. 'ÿVisualÿBasic 'ÿcreateÿtheÿseries DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series

'ÿcreateÿtheÿarray DimÿaÿAsÿDouble()ÿ=ÿ{1,ÿ4,ÿ2,ÿ6,ÿ3,ÿ3,ÿ4,ÿ7}

'ÿsetÿtheÿdataÿsourceÿforÿtheÿdataÿpointsÿcollection Me.ChartControl1.Series.Add(s) Me.ChartControl1.Series(0).Points.DataBindY(a) ÿ //ÿC# //ÿcreateÿtheÿseries DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series();

//ÿcreateÿtheÿarray doubleÿ[]ÿaÿ=ÿ{1,4,2,6,3,3,4,7};

//ÿsetÿtheÿdataÿsourceÿforÿtheÿdataÿpointsÿcollection this.ChartControl1.Series.Add(s); this.ChartControl1.Series[0].Points.DataBindY(a);ÿ ÿ

CalculatedÿandÿSequenceÿSeriesÿCharts

TheÿChartÿcontrolÿallowsÿyouÿtoÿbindÿaÿformulaÿtoÿtheÿValueMembersYÿpropertyÿofÿaÿseriesÿtoÿcreateÿaÿ calculatedÿorÿsequenceÿseriesÿforÿyourÿchart.

CalculatedÿSeries Youÿcanÿeasilyÿcreateÿaÿcalculatedÿseriesÿbasedÿonÿtheÿvaluesÿofÿoneÿorÿmoreÿseriesÿbyÿsettingÿtheÿ ValueMembersYÿpropertyÿofÿaÿseriesÿtoÿaÿformula.ÿToÿreferenceÿaÿseriesÿinÿtheÿformula,ÿuseÿtheÿnameÿofÿtheÿ series.ÿTheÿfollowingÿcodeÿdemonstratesÿcreatingÿtwoÿseries,ÿoneÿboundÿtoÿaÿdataÿarrayÿandÿtheÿotherÿboundÿ toÿaÿformulaÿbasedÿonÿtheÿYÿvaluesÿofÿtheÿfirstÿseries. 'ÿVisualÿBasic DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series DimÿcSÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series DimÿaÿAsÿDouble()ÿ=ÿ{1,ÿ4,ÿ2,ÿ6,ÿ3,ÿ3,ÿ4,ÿ7}

Me.ChartControl1.Series.AddRange(NewÿDataDynamics.ActiveReports.Chart.Series()ÿ{s,ÿcS}) Me.ChartControl1.Series(0).Points.DataBindY(a) Me.ChartControl1.Series(0).Nameÿ=ÿ"Series1" Me.ChartControl1.Series(1).ValueMembersYÿ=ÿ"Series1.Y[0]+10" ÿ //ÿC# DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); DataDynamics.ActiveReports.Chart.SeriesÿcSÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); doubleÿ[]ÿaÿ=ÿ{ÿ1,4,2,6,3,3,4,7}; ÿ this.ChartControl1.Series.AddRange(newÿDataDynamics.SharpGraph.Windows.Series[]ÿ{s,ÿcS}); this.ChartControl1.Series[0].Nameÿ=ÿ"Series1"; this.ChartControl1.Series[0].Points.DataBindY(a); this.ChartControl1.Series[1].ValueMembersYÿ=ÿ"Series1.Y[0]+10";

SequenceÿSeries Setÿaÿsequenceÿseriesÿbyÿspecifyingÿtheÿminimumÿvalue,ÿmaximumÿvalue,ÿandÿstepÿforÿtheÿseries.ÿTheÿ followingÿcodeÿshowsÿhowÿtoÿsetÿtheÿValueMembersYÿpropertyÿatÿrunÿtimeÿtoÿcreateÿaÿsequenceÿseries. 'ÿVisualÿBasic DimÿsÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ94

Me.ChartControl1.Series.Add(s) Me.ChartControl1.Series(0).ValueMembersYÿ=ÿ"sequence(12,48,4)" ÿ //ÿC# DataDynamics.ActiveReports.Chart.Seriesÿsÿ=ÿnewÿDataDynamics.ActiveReports.Chart.Series(); this.ChartControl1.Series.Add(s);ÿ this.ChartControl1.Series[0].ValueMembersYÿ=ÿ"sequence(12,48,4)";

Chart-SpecificÿProperties

EachÿchartÿtypeÿinÿtheÿActiveReportsÿChartÿcontrolÿcontainsÿspecificÿpropertiesÿthatÿapplyÿtoÿit.ÿSetÿtheÿchartÿ typeÿandÿchart-specificÿpropertiesÿinÿtheÿSeriesÿCollectionÿEditorÿdialogÿboxÿaccessedÿthroughÿtheÿSeriesÿ propertyÿinÿtheÿpropertyÿgridÿandÿinÿtheÿDataPointÿCollectionÿdialogÿboxÿaccessedÿthroughÿtheÿPointsÿpropertyÿ inÿtheÿSeriesÿdialogÿbox. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ95 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ96

WhenÿaÿspecificÿpropertyÿisÿsetÿonÿtheÿSeriesÿobject,ÿitÿisÿappliedÿtoÿallÿdataÿpointsÿobjectsÿinÿtheÿseriesÿunlessÿ aÿdifferentÿvalueÿforÿtheÿpropertyÿhasÿbeenÿsetÿonÿaÿspecificÿdataÿpoint.ÿInÿthatÿcase,ÿtheÿdataÿpointÿpropertyÿ settingÿoverridesÿtheÿseriesÿpropertyÿsettingÿforÿthatÿparticularÿdataÿpoint.ÿNoteÿthatÿforÿchartsÿboundÿtoÿaÿ dataÿsource,ÿyouÿdoÿnotÿhaveÿaccessÿtoÿtheÿDataPointÿcollectionÿinÿtheÿdialog.

Settingÿchart-specificÿpropertiesÿatÿdesignÿtime Toÿsetÿcustomÿpropertiesÿforÿaÿchartÿatÿdesignÿtime,ÿsetÿtheÿPropertiesÿattributeÿofÿtheÿseriesÿorÿdataÿpointsÿ objectÿfromÿtheÿVisualÿStudioÿ.NETÿPropertiesÿWindowÿbyÿclickingÿonÿtheÿSeriesÿ(Collection)ÿpropertyÿandÿ openingÿtheÿSeriesÿCollectionÿEditorÿdialog.ÿ Note: Ifÿyouÿspecifyÿtheÿvalueÿforÿanyÿofÿtheÿcustomÿproperties,ÿthisÿvalueÿisÿnotÿclearedÿwhenÿ youÿchangeÿtheÿChartType.ÿAlthoughÿthisÿwillÿshowÿpropertiesÿthatÿdoÿnotÿapplyÿtoÿcertainÿChartTypes,ÿ itÿhasÿtheÿadvantageÿofÿkeepingÿyourÿsettingsÿinÿcaseÿyouÿaccidentallyÿchangeÿtheÿChartType.

Settingÿchart-specificÿpropertiesÿatÿrunÿtime Toÿsetÿcustomÿpropertiesÿforÿaÿchartÿatÿrunÿtimeÿonÿtheÿseries,ÿreferenceÿtheÿseriesÿbyÿnameÿorÿindexÿandÿuseÿ theÿstringÿPropertiesÿattributeÿnameÿyouÿwishÿtoÿset.ÿ 'ÿVisualÿBasic 'ÿSetsÿtheÿshapeÿforÿbubblesÿonÿaÿbubbleÿchartÿtoÿdiamond Me.ChartControl1.Series(0).Properties("Shape")ÿ=ÿChart.MarkerStyle.Diamond //ÿC# //ÿSetsÿtheÿshapeÿforÿbubblesÿonÿaÿbubbleÿchartÿtoÿdiamond this.ChartControl1.Series[0].Properties["Shape"]ÿ=ÿDataDynamics.ActiveReports.Chartÿ .MarkerStyle.Diamond; Toÿsetÿcustomÿpropertiesÿforÿaÿchartÿatÿrunÿtimeÿonÿtheÿdataÿpointsÿobject,ÿreferenceÿtheÿseriesÿbyÿnameÿorÿ index,ÿreferenceÿtheÿdataÿpointÿbyÿindexÿandÿuseÿtheÿstringÿPropertiesÿattributeÿnameÿyouÿwishÿtoÿset.ÿ 'ÿVisualÿBasic 'ÿSetsÿtheÿexplodeÿfactorÿonÿaÿdoughnutÿchartÿforÿtheÿsecondÿpointÿinÿtheÿseries ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ97

Me.ChartControl1.Series(0).Points(1).Properties("ExplodeFactor")ÿ=ÿ0.5F //ÿC# //ÿSetsÿtheÿexplodeÿfactorÿonÿaÿdoughnutÿchartÿforÿtheÿsecondÿpointÿinÿtheÿseries this.ChartControl1.Series[0].Points[1].Properties["ExplodeFactor"]ÿ=ÿ.5f;ÿ

ChartÿStandardÿProperties l Backdrop:ÿGetsÿorÿsetsÿtheÿbackdropÿinformationÿforÿtheÿseries.ÿDoesÿnotÿapplyÿtoÿBezier,ÿLine,ÿLineXY,ÿ Line3D,ÿPlotXY,ÿorÿScatterÿcharts.ÿ l BorderLine:ÿGetsÿorÿsetsÿtheÿlineÿinformationÿusedÿtoÿdrawÿtheÿborderÿofÿtheÿseries.ÿDoesÿnotÿapplyÿtoÿ Bezier,ÿLine,ÿLineXY,ÿPlotXY,ÿorÿScatterÿcharts.ÿ l Line:ÿGetsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿseries.ÿOnlyÿappliesÿtoÿBezier,ÿLine,ÿandÿLineXYÿcharts.ÿ

l Marker:ÿGetsÿorÿsetsÿtheÿToolTipÿsettingsÿforÿtheÿseries.ÿ

l ToolTip:ÿGetsÿorÿsetsÿtheÿToolTipÿinformationÿforÿtheÿseries.ÿ ÿ

ChartsÿandÿCustomÿProperties l Area (none)ÿÿÿ l Area3D

¡ LineBackdrop Getsÿorÿsetsÿtheÿbackdropÿinformationÿforÿtheÿ3Dÿline.ÿ ¡ Thickness Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿline.ÿ ¡ Width Getsÿorÿsetsÿtheÿwidthÿofÿtheÿ3Dÿline.ÿ

l Bar2D ¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ

l Bar3D

¡ BarTopPercent GetsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿ BarTypes.ÿ ¡ BarType Getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed.ÿValuesÿareÿBar,ÿCylinder,ÿCone,ÿPyramid,ÿ andÿCustom.ÿ ¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ

¡ PointBarDepth Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿbar.ÿ

¡ RotationAngle Getsÿorÿsetsÿtheÿstartingÿhorizontalÿangleÿforÿcustomÿ3Dÿbarÿshapes.ÿCanÿonlyÿbeÿ usedÿwithÿtheÿCustomÿBarType.ÿ ¡ VertexNumber Getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdataÿpoint,ÿusedÿtoÿcreateÿcustomÿ3Dÿbarÿ shapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿBarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ l Bezier (none)ÿ l Bubble

¡ MaxSizeFactor Getsÿorÿsetsÿtheÿmaximumÿsizeÿofÿtheÿbubbleÿradius.ÿValuesÿmustÿbeÿlessÿthanÿorÿ equalÿtoÿ1.ÿDefaultÿisÿ.25.ÿ

¡ MaxValue Getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿmaximum.ÿ ¡ MinValue Getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿminimum.ÿ

¡ Shape Getsÿorÿsetsÿtheÿshapeÿofÿtheÿbubbles.ÿUsesÿorÿreturnsÿaÿvalidÿMarkerStyleÿenumerationÿvalue.ÿ l BubbleXY ¡ MaxSizeFactor Getsÿorÿsetsÿtheÿmaximumÿsizeÿofÿtheÿbubbleÿradius.ÿValuesÿmustÿbeÿlessÿthanÿorÿ equalÿtoÿ1.ÿDefaultÿisÿ.25.ÿ

¡ MaxValue Getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿmaximum.ÿ

¡ MinValue Getsÿorÿsetsÿtheÿbubbleÿsizeÿthatÿisÿusedÿasÿtheÿminimum.ÿ ¡ Shape Getsÿorÿsetsÿtheÿshapeÿofÿtheÿbubbles.ÿUsesÿorÿreturnsÿaÿvalidÿMarkerStyleÿenumerationÿvalue.ÿ

l Candle ¡ BodyDownswingBackdrop Getsÿorÿsetsÿtheÿbackdropÿinformationÿusedÿtoÿfillÿtheÿdownswingÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ98

rectangle.ÿ ¡ BodyUpswingBackdrop Getsÿorÿsetsÿtheÿbackdropÿinformationÿusedÿtoÿfillÿtheÿupswingÿrectangle.ÿ

¡ BodyWidth Getsÿorÿsetsÿtheÿwidthÿofÿtheÿrectangleÿusedÿtoÿshowÿupswingÿorÿdownswing.ÿ ¡ Wickline Getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿwickÿline. l ClusteredBar

¡ BarTopPercent GetsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿ BarTypes.ÿ ¡ BarType Getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed.ÿValuesÿareÿBar,ÿCylinder,ÿCone,ÿPyramid,ÿ andÿCustom.ÿ ¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ ¡ PointBarDepth Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿbar.ÿ

¡ RotationAngle Getsÿorÿsetsÿtheÿstartingÿhorizontalÿangleÿforÿcustomÿ3Dÿbarÿshapes.ÿCanÿonlyÿbeÿ usedÿwithÿtheÿCustomÿBarType.ÿ

¡ VertexNumber Getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdataÿpoint,ÿusedÿtoÿcreateÿcustomÿ3Dÿbarÿ shapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿBarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ l Doughnutÿ ¡ ExplodeFactor Getsÿorÿsetsÿtheÿamountÿofÿseparationÿbetweenÿdataÿpointÿvalues.ÿTheÿvalueÿmustÿbeÿ lessÿthanÿorÿequalÿtoÿ1.ÿToÿexplodeÿoneÿsectionÿofÿtheÿdoughnutÿchart,ÿsetÿExplodeFactorÿonÿtheÿdataÿ pointÿinsteadÿofÿonÿtheÿseries.ÿ ¡ HoleSize Getsÿorÿsetsÿtheÿinnerÿradiusÿofÿtheÿchart.ÿIfÿsetÿtoÿ0,ÿtheÿchartÿlooksÿlikeÿaÿpieÿchart.ÿTheÿ valueÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1.ÿ ¡ OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿpointÿlabelsÿappearÿoutsideÿtheÿ chart. ¡ StartAngle Getsÿorÿsetsÿtheÿhorizontalÿstartÿangleÿforÿtheÿseries. l Doughnut3Dÿ ¡ ExplodeFactor Getsÿorÿsetsÿtheÿamountÿofÿseparationÿbetweenÿdataÿpointÿvalues.ÿTheÿvalueÿmustÿbeÿ lessÿthanÿorÿequalÿtoÿ1.ÿToÿexplodeÿoneÿsectionÿofÿtheÿdoughnutÿchart,ÿsetÿExplodeFactorÿonÿtheÿdataÿ pointÿinsteadÿofÿonÿtheÿseries.ÿ ¡ HoleSize Getsÿorÿsetsÿtheÿinnerÿradiusÿofÿtheÿchart.ÿIfÿsetÿtoÿ0,ÿtheÿchartÿlooksÿlikeÿaÿpieÿchart.ÿTheÿ valueÿmustÿbeÿlessÿthanÿorÿequalÿtoÿ1.ÿ ¡ OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿpointÿlabelsÿappearÿoutsideÿtheÿ chart.ÿ ¡ StartAngle Getsÿorÿsetsÿtheÿhorizontalÿstartÿangleÿforÿtheÿseriesÿdataÿpoints.ÿ l Funnel ¡ BaseStyle Getsÿorÿsetsÿaÿcircularÿorÿsquareÿbaseÿdrawingÿstyleÿforÿtheÿ3Dÿfunnelÿchart.ÿThisÿpropertyÿ canÿonlyÿbeÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿOrthogonal.ÿ ¡ CalloutLine Getsÿorÿsetsÿtheÿstyleÿforÿaÿlineÿconnectingÿtheÿmarkerÿlabelÿtoÿitsÿcorrespondingÿfunnelÿ section.ÿTheÿdefaultÿvalueÿisÿaÿblackÿone-pointÿline.ÿ ¡ FunnelStyle GetsÿorÿsetsÿtheÿYÿvalueÿforÿtheÿseriesÿpointsÿtoÿtheÿwidthÿorÿheightÿofÿtheÿfunnel.ÿTheÿ defaultÿvalueÿisÿYIsHeight.ÿ ¡ MinPointHeight Getsÿorÿsetsÿtheÿminimumÿheightÿallowedÿforÿaÿdataÿpointÿinÿtheÿfunnelÿchart.ÿTheÿ heightÿisÿmeasuredÿinÿrelativeÿcoordinates.ÿ ¡ NeckHeight Getsÿorÿsetsÿtheÿneckÿheightÿforÿtheÿfunnelÿchart.ÿThisÿpropertyÿcanÿonlyÿbeÿusedÿwithÿ theÿFunnelStyleÿpropertyÿsetÿtoÿYIsHeight.ÿTheÿdefaultÿvalueÿisÿ5.ÿ

¡ NeckWidth Getsÿorÿsetsÿtheÿneckÿwidthÿforÿtheÿfunnelÿchart.ÿThisÿpropertyÿcanÿonlyÿbeÿusedÿwithÿtheÿ FunnelStyleÿpropertyÿsetÿtoÿYIsHeight.ÿTheÿdefaultÿvalueÿisÿ5.ÿ

¡ OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿlabelsÿareÿplacedÿoutsideÿofÿtheÿfunnelÿ chart.ÿTheÿdefaultÿvalueÿisÿTrue.ÿ

¡ OutsideLabelsPlacement Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿpointÿlabelsÿappearÿonÿ theÿleftÿorÿrightÿsideÿofÿtheÿfunnel.ÿThisÿpropertyÿcanÿonlyÿbeÿusedÿwithÿtheÿOutsideLabelsÿpropertyÿsetÿ toÿTrue.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ99

¡ PointGapPct Getsÿorÿsetsÿtheÿamountÿofÿspaceÿbetweenÿtheÿdataÿpointsÿofÿtheÿfunnelÿchart.ÿTheÿ PointGapPctÿisÿmeasuredÿinÿrelativeÿcoordinates.ÿTheÿdefaultÿvalueÿisÿ0,ÿandÿvalidÿvaluesÿrangeÿfromÿ0ÿ toÿ100.ÿ

¡ RotationAngle Getsÿorÿsetsÿtheÿleft-to -rightÿrotationÿangleÿofÿtheÿfunnel.ÿTheÿvalidÿvaluesÿrangeÿfromÿ -180ÿtoÿ180ÿdegrees.ÿThisÿpropertyÿisÿonlyÿeffectiveÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿOrthogonalÿ andÿtheÿBaseStyleÿpropertyÿsetÿtoÿSquareBase. l Gantt ¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ l HiLo

¡ HiLoLine Getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿhi-loÿline.ÿ l HiLoOpenClose

¡ HiLoLine Getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿhi-loÿline.ÿ

¡ CloseLine Getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿcloseÿline.ÿ ¡ OpenLine Getsÿorÿsetsÿtheÿlineÿinformationÿforÿtheÿopenÿline.ÿ

¡ TickLen Getsÿorÿsetsÿtheÿlengthÿofÿtheÿtickÿforÿtheÿopenÿandÿcloseÿlines. l HorizontalBar ¡ GapÿGetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue. l HorizontalBar3D ¡ BarTopPercent GetsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿ BarTypes.ÿ ¡ BarType Getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed.ÿValuesÿareÿBar,ÿCylinder,ÿCone,ÿPyramid,ÿ andÿCustom.ÿ ¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ

¡ PointBarDepth Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿbar. l Kagi ¡ BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿthree-dimensionalÿsideÿ viewÿofÿdownswingÿKagiÿlines.ÿThisÿpropertyÿisÿonlyÿavailableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿisÿonlyÿ effectiveÿwhenÿtheÿWidthÿpropertyÿisÿsetÿtoÿaÿvalueÿhigherÿthanÿ25.ÿ ¡ BodyUpswingBackdropÿGetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿthree -dimensionalÿsideÿviewÿ ofÿupswingÿKagiÿlines.ÿThisÿpropertyÿisÿonlyÿavailableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿisÿonlyÿeffectiveÿ whenÿtheÿWidthÿpropertyÿisÿsetÿtoÿaÿvalueÿhigherÿthanÿ25.ÿ ¡ DownswingLine GetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿtoÿuseÿforÿaÿKagiÿlineÿwhichÿchartsÿaÿpriceÿ decrease.ÿ ¡ ReversalAmount GetsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿorderÿforÿtheÿKagiÿlineÿtoÿchangeÿ direction.ÿ ¡ UpswingLine GetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿtoÿuseÿforÿaÿKagiÿlineÿwhichÿchartsÿaÿpriceÿ increase.ÿ ¡ Width Getsÿorÿsetsÿtheÿwidthÿofÿtheÿthree-dimensionalÿsideÿviewÿofÿtheÿKagiÿlines.Thisÿpropertyÿisÿ onlyÿavailableÿwithÿtheÿKagiÿ3Dÿchartÿtype,ÿandÿmustÿbeÿsetÿhigherÿthanÿitsÿdefaultÿvalueÿofÿ1ÿinÿorderÿ toÿdisplayÿbodyÿdownswingÿandÿupswingÿbackdrops. l Lineÿ(none)ÿ l Line3D ¡ LineBackdrop Getsÿorÿsetsÿtheÿbackdropÿinformationÿforÿtheÿ3Dÿline.ÿ ¡ Thickness Getsÿorÿsetsÿtheÿthicknessÿofÿtheÿ3Dÿline.ÿ

¡ Width Getsÿorÿsetsÿtheÿwidthÿofÿtheÿ3Dÿline.ÿ l LineXY (none)ÿ l PlotXY (none)ÿ l PointÿandÿFigure ¡ BoxSize GetsÿorÿsetsÿtheÿamountÿaÿpriceÿmustÿchangeÿinÿorderÿtoÿcreateÿanotherÿXÿorÿO.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ100

¡ DownswingLine GetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿdownswingÿOs.ÿ ¡ ReversalAmount Getsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿorderÿforÿaÿnewÿcolumnÿtoÿbeÿ added.ÿ

¡ UpswingLine GetsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿupswingÿXs. l Pyramid ¡ BaseStyle Getsÿorÿsetsÿaÿcircularÿorÿsquareÿbaseÿdrawingÿstyleÿforÿtheÿ3Dÿpyramidÿchart.ÿThisÿ propertyÿcanÿonlyÿbeÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿOrthogonal.ÿ ¡ MinPointHeight Getsÿorÿsetsÿtheÿminimumÿheightÿallowedÿforÿaÿdataÿpointÿinÿtheÿpyramidÿchart.ÿTheÿ heightÿisÿmeasuredÿinÿrelativeÿcoordinates.ÿ ¡ OutsideLabels Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿlabelsÿareÿplacedÿoutsideÿofÿtheÿpyramidÿ chart.ÿTheÿdefaultÿvalueÿisÿTrue.ÿ

¡ OutsideLabelsPlacement Getsÿorÿsetsÿaÿvalueÿindicatingÿwhetherÿtheÿdataÿpointÿlabelsÿappearÿonÿ theÿleftÿorÿrightÿsideÿofÿtheÿpyramid.ÿThisÿpropertyÿcanÿonlyÿbeÿusedÿwithÿtheÿOutsideLabelsÿpropertyÿ setÿtoÿTrue.ÿ ¡ PointGapPct Getsÿorÿsetsÿtheÿamountÿofÿspaceÿbetweenÿtheÿdataÿpointsÿofÿtheÿpyramidÿchart.ÿTheÿ PointGapPctÿisÿmeasuredÿinÿrelativeÿcoordinates.ÿTheÿdefaultÿvalueÿisÿ0,ÿandÿvalidÿvaluesÿrangeÿfromÿ0ÿ toÿ100.ÿ ¡ RotationAngle Getsÿorÿsetsÿtheÿleft-to -rightÿrotationÿangleÿofÿtheÿpyramid.ÿTheÿvalidÿvaluesÿrangeÿ fromÿ-180ÿtoÿ180ÿdegrees.ÿThisÿpropertyÿisÿonlyÿeffectiveÿwithÿtheÿProjectionÿpropertyÿsetÿtoÿ OrthogonalÿandÿtheÿBaseStyleÿpropertyÿsetÿtoÿSquareBase. l Renko

¡ BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿdownswingÿbricks.ÿ

¡ BodyUpswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿupswingÿbricks.ÿ ¡ BoxSize Getsÿorÿsetsÿtheÿamountÿaÿpriceÿmustÿchangeÿinÿorderÿtoÿcreateÿanotherÿbrick.ÿ l Scatter (none)ÿ l StackedArea (none)ÿ l StackedBar

¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ l StackedBar3D ¡ BarTopPercent GetsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿ BarTypes.ÿ

¡ BarType Getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed.ÿValuesÿareÿBar,ÿCylinder,ÿCone,ÿPyramid,ÿ andÿCustom.ÿ

¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ ¡ VertexNumber Getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdataÿpoint,ÿusedÿtoÿcreateÿcustomÿ3Dÿbarÿ shapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿBarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ l StackedArea100Pct (none)ÿ l StackedBar100Pct

¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue. l StackedBar3D100Pct

¡ BarTopPercent GetsÿorÿsetsÿtheÿpercentageÿofÿtheÿtopÿofÿtheÿbarÿthatÿisÿshownÿforÿConeÿorÿCustomÿ BarTypes.ÿ

¡ BarType Getsÿorÿsetsÿtheÿtypeÿofÿbarsÿthatÿareÿdisplayed.ÿValuesÿareÿBar,ÿCylinder,ÿCone,ÿPyramid,ÿ andÿCustom.ÿ

¡ Gap GetsÿorÿsetsÿtheÿspaceÿbetweenÿtheÿbarsÿofÿeachÿXÿaxisÿvalue.ÿ ¡ VertexNumber Getsÿorÿsetsÿtheÿnumberÿofÿverticesÿforÿtheÿdataÿpoint,ÿusedÿtoÿcreateÿcustomÿ3Dÿbarÿ shapes.ÿCanÿonlyÿbeÿusedÿwithÿtheÿCustomÿBarType.ÿBarsÿmustÿcontainÿ3ÿorÿmoreÿvertices.ÿ l ThreeÿLineÿBreak

¡ BodyDownswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿdownswingÿboxes.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ101

¡ BodyUpswingBackdrop Getsÿorÿsetsÿtheÿstyleÿandÿcolorÿsettingsÿforÿtheÿupswingÿboxes.ÿ

ÿ ¡ NewLineBreak Getsÿorÿsetsÿtheÿamountÿthatÿaÿpriceÿmustÿshiftÿinÿorderÿforÿtheÿdirectionÿtoÿchange.ÿ Theÿdefaultÿvalueÿisÿ3.ÿ

ChartÿWizard

Theÿchartÿcontrolÿfeaturesÿanÿeasy-to-useÿwizard.ÿTheÿchartÿwizardÿautomaticallyÿrunsÿwhenÿyouÿfirstÿaddÿaÿ chartÿcontrolÿtoÿaÿreport.ÿIfÿyouÿpreferÿnotÿtoÿhaveÿtheÿwizardÿrunÿautomatically,ÿuncheckÿtheÿAutoÿRunÿ Wizardÿcheckboxÿatÿtheÿbottomÿofÿtheÿwizard.ÿYouÿcanÿalsoÿaccessÿtheÿwizardÿthroughÿtheÿWizardÿverbÿÿthatÿ appearsÿbelowÿtheÿPropertiesÿwindowÿwhenÿtheÿchartÿisÿselectedÿonÿtheÿreport.

ÿ

SectionÿEvents

ActiveReportsÿSectionÿEvents Inÿaÿreport,ÿregardlessÿofÿtheÿtypeÿorÿcontentÿofÿtheÿvariousÿsections,ÿthereÿareÿthreeÿeventsÿforÿeachÿsection:ÿ Format,ÿBeforePrintÿandÿAfterPrint.ÿ Becauseÿthereÿareÿmanyÿpossibleÿreportÿdesigns,ÿtheÿevent-raisingÿsequenceÿmustÿbeÿdynamicÿinÿorderÿtoÿ accommodateÿindividualÿreportÿdemands.ÿ Outÿofÿtheÿthreeÿevents,ÿtheÿFormatÿeventÿgenerallyÿisÿusedÿtheÿmostÿoften,ÿfollowedÿbyÿtheÿBeforePrintÿeventÿ and,ÿinÿrareÿcircumstances,ÿtheÿAfterPrintÿevent.ÿ Note: Youÿshouldÿneverÿreferenceÿtheÿreport'sÿFieldsÿcollectionÿinÿtheseÿsectionÿevents.ÿTheÿ DataInitializeÿandÿFetchDataÿeventsÿareÿtheÿonlyÿeventsÿinÿwhichÿtheÿFieldsÿcollectionÿshouldÿeverÿbeÿ referenced.

Formatÿevent Thisÿeventÿisÿraisedÿafterÿtheÿdataÿisÿloadedÿandÿboundÿtoÿtheÿcontrolsÿcontainedÿinÿaÿsection,ÿbutÿbeforeÿtheÿ sectionÿisÿrenderedÿtoÿaÿpage. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ102

TheÿFormatÿeventÿisÿtheÿonlyÿeventÿwhereÿtheÿsection'sÿheightÿmayÿbeÿchanged.ÿThisÿsectionÿmayÿbeÿusedÿtoÿ setÿorÿchangeÿtheÿpropertiesÿofÿanyÿcontrolsÿorÿloadÿsubreportÿcontrolsÿwithÿsubreports. IfÿtheÿCanGrowÿorÿCanShrinkÿpropertyÿofÿanyÿcontrolÿcontainedÿwithinÿaÿsection,ÿorÿtheÿsectionÿitself,ÿisÿsetÿtoÿ True,ÿallÿofÿtheÿgrowingÿandÿshrinkingÿofÿcontrolsÿcontainedÿinÿthisÿsection,ÿandÿtheÿsectionÿitself,ÿtakesÿplaceÿ inÿtheÿFormatÿevent.ÿBecauseÿofÿthis,ÿinformationÿaboutÿaÿcontrolÿorÿaÿsection'sÿheightÿcannotÿbeÿobtainedÿinÿ thisÿevent.

BeforePrintÿevent Thisÿeventÿisÿraisedÿbeforeÿtheÿsectionÿisÿrenderedÿtoÿtheÿpage.ÿ Theÿgrowingÿandÿshrinkingÿofÿtheÿsectionÿandÿallÿcontrolsÿcontainedÿinÿaÿsectionÿhaveÿalreadyÿtakenÿplaceÿbyÿ theÿtimeÿthisÿeventÿisÿraised.ÿUseÿthisÿsectionÿtoÿresizeÿanyÿcontrolsÿifÿneeded. Sinceÿallÿcontrolsÿandÿsectionÿgrowthÿhaveÿalreadyÿtakenÿplaceÿbyÿtheÿtimeÿthisÿeventÿisÿraised,ÿtheÿeventÿmayÿ beÿusedÿtoÿgetÿanÿaccurateÿheightÿofÿtheÿsection,ÿor,ÿifÿneeded,ÿanyÿcontrolsÿcontainedÿinÿit.ÿAnyÿcontrolsÿinÿ theÿBeforePrintÿeventÿmayÿbeÿresizedÿbutÿnotÿtheÿheightÿofÿtheÿsectionÿitself.

AfterPrintÿevent Thisÿeventÿisÿraisedÿafterÿtheÿsectionÿisÿrenderedÿtoÿtheÿpage. AlthoughÿAfterPrintÿwasÿanÿimportantÿeventÿpriorÿtoÿActiveReportsÿVersionÿ1ÿServiceÿPackÿ3,ÿitÿisÿrarelyÿusedÿ inÿanyÿofÿtheÿnewerÿbuildsÿofÿActiveReports.ÿWhenÿyouÿplaceÿcodeÿinÿtheÿsectionÿevents,ÿyouÿlikelyÿwillÿplaceÿ yourÿcodeÿinÿeitherÿtheÿFormatÿeventÿorÿtheÿBeforePrintÿevent.ÿThisÿeventÿisÿstillÿusefulÿforÿdrawingÿonÿtheÿÿ pageÿafterÿtextÿhasÿalreadyÿbeenÿrenderedÿtoÿtheÿpage.

SequenceÿofÿEvents

ActiveReportsÿEvents

EventsÿthatÿareÿRaisedÿOnlyÿOnce Theÿfollowingÿeventsÿareÿallÿofÿtheÿeventsÿthatÿareÿraisedÿonlyÿonceÿduringÿaÿreport'sÿprocessing.ÿTheseÿ eventsÿareÿraisedÿatÿtheÿbeginningÿandÿatÿtheÿendÿofÿtheÿreportÿprocessingÿcycle.ÿ

ReportStartÿ ThisÿeventÿisÿraisedÿbeforeÿtheÿDataInitializeÿevent.ÿUseÿthisÿeventÿtoÿinitializeÿanyÿobjectsÿorÿvariablesÿneededÿ whileÿrunningÿaÿreport.ÿAlsoÿuseÿthisÿeventÿtoÿsetÿanyÿSubreportÿcontrolÿobjectsÿtoÿaÿnewÿinstanceÿofÿtheÿ reportÿassignedÿtoÿtheÿSubreportÿcontrol.ÿDoÿnotÿaddÿitemsÿdynamicallyÿtoÿaÿreportÿonceÿthisÿeventÿhasÿ finished.ÿ

DataInitializeÿ ThisÿeventÿisÿraisedÿafterÿReportStart.ÿUseÿitÿtoÿaddÿcustomÿfieldsÿtoÿtheÿreport'sÿFieldsÿcollection.ÿCustomÿ fieldsÿcanÿbeÿaddedÿtoÿaÿboundÿreportÿ(oneÿthatÿusesÿaÿDataÿControlÿtoÿconnectÿandÿretrieveÿrecords)ÿorÿanÿ unboundÿreportÿ(oneÿthatÿdoesÿnotÿdependÿonÿaÿdataÿcontrolÿtoÿgetÿitsÿrecords).ÿInÿaÿboundÿreportÿtheÿdatasetÿ isÿopenedÿandÿtheÿdatasetÿfieldsÿareÿaddedÿtoÿtheÿcustomÿfieldsÿcollection,ÿthenÿtheÿDataInitializeÿeventÿ isÿraisedÿsoÿnewÿcustomÿfieldsÿcanÿbeÿadded.ÿTheÿDataInitializeÿeventÿcanÿalsoÿbeÿusedÿtoÿmakeÿadjustmentsÿ toÿtheÿDataSourceÿorÿtoÿsetÿupÿdatabaseÿconnectivity.ÿ

ReportEndÿ Thisÿeventÿisÿraisedÿafterÿtheÿreportÿfinishesÿprocessing.ÿUseÿthisÿeventÿtoÿcloseÿorÿfreeÿanyÿobjectsÿthatÿyouÿ wereÿusingÿwhileÿrunningÿaÿreportÿinÿunboundÿmode,ÿorÿtoÿdisplayÿinformationÿorÿmessagesÿtoÿtheÿendÿuser.ÿ Thisÿeventÿcanÿalsoÿbeÿusedÿtoÿexportÿreports.ÿ

EventsÿthatÿareÿRaisedÿMultipleÿTimes TheÿfollowingÿActiveReportsÿeventsÿareÿraisedÿmultipleÿtimesÿduringÿaÿreport'sÿprocessing.ÿ FetchDataÿ Thisÿeventÿisÿraisedÿeveryÿtimeÿaÿnewÿrecordÿisÿprocessed.ÿTheÿFetchDataÿhasÿanÿEOFÿparameterÿindicatingÿ whetherÿtheÿFetchDataÿeventÿshouldÿbeÿraised.ÿThisÿparameterÿisÿnotÿtheÿsameÿasÿtheÿRecordset'sÿEOFÿ propertyÿandÿisÿdefaultedÿtoÿTrue.ÿWhenÿworkingÿwithÿboundÿreportsÿ(reportsÿusingÿaÿDataControl),ÿtheÿEOFÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ103 parameterÿisÿautomaticallyÿsetÿbyÿtheÿreport;ÿhowever,ÿwhenÿworkingÿwithÿunboundÿreportsÿthisÿparameterÿ needsÿtoÿbeÿcontrolledÿmanually.ÿ

UseÿtheÿFetchDataÿeventÿwithÿunboundÿreportsÿtoÿsetÿtheÿvaluesÿofÿcustomÿfieldsÿthatÿwereÿaddedÿinÿtheÿ DataInitializeÿeventÿorÿwithÿboundÿreportsÿtoÿperformÿspecialÿfunctions,ÿsuchÿasÿcombiningÿfieldsÿtogetherÿorÿ performingÿcalculations.ÿTheÿFetchDataÿeventÿshouldÿnotÿhaveÿanyÿreferencesÿtoÿcontrolsÿonÿtheÿreport.ÿ IfÿyouÿneedÿtoÿuseÿaÿvalueÿfromÿaÿDatasetÿwithÿaÿcontrolÿinÿtheÿDetailÿsection,ÿsetÿaÿvariableÿinÿtheÿFetchDataÿ eventÿandÿuseÿtheÿvariableÿinÿtheÿsection'sÿFormatÿeventÿtoÿsetÿtheÿvalueÿforÿtheÿcontrol.ÿPleaseÿnoteÿthatÿthisÿ methodÿofÿsettingÿaÿvariableÿinÿtheÿFetchDataÿeventÿandÿusingÿitÿtoÿsetÿaÿcontrol'sÿvalueÿisÿonlyÿsupportedÿinÿ theÿDetail_Formatÿevent. AlsoÿuseÿtheÿFetchDataÿeventÿtoÿincrementÿcountersÿwhenÿworkingÿwithÿarraysÿorÿcollections.ÿ

PageStartÿ Thisÿeventÿfiresÿbeforeÿaÿpageÿisÿrendered.ÿUseÿthisÿeventÿtoÿinitializeÿanyÿvariablesÿneededÿforÿeachÿpageÿ whenÿrunningÿanÿunboundÿreport.ÿ

PageEndÿ Thisÿeventÿisÿraisedÿafterÿeachÿpageÿinÿtheÿreportÿisÿrendered.ÿUseÿthisÿeventÿtoÿupdateÿanyÿvariablesÿneededÿ forÿeachÿpageÿwhenÿrunningÿanÿunboundÿreport.ÿ

SectionÿEvents Thereÿareÿthreeÿeventsÿthatÿareÿraisedÿforÿeachÿsection,ÿregardlessÿofÿitsÿtypeÿorÿcontent.ÿTheÿsequenceÿofÿ theseÿeventsÿdependsÿonÿtheÿsummaryÿobjectsÿandÿtheirÿsectionÿdependencies.ÿTheÿonlyÿguaranteedÿ sequenceÿisÿthatÿaÿsection'sÿFormatÿeventÿisÿraisedÿbeforeÿtheÿBeforePrintÿevent,ÿwhichÿinÿturnÿoccursÿbeforeÿ theÿAfterPrintÿeventÿbutÿnotÿnecessarilyÿallÿtogether.ÿReportsÿshouldÿnotÿbeÿdesignedÿtoÿrelyÿonÿtheseÿ eventsÿbeingÿraisedÿinÿimmediateÿsuccession.ÿNeverÿaccessÿaÿreport'sÿFieldsÿcollectionÿinÿanyÿofÿtheseÿsectionÿ events,ÿbutÿratherÿinÿtheÿDataInitializeÿandÿFetchDataÿevents.

Formatÿ Thisÿeventÿisÿraisedÿafterÿdataÿisÿloadedÿandÿboundÿtoÿtheÿfieldsÿbutÿbeforeÿtheÿsectionÿisÿlaidÿoutÿforÿprinting.ÿ Useÿthisÿeventÿtoÿmodifyÿtheÿlayoutÿofÿaÿsectionÿorÿanyÿofÿtheÿcontrolsÿinÿtheÿsection.ÿThisÿisÿtheÿonlyÿeventÿinÿ whichÿaÿsection'sÿheightÿcanÿbeÿchanged.ÿAlsoÿuseÿtheÿFormatÿeventÿtoÿpassÿinformation,ÿsuchÿasÿanÿSQLÿ String,ÿtoÿaÿSubreport.ÿBecauseÿaÿsection'sÿheightÿisÿunknownÿuntilÿtheÿFormatÿeventÿfinishes,ÿitÿisÿpossibleÿ forÿaÿsection'sÿFormatÿeventÿtoÿbeÿraisedÿwhileÿtheÿreportÿisÿonÿaÿpageÿtoÿwhichÿtheÿsectionÿisÿnotÿrendered.ÿ Forÿexample,ÿtheÿDetail_Formatÿeventÿisÿraisedÿbutÿtheÿsectionÿisÿtooÿlargeÿtoÿfitÿonÿtheÿpage.ÿThisÿcausesÿtheÿ PageFooterÿeventÿandÿtheÿPageEndÿeventÿtoÿbeÿraisedÿonÿtheÿcurrentÿpage,ÿandÿtheÿPageStart,ÿanyÿotherÿ Headerÿevents,ÿandÿpossiblyÿtheÿFetchDataÿeventÿtoÿbeÿraisedÿbeforeÿtheÿsectionÿisÿrenderedÿtoÿtheÿcanvasÿonÿ theÿnextÿpage.ÿ

BeforePrintÿ Thisÿeventÿisÿraisedÿbeforeÿtheÿsectionÿisÿrenderedÿtoÿtheÿpage.ÿYouÿcanÿuseÿthisÿeventÿtoÿmodifyÿtheÿvaluesÿofÿ theÿcontrolsÿbeforeÿtheyÿareÿprinted.ÿAnyÿchangesÿmadeÿhereÿwillÿnotÿaffectÿtheÿheightÿofÿtheÿsection.ÿWeÿ recommendÿthatÿyouÿdoÿNOTÿaccessÿanyÿfieldsÿinÿaÿDataSource'sÿdatasetÿinÿthisÿevent.ÿAlsoÿuseÿthisÿeventÿtoÿ doÿpageÿspecificÿformattingÿsinceÿtheÿreportÿknowsÿwhichÿpageÿtheÿsectionÿwillÿbeÿrenderedÿtoÿwhenÿthisÿeventÿ isÿraised.ÿOnceÿthisÿeventÿhasÿfinished,ÿtheÿsectionÿcannotÿbeÿchangedÿinÿanyÿwayÿbecauseÿtheÿsectionÿisÿ renderedÿtoÿtheÿcanvasÿimmediatelyÿafterÿthisÿeventÿisÿraised.ÿ

AfterPrintÿ Thisÿeventÿisÿraisedÿafterÿtheÿsectionÿisÿrenderedÿtoÿtheÿcanvasÿobject.ÿYouÿcanÿuseÿthisÿeventÿtoÿdrawÿdirectlyÿ toÿtheÿcanvas.ÿDoÿnotÿuseÿtheÿAfterPrintÿeventÿtoÿmakeÿanyÿchangesÿtoÿtheÿsectionÿsinceÿtheÿsectionÿhasÿ alreadyÿbeenÿrenderedÿtoÿtheÿcanvasÿatÿthisÿpoint.

WhenÿBoundÿandÿUnboundÿDataÿValuesÿareÿSet 1. TheÿFieldsÿcollectionÿisÿpopulatedÿfromÿtheÿdatasetÿthatÿisÿboundÿtoÿtheÿreportÿafterÿtheÿDataInitializeÿ eventÿisÿraised.ÿ(Inÿanÿunboundÿreport,ÿtheÿFieldsÿcollectionÿvaluesÿareÿnotÿsetÿtoÿanythingÿatÿthisÿpoint.)ÿ 2. TheÿFetchDataÿeventÿisÿraised,ÿgivingÿtheÿuserÿaÿchanceÿtoÿmodifyÿtheÿFieldsÿcollection.ÿ

3.ÿ Anyÿfieldsÿthatÿareÿboundÿhaveÿtheÿvaluesÿtransferredÿover.ÿ 4. TheÿFormatÿeventÿisÿraised. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ104

Hyperlinks

UsingÿHyperlinksÿinÿActiveReports ActiveReportsÿforÿ.NETÿ3.0ÿallowsÿyouÿtoÿaddÿhyperlinksÿtoÿreportsÿtoÿperformÿaÿvarietyÿofÿfunctions.ÿYouÿcanÿ setÿtheÿHyperLinkÿpropertyÿtoÿanyÿHTML-styleÿlink,ÿitemsÿinÿtheÿBookmarksÿcollectionÿ(TOC),ÿorÿuseÿitÿtoÿ simulateÿdrill-downÿreporting.ÿByÿusingÿtheÿHyperLinkÿproperty,ÿreportsÿcanÿhaveÿ"clickable"ÿcontrolsÿthatÿcanÿ beÿusedÿforÿmanyÿpurposes,ÿincludingÿtheÿabilityÿtoÿrunÿandÿdisplayÿotherÿreports.ÿWhenÿaÿcontrolÿthatÿhasÿitsÿ HyperLinkÿpropertyÿsetÿtoÿanÿitemÿinÿtheÿBookmarksÿcollectionÿorÿaÿWebÿlinkÿisÿclicked,ÿActiveReportsÿwillÿ displayÿtheÿlinkÿasÿaÿnewÿtabÿwithinÿtheÿViewerÿobject.ÿWhenÿaÿlinkÿthatÿisÿnotÿTOCÿorÿWebÿrelated,ÿsuchÿasÿanÿ e-mailÿlink,ÿtheÿViewerÿwillÿshellÿtheÿlinkÿoutÿtoÿtheÿoperatingÿsystem.ÿThus,ÿe-mailÿlinksÿwillÿnotÿopenÿasÿaÿ newÿtabÿwithinÿtheÿViewerÿbutÿasÿaÿseparateÿwindow.ÿ Toÿaddÿaÿhyperlinkÿtoÿaÿreportÿatÿdesignÿtime,ÿclickÿonÿtheÿappropriateÿcontrolÿwithinÿtheÿ ActiveReportÿdesignerÿandÿsetÿtheÿHyperLinkÿpropertyÿforÿitÿatÿtheÿPropertiesÿgrid.

ÿ TheÿfollowingÿcodeÿsnippetsÿdemonstrateÿhowÿtoÿsetÿtheÿHyperLinkÿpropertyÿofÿaÿTextBoxÿcontrolÿtoÿpointÿtoÿ availableÿlinks.

ToÿpointÿtoÿaÿTOCÿentry txtEntry.HyperLinkÿ=ÿ"toc://"ÿ+ÿBookmarksCollection(iEntryÿ- 1).Label

ToÿpointÿtoÿaÿWebÿlink txtWebsite.HyperLinkÿ=ÿ"www.datadynamics.com"

Toÿpointÿtoÿaÿeÿ -mailÿlink txtMail.HyperLinkÿ=ÿ"mailto:[email protected]"

Inheritance ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ105

ActiveReportsÿcanÿbeÿusedÿtoÿcreateÿaÿbaseÿclassÿasÿaÿtemplateÿfromÿwhichÿotherÿreportsÿcanÿinherit.ÿAÿveryÿ simpleÿexampleÿofÿhowÿthisÿfunctionalityÿmayÿbeÿusedÿisÿtheÿcreationÿofÿaÿcompanyÿletterheadÿtemplate.ÿÿToÿ doÿthis,ÿcreateÿaÿLetterHeadÿclassÿwithÿcodeÿlikeÿtheÿfollowing. ÿ [C#] usingÿDataDynamics.ActiveReports; usingÿDataDynamics.ActiveReports.Document; namespaceÿInheritanceCS { ///ÿ

///ÿSummaryÿdescriptionÿforÿLetterHead. ///ÿTheÿLetterHeadÿclassÿisÿtoÿbeÿusedÿwithÿreportsÿhavingÿonlyÿaÿDetailÿsection. ///ÿ publicÿclassÿLetterHeadÿ:ÿActiveReportÿ//TellÿtheÿletterheadÿclassÿtoÿinheritÿfromÿAR { publicÿLetterHead() { // //ÿTODO:ÿAddÿconstructorÿlogicÿhere // } protectedÿvoidÿInitializeLetterhead() { //createÿsectionsÿandÿcontrolsÿforÿtheÿletterhead PageHeaderÿphÿ=ÿnewÿPageHeader(); PageFooterÿpfÿ=ÿnewÿPageFooter(); Pictureÿpÿ=ÿnewÿPicture(); Labelÿlÿ=ÿnewÿLabel(); Labelÿl2ÿ=ÿnewÿLabel(); //setÿpropertiesÿonÿsectionsÿandÿcontrols ph.BackColorÿ=ÿSystem.Drawing.Color.Gainsboro; ph.Heightÿ=ÿ1F; pf.BackColorÿ=ÿSystem.Drawing.Color.Gainsboro; pf.Heightÿ=ÿ1F; p.Nameÿ=ÿ"Logo"; p.Imageÿ=ÿSystem.Drawing.Image.FromFile(@"c:\logo."); p.Leftÿ=ÿ0F; p.Widthÿ=ÿ2.5F; l.Nameÿ=ÿ"CompanyName"; l.Textÿ=ÿ"DataÿDynamicsÿLtd."; l.Leftÿ=ÿ2.5F; l.Widthÿ=ÿ4F; l.Heightÿ=ÿ1F; l.Fontÿ=ÿnewÿSystem.Drawing.Font("TimesÿNewÿRoman",ÿ20); l2.Nameÿ=ÿ"WebsiteAddress"; l2.Textÿ=ÿ"http://www.datadynamics.com"; l2.Leftÿ=ÿ0F; l2.Widthÿ=ÿ6.5F; l2.Alignmentÿ=ÿTextAlignment.Center; //addÿtheÿsectionsÿcreatedÿaboveÿtoÿtheÿreport this.Sections.Insert(0,ph); this.Sections.Insert(2,pf); //addÿtheÿcontrolsÿcreatedÿaboveÿtoÿtheÿsections ph.Controls.Add(p); ph.Controls.Add(l); pf.Controls.Add(l2); } protectedÿvoidÿrptLetter_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { //addÿtheÿcodeÿinÿInitializeLetterheadÿtoÿtheÿReportStartÿeventÿ //ofÿtheÿreport InitializeLetterhead(); } } } ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ106

[VisualÿBasic] ImportsÿSystem ImportsÿDataDynamics.ActiveReports ImportsÿDataDynamics.ActiveReports.Document NamespaceÿInheritanceVB PublicÿClassÿLetterhead InheritsÿActiveReportÿ'TellÿtheÿletterheadÿclassÿtoÿinheritÿfromÿAR ProtectedÿSubÿInitializeLetterhead() 'TheÿLetterheadÿclassÿisÿforÿuseÿwithÿreportsÿcontainingÿonlyÿaÿDetailÿsection. 'createÿsectionsÿandÿcontrolsÿforÿtheÿletterhead DimÿphÿAsÿPageHeaderÿ=ÿNewÿPageHeader DimÿpfÿAsÿPageFooterÿ=ÿNewÿPageFooter DimÿpÿAsÿPictureÿ=ÿNewÿPicture DimÿlÿAsÿLabelÿ=ÿNewÿLabel Dimÿl2ÿAsÿLabelÿ=ÿNewÿLabel 'setÿpropertiesÿonÿsectionsÿandÿcontrols Withÿph .BackColorÿ=ÿSystem.Drawing.Color.Gainsboro .Heightÿ=ÿ1.0F EndÿWith Withÿpf .BackColorÿ=ÿSystem.Drawing.Color.Gainsboro .Heightÿ=ÿ1.0F EndÿWith Withÿp .Nameÿ=ÿ"Logo" .Imageÿ=ÿSystem.Drawing.Image.FromFile("c:\logo.gif") .Leftÿ=ÿ0.0F .Widthÿ=ÿ2.5F EndÿWith Withÿl .Nameÿ=ÿ"CompanyName" .Textÿ=ÿ"DataÿDynamicsÿLtd." .Leftÿ=ÿ2.5F .Widthÿ=ÿ4.0F .Heightÿ=ÿ1.0F .Fontÿ=ÿNewÿSystem.Drawing.Font("TimesÿNewÿRoman",ÿ20) EndÿWith Withÿl2 .Nameÿ=ÿ"WebsiteAddress" .Textÿ=ÿ"http://www.datadynamics.com" .Leftÿ=ÿ0.0F .Widthÿ=ÿ6.5F .Alignmentÿ=ÿTextAlignment.Center EndÿWith 'addÿtheÿsectionsÿcreatedÿaboveÿtoÿtheÿreport Me.Sections.Insert(0,ÿph) Me.Sections.Insert(2,ÿpf) 'addÿtheÿcontrolsÿcreatedÿaboveÿtoÿtheÿsections ph.Controls.Add(p) ph.Controls.Add(l) pf.Controls.Add(l2) EndÿSub ProtectedÿSubÿrptLetter_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿSystemÿ_ ÿ .EventArgs) 'addÿtheÿcodeÿinÿInitializeLetterheadÿtoÿtheÿReportStartÿeventÿofÿtheÿreport InitializeLetterhead() EndÿSub EndÿClass EndÿNamespace Thenÿinÿtheÿcodeÿbehindÿanyÿreportÿthatÿisÿtoÿinheritÿfromÿthisÿclass,ÿchangeÿtheÿinheritanceÿinÿtheÿ automaticallyÿgeneratedÿcodeÿfromÿ"ActiveReport"ÿtoÿyourÿclassÿname,ÿinÿthisÿcaseÿ"LetterHead."ÿToÿuseÿtheÿ codeÿinÿtheÿReportStartÿeventÿyouÿcreatedÿinÿtheÿclassÿabove,ÿcreateÿanÿeventÿhandlerÿjustÿafterÿ InitializeReport()ÿwithÿcodeÿlikeÿtheÿfollowing. [C#] this.ReportStartÿ+=ÿnewÿEventHandler(base.rptLetter_ReportStart); ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ107

[VisualÿBasic]ÿ AddHandlerÿMe.ReportStart,ÿAddressOfÿrptLetter_ReportStart

LayoutÿFiles

ReportÿlayoutsÿinÿActiveReportsÿforÿ.NETÿ3.0ÿareÿautomaticallyÿsavedÿasÿC#ÿorÿVisualÿBasicÿforÿ.NETÿfilesÿ withinÿtheÿconfinesÿofÿtheÿprojectÿinÿwhichÿtheyÿareÿcreated.ÿInÿthisÿway,ÿlayoutÿinformationÿmodelsÿtheÿ behaviorÿofÿWindowsÿFormsÿinÿtheÿ.NETÿframework.ÿHowever,ÿreportÿlayoutsÿcanÿbeÿsavedÿasÿstand-aloneÿRPXÿ files—theÿXML-formattedÿfileÿonÿwhichÿpreviousÿeditionsÿofÿActiveReportsÿforÿ.NETÿwereÿbased.ÿThisÿ functionalityÿmakesÿActiveReportsÿforÿ.NETÿ3.0ÿtrulyÿbackwardÿcompatible.ÿOlderÿlayoutÿfilesÿcanÿeasilyÿbeÿ broughtÿintoÿtheÿnewestÿapplicationsÿwhileÿnewÿlayoutÿfilesÿcanÿbeÿsavedÿtoÿanÿolderÿformat. Note:ÿWhenÿsavingÿaÿlayoutÿwhichÿcontainsÿaÿdatasetÿ toÿtheÿArnet3ÿFormat,ÿtheÿdataÿadapterÿandÿ dataÿconnectionÿareÿsaved,ÿbutÿtheÿdatasetÿitselfÿisÿlost.ÿWhenÿtheÿsavedÿlayoutÿisÿloadedÿintoÿanotherÿ ÿ report,ÿyouÿmustÿgenerateÿtheÿdatasetÿagain,ÿasÿthereÿisÿnoÿconvenientÿwayÿtoÿreconnectÿtheÿoldÿ dataset.

Localization

Theÿ.NETÿFrameworkÿmakesÿitÿeasyÿforÿdevelopersÿtoÿlocalizeÿtheirÿapplicationsÿandÿcontrols.ÿTheÿ ActiveReportsÿforÿ.NETÿ3.0ÿViewerÿControlÿusesÿtheÿHubÿandÿSpokeÿmodelÿforÿlocalizingÿresources.ÿTheÿhubÿisÿ theÿmainÿexecutingÿassembly.ÿInÿourÿcaseÿtheÿapplicationÿhostsÿtheÿViewerÿControl.ÿTheÿspokesÿareÿsatelliteÿ DLLsÿthatÿcontainÿlocalizedÿresourcesÿforÿtheÿapplication.ÿ PlaceÿtheÿsatelliteÿDLLsÿinÿsubdirectoriesÿunderÿtheÿmainÿexecutingÿassembly.ÿWhenÿtheÿmainÿexecutingÿ assemblyÿneedsÿaÿresource,ÿuseÿaÿResourceManagerÿobjectÿtoÿloadÿtheÿrequiredÿresource.ÿTheÿ ResourceManagerÿusesÿtheÿthread'sÿCurrentUICultureÿProperty.ÿTheÿcommonÿlanguageÿruntimeÿsetsÿthisÿ propertyÿorÿyouÿcanÿsetÿitÿinÿcodeÿtoÿforceÿaÿcertainÿUIÿCulture.ÿ ForcingÿaÿcertainÿlocaleÿisÿhelpfulÿwhenÿyouÿwantÿtoÿtestÿwhetherÿyourÿsatelliteÿDLLÿisÿloadingÿproperly.ÿTheÿ ResourceManagerÿclassÿusesÿtheÿCurrentUICultureÿPropertyÿtoÿlocateÿsubdirectoriesÿthatÿshouldÿcontainÿaÿ satelliteÿDLLÿforÿtheÿcurrentÿculture.ÿIfÿnoÿsubdirectoryÿexistsÿtheÿResourceManagerÿusesÿtheÿresourceÿthatÿisÿ embeddedÿinÿtheÿassembly.ÿ TheÿViewerÿControlÿisÿbuiltÿusingÿtheÿdefaultÿcultureÿofÿUSÿEnglish.ÿThisÿisÿtheÿfallbackÿcultureÿforÿtheÿViewerÿ Control.ÿForÿmoreÿdetailedÿinformationÿaboutÿhowÿtheÿFrameworkÿlocatesÿsatelliteÿDLLs,ÿpleaseÿreferÿtoÿtheÿ helpÿsystemÿinÿVisualÿStudioÿ ®ÿ.NETÿorÿtheÿbookÿDevelopingÿInternationalÿSoftware,ÿ2ndÿedition byÿMSÿPressÿ thatÿcontainsÿinformationÿonÿlocalizingÿapplicationsÿusingÿtheÿ.NETÿFramework.ÿ

OutputFormatÿStrings

ActiveReportsÿallowsÿyouÿtoÿsetÿformattingÿstringsÿforÿdate,ÿtime,ÿcurrency,ÿandÿotherÿnumericÿvaluesÿusingÿ theÿOutputFormatÿpropertyÿonÿtheÿTextBoxÿcontrol.ÿTheÿOutputFormatÿdialogÿalsoÿallowsÿyouÿtoÿ selectÿinternationalÿcurrencyÿvaluesÿandÿselectÿfromÿvariousÿbuilt-inÿstringÿexpressions.ÿInÿadditionÿtoÿtheÿ built-inÿstringÿexpressions,ÿyouÿmayÿuseÿanyÿ.NETÿstandardÿformattingÿstrings.ÿÿYouÿcanÿfindÿinformationÿ aboutÿtheseÿstringsÿ(Numericsÿ(http://msdn.microsoft.com/library/default.asp?url=/library/en- us/cpguide//cpconstandardnumericformatstrings.asp)andÿDate/Timeÿ (http://msdn.microsoft.com/library/default.asp?url=/library/en- us/cpguide/html/cpconstandarddatetimeformatstrings.asp)formats)ÿonÿMSDN.ÿ TheÿOutputFormatÿpropertyÿofÿtheÿTextBoxÿcontrolÿincludesÿfourÿsectionsÿdelimitedÿbyÿaÿsemicolon.ÿÿEachÿ sectionÿcontainsÿtheÿformatÿspecificationsÿforÿaÿdifferentÿtypeÿofÿnumber: l Theÿfirstÿsectionÿprovidesÿtheÿformatÿforÿpositiveÿnumbers.ÿ

l Theÿsecondÿsectionÿprovidesÿtheÿformatÿforÿnegativeÿnumbers.ÿ l TheÿthirdÿsectionÿprovidesÿtheÿformatÿforÿZeroÿvalues.ÿ

l TheÿfourthÿsectionÿprovidesÿtheÿformatÿforÿNullÿorÿSystem.DBNullÿvalues. ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ108

Times:

l hh:mmÿttÿ=ÿ09:00ÿAMÿ l HH:mmÿ=ÿ21:00ÿ(twenty-fourÿhourÿclock)ÿ l HHÿ=ÿhoursÿinÿ24ÿhourÿclockÿ

l hhÿ=ÿhoursÿinÿ12ÿhourÿclockÿ l mmÿ=ÿminutesÿ l ssÿ=ÿsecondsÿ

l ttÿ=ÿAMÿorÿPMÿ

Dates: l dddd,ÿMMMMÿd,ÿyyyyÿ=ÿSaturday,ÿDecemberÿ25,ÿ2004ÿ l dd/MM/yyyyÿ=ÿ25/12/2004ÿ l dÿorÿddÿ=ÿdayÿinÿnumberÿformatÿ l dddÿ=ÿdayÿinÿshortÿstringÿformatÿ(i.e.ÿSatÿforÿSaturday)ÿ l ddddÿ=ÿdayÿinÿstringÿformatÿ(i.e.ÿSaturday)ÿ l MMÿ=ÿmonthÿinÿnumberÿformatÿ l MMMÿ=ÿmonthÿinÿshortÿstringÿformatÿ(i.e.ÿDecÿforÿDecember)ÿ l MMMMÿ=ÿmonthÿinÿstringÿformatÿ(i.e.ÿDecember)ÿ l yÿorÿyyÿ=ÿyearÿinÿtwoÿdigitÿformatÿ(i.e.ÿ04ÿforÿ2004)ÿ l yyyyÿorÿyyyyÿ=ÿyearÿinÿfourÿdigitÿformatÿ(i.e.ÿ2004)ÿ

Currencyÿandÿnumbers: l $0.00ÿ=ÿ$6.25ÿ l $#,#00.00ÿ=ÿ$06.25ÿ l 0ÿ=ÿdigitÿorÿzeroÿ

lÿ #ÿ=ÿdigitÿorÿnothingÿ l %ÿ=ÿpercent-multipliesÿtheÿstringÿexpressionÿbyÿ100ÿ

Parameters

ParametersÿandÿSimpleÿReports InÿActiveReportsÿforÿ.NETÿ3.0,ÿyouÿcanÿallowÿusersÿtoÿfilterÿtheÿamountÿofÿinformationÿexposedÿinÿaÿreportÿ throughÿtheÿuseÿofÿparameters.ÿAddingÿparametersÿtoÿtheÿreportÿresultsÿinÿaÿParametersÿdialogÿthatÿtheÿuserÿ canÿmanipulateÿagainstÿtheÿdatabaseÿtoÿreturnÿpertinentÿdata.ÿ Forÿexample,ÿtheÿSQLÿstatementÿ"SELECTÿ*ÿFROMÿproductsÿINNERÿJOINÿcategoriesÿONÿproducts.categoryidÿ=ÿ categories.categoryidÿWHEREÿproducts.supplierIDÿ=<%SupplierID|EnterÿsupplierID|1000%>ÿandÿ OrderDate=#<%Date|Orderÿdate:|1/1/2001|D%>#ÿandÿDiscount=<%bool|ÿIsÿthisÿcheckedÿ?|true|B%>;"ÿ containsÿuniqueÿsyntaxÿthatÿActiveReportsÿforÿ.NETÿusesÿtoÿgenerateÿtheÿfollowingÿdialog.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ109

ÿ BreakingÿdownÿtheÿSQLÿstatement,ÿtheÿsyntacticalÿelementsÿ<%SupplierID|EnterÿsupplierID|1000%>,ÿ<% Date|Orderÿdate:|1/1/2001|D%>,ÿÿandÿ<%bool|ÿIsÿthisÿcheckedÿ?|true|B%>ÿcompriseÿtheÿreportÿ parameters.ÿTheÿuserÿcanÿacceptÿtheseÿorÿinputÿotherÿvaluesÿtoÿfurtherÿdefineÿreportÿdata.ÿEachÿofÿtheseÿ parametersÿfollowÿtheÿsyntacticalÿpatternÿ<%FieldNameÿ|ÿPromptStringÿ|ÿDefaultValueÿ|ÿType% > where:ÿ

l FieldName isÿtheÿnameÿofÿtheÿfieldÿyouÿwishÿtoÿrequestÿ(e.g.ÿCustomerIDÿorÿLastName).ÿThisÿisÿtheÿonlyÿ partÿofÿtheÿsyntaxÿwhichÿisÿrequired,ÿsoÿyouÿcanÿuseÿ<%FieldName%> ifÿyouÿdoÿnotÿwishÿtoÿuseÿtheÿ otherÿvalues.ÿ l PromptString isÿanÿoptionalÿstringÿvalueÿwhichÿsetsÿtheÿtextÿthatÿappearsÿinÿtheÿdialogÿnextÿtoÿtheÿ controlÿ(e.g.ÿ"EnterÿCustomerÿID:ÿ").ÿ l DefaultValue setsÿaÿdefaultÿvalueÿforÿtheÿparameter.ÿForÿexample,ÿifÿyouÿhaveÿaÿdateÿparameter,ÿyouÿ canÿsetÿtheÿDefaultValueÿforÿtheÿfieldÿtoÿtheÿcurrentÿdateÿsoÿusersÿcanÿjustÿhitÿENTERÿunlessÿtheyÿwantÿtoÿ generateÿaÿreportÿbasedÿonÿaÿnewÿdate.ÿ l Type indicatesÿtheÿtypeÿofÿtheÿdataÿrequested.ÿTheÿpossibleÿvaluesÿareÿnothingÿ(whichÿdefaultsÿtoÿstring),ÿ S forÿstring,ÿD forÿdate,ÿandÿB forÿBoolean.ÿAÿstringÿtypeÿprovidesÿaÿtextboxÿforÿinput,ÿaÿdateÿtypeÿ providesÿaÿcalendarÿdrop-downÿcontrolÿforÿinput,ÿandÿaÿBooleanÿtypeÿprovidesÿaÿcheckÿboxÿforÿinput.ÿ Note: ForÿStrings,ÿifÿyouÿspecifyÿaÿdefaultÿvalueÿthatÿisÿenclosedÿinÿapostrophesÿorÿquotationÿ marks,ÿActiveReportsÿsendsÿtheÿsameÿmarksÿtoÿSQL.ÿForÿBooleanÿparameters,ÿifÿyouÿspecifyÿtrue/falseÿ forÿtheÿDefaultValueÿitÿgeneratesÿtrue/falseÿforÿSQLÿoutput.ÿIfÿyouÿspecifyÿ0,1,ÿitÿgeneratesÿ0ÿorÿ1. Note: AlthoughÿFieldNameÿisÿtheÿonlyÿrequiredÿparameter,ÿpleaseÿnoteÿthatÿifÿyouÿdoÿnotÿspecifyÿaÿ defaultÿvalueÿforÿtheÿotherÿparametersÿtheÿfieldÿlistÿisÿnotÿpopulatedÿatÿdesignÿtimeÿandÿyouÿwillÿseeÿaÿ SQLÿerrorÿmessage.ÿSettingÿaÿdefaultÿvalueÿforÿallÿparametersÿallowsÿyouÿtoÿseeÿfieldsÿinÿtheÿReportÿ Explorerÿinsteadÿofÿanÿerrorÿmessage. YouÿcanÿuseÿstoredÿproceduresÿinÿtheÿsameÿwayÿasÿparametersÿinÿActiveReports.ÿTheÿSQLÿstatementÿhasÿtheÿ storedÿprocedureÿcallÿandÿplaceholdersÿforÿtheÿparameters:ÿ"CustOrderHistÿ<%ID|EnterÿCustomerÿ ID:|AFLKI%>".ÿActiveReportsÿreplacesÿtheÿparameterÿtextÿ"<%ÿ%>"ÿwithÿwhateverÿtheÿuserÿtypesÿintoÿtheÿ dialogÿtoÿcreateÿaÿcallÿlikeÿthis:ÿCustOrderHistÿ'AFLKI'. ToÿaddÿparametersÿinÿSQLÿstatementsÿasÿinÿtheÿaboveÿexample,ÿyouÿwillÿneedÿtoÿaddÿthemÿtoÿtheÿqueryÿviaÿ theÿDatasourceÿdialogÿthatÿisÿaccessedÿbyÿclickingÿtheÿdatasourceÿicon inÿtheÿActiveReportsÿdesigner.

AddingÿParametersÿViaÿtheÿReportÿExplorer InÿadditionÿtoÿaddingÿparametersÿinÿSQLÿstatements,ÿActiveReportsÿforÿ.NETÿ3.0ÿprovidesÿforÿtheÿadditionÿofÿ parametersÿviaÿtheÿReportÿExplorer.ÿToÿdoÿso,ÿright-clickÿtheÿParametersÿnodeÿinÿtheÿReportÿExplorerÿandÿclickÿ "Add"ÿfromÿtheÿshortcutÿmenu.ÿThisÿwillÿaddÿaÿchildÿtoÿtheÿParametersÿnode. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ110

ÿ Onceÿaÿparameterÿisÿaddedÿtoÿtheÿ,ÿyouÿcanÿsetÿitsÿpropertiesÿfromÿtheÿPropertiesÿgrid.ÿÿ

AddingÿParametersÿatÿRunÿtime Customÿparametersÿcanÿbeÿadded,ÿedited,ÿandÿdeletedÿatÿrunÿtime.ÿTheÿfollowingÿdemonstratesÿhowÿtoÿaddÿaÿ parameterÿtoÿtheÿReport_StartÿeventÿandÿassignÿitsÿvalueÿtoÿanÿActiveReportsÿtextbox. 'VisualÿBasic PrivateÿSubÿrptParam_ReportStart(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)_ÿ HandlesÿMyBase.ReportStart

DimÿmyParam1ÿAsÿNewÿParameter() myParam1.Keyÿ=ÿ"myParam1" myParam1.Typeÿ=ÿParameter.DataType.String myParam1.PromptUserÿ=ÿTrueÿ'setÿtoÿFalseÿifÿyouÿdoÿnotÿwantÿinputÿfromÿuser myParam1.Promptÿ=ÿ"Enterÿlastÿname:" myParam1.DefaultValueÿ=ÿ"ThisÿisÿmyParam1ÿdefaultÿvalue" Me.Parameters.Add(myParam1) ÿ 'Setÿtextboxÿtextÿequalÿtoÿtheÿvalueÿofÿtheÿparameter Me.txtParam1.Textÿ=ÿMe.Parameters("myParam").Value EndÿSub

//C# privateÿvoidÿNewActiveReport1_ReportStart(objectÿsender,ÿSystem.EventArgsÿe) { ParameterÿmyParam1ÿ=ÿnewÿParameter(); myParam.Keyÿ=ÿ"myParam1"; myParam.Typeÿ=ÿParameter.DataType.String; myParam.PromptUserÿ=ÿtrue;ÿ//setÿtoÿfalseÿifÿyouÿdoÿnotÿwantÿinputÿfromÿuser myParam.Promptÿ=ÿ"Enterÿlastÿname:"; this.Parameters.Add(myParam1); ÿ //Setÿtextboxÿtextÿequalÿtoÿtheÿvalueÿofÿtheÿparameter this.txtParam1.Textÿ=ÿthis.Parameters["myParam"].Value }

ParametersÿandÿSubreports Youÿcanÿuseÿparametersÿwithÿsubreportsÿtoÿconnectÿtheÿsubreportÿtoÿtheÿparentÿreport.ÿIfÿyouÿsetÿaÿ parameterÿforÿtheÿfieldÿthatÿlinksÿtheÿparentÿreportÿtoÿtheÿchildÿsubreport,ÿtheÿparentÿreportÿpassesÿtheÿ informationÿtoÿtheÿchildÿthroughÿtheÿparameters.ÿKeepÿtheÿfollowingÿinÿmindÿwhenÿworkingÿwithÿsubreportsÿ andÿparameters:ÿ l Setÿtheÿsubreport'sÿShowParametersUI propertyÿtoÿFalse.ÿ

l Setÿtheÿsubreport'sÿSQLÿqueryÿtoÿuseÿtheÿparameterÿsyntaxÿ=ÿ<%fieldname%>.ÿ

ÿ Note:ÿBothÿreportÿqueriesÿmustÿcontainÿtheÿsameÿfieldÿ(soÿtheÿmainÿreportÿmustÿhaveÿaÿcategoryIDÿ fieldÿandÿtheÿsubreportÿalsoÿmustÿhaveÿaÿcategoryIDÿfield.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ111

ReportÿandÿPageÿSettings

TheÿReportÿSettingsÿDialog WithÿActiveReports,ÿyouÿcanÿmodifyÿfacetsÿofÿyourÿreport,ÿsuchÿasÿtheÿpageÿsetup,ÿprinterÿsettings,ÿstyles,ÿ andÿglobalÿsettingsÿofÿyourÿreportÿatÿdesignÿtime,ÿasÿwellÿasÿatÿrunÿtime.ÿToÿmakeÿchangesÿatÿdesignÿtime,ÿ accessÿtheÿReportÿSettingsÿdialogÿbyÿselectingÿReport >ÿSettings fromÿtheÿtoolbarÿmenu.ÿ

ÿ Alternatively,ÿyouÿcanÿright-clickÿtheÿ"Settings"ÿnodeÿlocatedÿwithinÿtheÿReportÿExplorerÿandÿselectÿ"Show."

ÿ

TheÿPageÿSetupÿPane ByÿclickingÿtheÿPageÿSetupÿbutton,ÿyouÿcanÿmakeÿchangesÿtoÿtheÿreportÿmarginsÿ(left,ÿright,ÿtop,ÿandÿ bottom),ÿspecifyÿaÿgutter,ÿandÿselectÿtheÿMirrorÿmarginsÿoptionÿwithinÿtheÿPageÿSetupÿpane. ByÿsettingÿaÿgutterÿandÿselectingÿMirrorÿmargins,ÿyouÿcanÿeasilyÿsetÿupÿreportsÿforÿpublishingÿpurposes.ÿWhenÿ youÿselectÿMirrorÿmargins,ÿtheÿinnerÿmarginsÿinÿtheÿreportÿareÿsetÿforÿoppositeÿpagesÿtoÿbeÿtheÿsameÿwidthÿ andÿtheÿoutsideÿmarginsÿforÿoppositeÿpagesÿtoÿbeÿtheÿsameÿwidth.ÿSpecifyingÿaÿgutterÿgivesÿextraÿspaceÿ betweenÿtheÿedgeÿofÿtheÿpageÿandÿtheÿmargins.ÿThisÿallowsÿreportsÿtoÿbeÿbound. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ112

ÿ

TheÿPrinterÿSettingsÿPane ByÿclickingÿtheÿPrinterÿSettingsÿbutton,ÿyouÿcanÿmakeÿchangesÿtoÿtheÿprinterÿpaperÿsizeÿandÿorientationÿwithinÿ theÿPrinterÿSettingsÿpane.ÿYouÿcanÿsetÿaÿcustomÿpaperÿsizeÿbyÿselectingÿ"CustomÿSize"ÿfromÿtheÿoptionsÿlistedÿ inÿtheÿ"PaperÿSize"ÿcomboÿbox.ÿOnceÿyouÿhaveÿselectedÿthisÿoption,ÿyouÿcanÿsetÿaÿspecificÿheightÿandÿwidth. TheÿPrinterÿSettingsÿdialogÿalsoÿletsÿtheÿuserÿchooseÿtheÿtypeÿofÿcollationÿtoÿuse,ÿwhetherÿorÿnotÿtheÿreportÿ shouldÿbeÿprintedÿinÿduplex,ÿandÿtheÿlocationÿofÿtheÿpaperÿsource. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ113

ÿ

TheÿStylesÿPane ByÿclickingÿtheÿStylesÿbutton,ÿchangesÿcanÿbeÿmadeÿtoÿtheÿappearanceÿofÿtextÿassociatedÿwithÿcontrolsÿwithinÿ theÿStylesÿpane,ÿeitherÿbyÿapplyingÿanÿexistingÿstyleÿsheet,ÿcreatingÿandÿapplyingÿaÿnewÿstyleÿsheet,ÿorÿbyÿ modifyingÿandÿapplyingÿanÿexistingÿstyle. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ114

ÿ

TheÿGlobalÿSettingsÿPane ByÿclickingÿtheÿGlobalÿSettingsÿbutton,ÿchangesÿcanÿbeÿmadeÿtoÿtheÿdesignÿsurfaceÿwithinÿtheÿGlobalÿSettingsÿ pane,ÿincludingÿshowingÿorÿhidingÿtheÿgrid,ÿsettingÿtheÿcontrolsÿtoÿalignÿtoÿtheÿgrid,ÿsettingÿtheÿnumberÿofÿ columnsÿorÿrowsÿonÿtheÿgrid,ÿandÿchangingÿtheÿrulerÿunitsÿtoÿinchesÿorÿcentimeters.ÿ Inÿaddition,ÿyouÿcanÿsetÿtheÿnumberÿofÿPagesÿthatÿwillÿdisplayÿwithinÿtheÿPreviewÿTabÿofÿtheÿActiveReportsÿ Designer.ÿTheÿminimumÿvalueÿisÿ"1"ÿandÿtheÿmaximumÿvalueÿisÿ"10000." ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ115

ÿ

ReportÿExecution

ActiveReportsÿreportÿexecutionÿbeginsÿbyÿraisingÿtheÿReportStartÿevent.ÿAtÿthisÿpoint,ÿaccessingÿdataÿsourceÿ propertiesÿmightÿraiseÿtheÿDataInitializeÿevent.ÿTheÿreportÿvalidatesÿanyÿchangesÿmadeÿtoÿtheÿreportÿstructureÿ inÿReportStart. Printerÿsettingsÿareÿappliedÿnext. AtÿthisÿpointÿtheÿDataInitializeÿeventÿwillÿbeÿraisedÿandÿtheÿdataÿsourceÿwillÿbeÿopenedÿifÿtheÿeventÿwasÿnotÿ raisedÿduringÿtheÿReportStartÿevent.ÿIfÿtheÿdataÿsourceÿcontainsÿparametersÿwithÿunsetÿvaluesÿandÿtheÿ ShowParameterUIÿpropertyÿisÿsetÿtoÿTrue,ÿActiveReportsÿdisplaysÿaÿparametersÿdialogÿandÿraisesÿ theÿParameterUIClosedÿeventÿwhenÿtheÿdialogÿisÿclosed.ÿIfÿtheÿreportÿisÿaÿsubreportÿthatÿrequiresÿparameters,ÿ ActiveReportsÿbindsÿtheÿsubreportÿparametersÿtoÿanyÿfieldsÿinÿtheÿparentÿreport. Next,ÿtheÿFetchDataÿeventÿisÿraised;ÿifÿthereÿisÿnoÿdata,ÿtheÿNoDataÿeventÿisÿraised. Note: TheÿDataInitializeÿandÿFetchDataÿeventsÿareÿtheÿonlyÿeventsÿinÿwhichÿtheÿFieldsÿcollectionÿshouldÿ everÿbeÿreferenced. Groupÿsectionsÿareÿboundÿandÿsectionsÿbeginÿrenderingÿonÿpages. Eventsÿareÿthenÿraisedÿforÿprocessingÿtheÿreportÿheader,ÿfollowedÿbyÿpageÿheader,ÿgroups,ÿdetail,ÿandÿpageÿ footerÿforÿeachÿpageÿinÿtheÿreport.ÿTheÿcancelÿflagÿisÿcheckedÿafterÿeachÿevent. TheÿspeedÿinÿprocessingÿandÿoutputÿgenerationÿofÿActiveReportsÿisÿattributedÿtoÿitsÿintelligent,ÿmulti-threaded,ÿ single-passÿprocessing.ÿActiveReportsÿwillÿprocessÿandÿrenderÿeachÿpageÿasÿsoonÿasÿtheÿpageÿisÿready.ÿIfÿ ActiveReportsÿisÿnotÿableÿtoÿfullyÿrenderÿaÿpageÿbecauseÿofÿunknownÿdataÿelementsÿorÿbecauseÿtheÿlayoutÿisÿ notÿfinal,ÿitÿplacesÿtheÿpageÿinÿcacheÿuntilÿtheÿdataÿisÿavailable. SummaryÿfieldsÿandÿKeepTogetherÿconstraintsÿareÿtwoÿreasonsÿwhyÿaÿpageÿmightÿnotÿbeÿrenderedÿ completely.ÿTheÿsummaryÿfieldÿisÿnotÿcompleteÿuntilÿallÿtheÿdataÿneededÿforÿcalculationÿisÿreadÿfromÿtheÿdataÿ source.ÿWhenÿaÿsummaryÿfieldÿsuchÿasÿaÿgrandÿtotalÿisÿplacedÿaheadÿofÿitsÿcompletionÿlevel,ÿsuchÿasÿinÿtheÿ reportÿheader,ÿtheÿreportÿheaderÿandÿallÿfollowingÿsectionsÿwillÿbeÿdelayedÿuntilÿallÿofÿtheÿdataÿisÿread. TheÿKeepTogetherÿpropertyÿdeterminesÿwhetherÿaÿsectionÿshouldÿprintÿinÿitsÿentiretyÿonÿtheÿsameÿpage.ÿWhenÿ thisÿpropertyÿisÿsetÿtoÿTrue,ÿtheÿsectionÿwillÿprintÿonÿtheÿsameÿpageÿwithoutÿanyÿpageÿbreaks.ÿAÿFalseÿsettingÿ allowsÿtheÿsectionÿtoÿbeÿsplitÿacrossÿtwoÿorÿmoreÿpages.ÿIfÿtheÿKeepTogetherÿpropertyÿisÿsetÿtoÿTrue,ÿbutÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ116 sectionÿisÿtooÿlargeÿforÿtheÿcurrentÿpageÿorÿneedsÿtoÿfitÿfullyÿonÿtheÿnextÿpage,ÿtheÿKeepTogetherÿpropertyÿwillÿ beÿignored. TheÿGroupKeepTogetherÿpropertyÿdeterminesÿwhetherÿgroupÿheaderÿandÿfooterÿsectionsÿwillÿprintÿasÿaÿsingleÿ blockÿonÿtheÿsameÿpage.ÿTheÿpropertyÿdefaultsÿtoÿNone,ÿwhichÿallowsÿtheÿgroupÿblockÿtoÿbeÿsplitÿacrossÿ pages.ÿWhenÿyouÿsetÿthisÿpropertyÿtoÿAll,ÿActiveReportsÿattemptsÿtoÿprintÿtheÿcompleteÿblockÿonÿtheÿsameÿ pageÿwithoutÿanyÿpageÿbreaks.ÿWhenÿaÿcompleteÿblockÿdoesÿnotÿfitÿonÿaÿsingleÿpage,ÿitÿwillÿbeÿsplitÿacrossÿtwoÿ orÿmoreÿpages.ÿTheÿthirdÿoption,ÿFirstDetail,ÿpreventsÿanyÿwidowedÿgroupÿheaderÿsections.ÿTheÿgroupÿheaderÿÿ willÿalwaysÿprintÿwithÿatÿleastÿoneÿDetailÿsection.

ReportÿStructure

Aÿreportÿsectionÿcontainsÿaÿgroupÿofÿcontrolsÿthatÿareÿprocessedÿandÿprintedÿatÿtheÿsameÿtimeÿasÿaÿsingleÿ unit.ÿActiveReportsÿdefinesÿtheÿfollowingÿsectionÿtypes:ÿ

ReportÿHeader Aÿreportÿcanÿhaveÿoneÿreportÿheaderÿsectionÿthatÿprintsÿatÿtheÿbeginningÿofÿtheÿreport.ÿThisÿsectionÿgenerallyÿ isÿusedÿtoÿprintÿaÿreportÿtitle,ÿaÿsummaryÿtable,ÿaÿchartÿorÿanyÿinformationÿthatÿneedsÿonlyÿtoÿappearÿonceÿatÿ theÿreport'sÿstart.

ReportÿFooter Aÿreportÿcanÿhaveÿoneÿreportÿfooterÿsectionÿthatÿprintsÿatÿtheÿendÿofÿtheÿreport.ÿThisÿsectionÿisÿusedÿtoÿprintÿaÿ summaryÿofÿtheÿreport,ÿgrandÿtotals,ÿorÿanyÿinformationÿthatÿneedsÿtoÿprintÿonceÿatÿtheÿreport'sÿend.

PageÿHeader Aÿreportÿcanÿhaveÿoneÿpageÿheaderÿsectionÿthatÿprintsÿatÿtheÿtopÿofÿeachÿpage.ÿUnlessÿtheÿpageÿcontainsÿaÿ reportÿheaderÿsection,ÿtheÿpageÿheaderÿwillÿbeÿtheÿfirstÿsectionÿthatÿprintsÿonÿtheÿpage.ÿTheÿpageÿheaderÿ sectionÿisÿusedÿtoÿprintÿcolumnÿheaders,ÿpageÿnumbers,ÿaÿpageÿtitle,ÿorÿanyÿinformationÿthatÿneedsÿtoÿappearÿ atÿtheÿtopÿofÿeachÿpageÿinÿtheÿreport. Note: BoundÿcontrolsÿinÿtheÿPageHeaderÿorÿPageFooterÿareÿnotÿsupported.ÿÿTheÿdataÿinÿsuchÿcontrolsÿ mayÿnotÿbeÿinÿsynchÿwithÿtheÿdataÿdisplayedÿinÿotherÿsectionsÿonÿtheÿpage.ÿ

PageÿFooter Aÿreportÿcanÿhaveÿoneÿpageÿfooterÿsectionÿthatÿprintsÿatÿtheÿbottomÿofÿeachÿpage.ÿItÿisÿusedÿtoÿprintÿpageÿ totals,ÿpageÿnumbers,ÿorÿanyÿotherÿinformationÿthatÿneedsÿtoÿappearÿatÿtheÿbottomÿofÿeachÿpage.

GroupÿHeader/Footer Aÿreportÿcanÿconsistÿofÿsingleÿorÿmultipleÿnestedÿgroups,ÿwithÿeachÿgroupÿhavingÿitsÿownÿheaderÿandÿfooterÿ sections.ÿTheÿheaderÿsectionÿisÿinsertedÿandÿprintedÿimmediatelyÿbeforeÿtheÿDetailÿsection.ÿTheÿfooterÿsectionÿ isÿinsertedÿandÿprintedÿimmediatelyÿafterÿtheÿDetailÿsection.

Detail

Aÿreportÿhasÿoneÿÿ Detailÿsection.ÿTheÿdetailÿsectionÿisÿtheÿbodyÿofÿtheÿreportÿandÿoneÿinstanceÿofÿtheÿsectionÿisÿ createdÿforÿeachÿrecordÿinÿtheÿreport.

RichText

TheÿRichTextÿcontrolÿoffersÿtheÿuserÿanÿenormousÿamountÿofÿcontrolÿoverÿtheÿappearanceÿofÿtextÿinÿtheÿ report.ÿUnlikeÿtheÿTextBoxÿcontrolÿwhichÿappliesÿformattingÿtoÿtheÿentireÿcontentsÿofÿtheÿcontrol,ÿtheÿRichTextÿ controlÿallowsÿyouÿtoÿapplyÿselectiveÿformattingÿtoÿvariousÿareasÿofÿtextÿwithinÿtheÿcontrol.ÿForÿexample,ÿtheÿ Findÿmethodÿallowsÿtheÿdeveloperÿtoÿfindÿspecificÿwordsÿorÿcharactersÿinÿtheÿcontrol,ÿwhileÿtheÿvariousÿ selectionÿpropertiesÿallowÿtheÿresultsÿofÿthisÿmethodÿtoÿbeÿusedÿtoÿselectÿtextÿandÿchangeÿitsÿformattingÿinÿaÿ dozenÿways. Theÿcontrol'sÿtextÿcanÿbeÿsetÿdirectlyÿusingÿtheÿText,ÿHtml,ÿorÿRTFÿproperties,ÿorÿitÿcanÿbeÿloadedÿfromÿaÿplainÿ text,ÿRTFÿorÿHTMLÿfileÿorÿstreamÿusingÿtheÿLoadÿmethod.ÿ Note: Inÿorderÿtoÿshowÿspecialÿcharactersÿinÿanÿhtmlÿfileÿloadedÿintoÿtheÿcontrol,ÿuseÿtheÿcharacterÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ117

entityÿreferenceÿ(i.e.ÿèÿforÿè). Note: Toÿloadÿaÿfileÿatÿdesignÿtime,ÿbeÿsureÿthatÿyouÿareÿnotÿinÿeditÿmode.ÿ TheÿInsertFieldÿandÿReplaceFieldÿmethodsÿenableÿfieldÿmergingÿreports,ÿsuchÿasÿtheÿmailÿmergeÿreportÿ demonstratedÿinÿtheÿ"RichÿTextÿandÿFieldÿMerging"ÿwalkthrough.ÿTheÿRichTextBoxÿnowÿautomaticallyÿbindsÿ

insertedÿfieldsÿtoÿtheÿreport'sÿfieldsÿcollection.ÿ ÿ

SupportedÿHtmlÿTagsÿInÿtheÿRichTextÿControl

TheÿfollowingÿisÿaÿlistÿofÿallÿofÿtheÿHTMLÿtagsÿthatÿcanÿbeÿusedÿwithÿtheÿRichTextÿcontrol.ÿUnsupportedÿ tagsÿwillÿbeÿignored.ÿPleaseÿnoteÿthatÿW3Cÿconventionsÿareÿstrictlyÿobserved.

Tagÿ Commentÿ Attributesÿ

ÿ Boldÿ noneÿ

ÿ Italicÿ noneÿ

ÿ Paragraphÿ align,ÿstyleÿ

ÿ Strongÿ(looksÿlikeÿbold)ÿ noneÿ

ÿ Bigÿ noneÿ

ÿ Smallÿ noneÿ

ÿ Preformattedÿ noneÿ

ÿ Fontÿÿ face,ÿsize,ÿcolor,ÿstyleÿ(seeÿnotesÿforÿstyleÿ attributes)ÿ

ÿ Theÿbodyÿtagÿ background,ÿtext,ÿleftmarginÿ

ÿ- Headingÿlevelsÿoneÿ noneÿ
ÿ throughÿsixÿ


ÿ Lineÿbreakÿ noneÿ

ÿ Emphasizedÿ(looksÿlikeÿ noneÿ Italics)ÿ

ÿ Underlinedÿ noneÿ

ÿ Imageÿ align,ÿheight,ÿsrc,ÿwidthÿ

ÿ Superscriptÿ noneÿ

ÿ Subscriptÿ noneÿ

ÿ Centerÿalignmentÿ noneÿ

ÿ Tableÿ align,ÿborder,ÿcellpadding,ÿcellspacing,ÿheight,ÿ style,ÿwidthÿ

ÿ Tableÿrowÿ alignÿ

ÿ Tableÿheadÿ noneÿ

ÿ Tableÿdatumÿ align,ÿborder,ÿcolspan,ÿrowspan,ÿwidthÿ

  • ÿ Listÿitemÿ noneÿ(nestingÿlevelsÿyieldÿdisc,ÿcircle,ÿsquareÿ bullets)ÿ

      ÿ Orderedÿlistÿ typeÿ

        ÿ Unorderedÿlistÿ type,ÿvalueÿ

        ÿ Strikeÿthroughÿ noneÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ118

        NOTE: Theÿstyleÿattributesÿofÿ,ÿ

        ,ÿandÿ

        ÿsupportÿtheÿfollowingÿproperties:ÿ

        l border-bottomÿ l border-top-widthÿ l margin-topÿ l border-bottom-widthÿ l border-widthÿ l padding-bottomÿ

        l border-colorÿ l font-familyÿ l padding-leftÿ l border-leftÿ l font-sizeÿ l padding-rightÿ

        l border-left-widthÿ l heightÿ l padding-topÿ

        l border-rightÿ l line-heightÿ l table-layoutÿ l border-right-widthÿ l margin-bottomÿ l text-alignÿ

        ÿ l border-styleÿ l margin-leftÿ l text-indentÿ l border-topÿ l margin-rightÿ l widthÿ

        Scripting

        ActiveReportsÿallowsÿyouÿtoÿuseÿscriptingÿtoÿprovideÿVB.NETÿorÿC#ÿÿfunctionalityÿtoÿreportsÿwithoutÿneedingÿtoÿ useÿactualÿ.vbÿorÿ.csÿfiles.ÿThisÿpermitsÿreportsÿsavedÿtoÿanÿRPXÿ(reportÿxml)ÿfileÿtoÿcontainÿcodeÿthatÿwhenÿ savedÿasÿanÿRPXÿfileÿcreatesÿaÿstand-aloneÿreport.ÿByÿincludingÿscriptingÿwhenÿtheÿreportÿisÿsavedÿasÿanÿRPXÿ file,ÿitÿcanÿlaterÿbeÿloaded,ÿrun,ÿandÿdisplayedÿdirectlyÿtoÿtheÿviewerÿcontrolÿwithoutÿusingÿtheÿdesigner.ÿInÿ conjunctionÿwithÿRPXÿfiles,ÿscriptingÿallowsÿdistributedÿreportsÿtoÿbeÿupdatedÿwithoutÿrecompiling. Note:ÿActiveReportsÿforÿNETÿ3.0ÿloadsÿRPXÿfiles,ÿincludingÿanyÿscriptingÿinÿtheÿInitializeComponent()ÿ method.ÿ ScriptingÿcanÿbeÿusedÿbyÿaddingÿC#ÿorÿVB.NETÿcodeÿtoÿtheÿscriptÿeditorÿatÿdesignÿtimeÿorÿbyÿusingÿtheÿ rpt.Scriptÿpropertyÿatÿrunÿtime.ÿTheÿscriptÿisÿthenÿsavedÿtoÿtheÿRPXÿfile.

        Toÿaccessÿtheÿscriptÿeditor,ÿclickÿtheÿscriptÿtabÿbelowÿ theÿreportÿdesignÿsurface.ÿ

        Note:ÿSinceÿtheÿRPXÿfileÿcanÿbeÿreadÿwithÿanyÿtextÿeditor,ÿtheÿAddCodeÿorÿAddNamedItemÿmethodÿ shouldÿbeÿusedÿtoÿaddÿsecureÿinformation,ÿsuchÿasÿaÿconnectionÿstring,ÿtoÿaÿproject.

        TipsÿforÿUsingÿScriptingÿ

        l Makeÿsureÿtheÿreportÿclassÿisÿpublic.ÿIfÿtheÿreportÿclassÿisÿnotÿsetÿtoÿpublic,ÿtheÿscriptÿwillÿnotÿbeÿableÿ toÿrecognizeÿtheÿitemsÿinÿyourÿreport.ÿTheÿreportÿclassÿisÿpublicÿbyÿdefault.ÿ

        l MakeÿsureÿtheÿcontrolÿbeingÿreferencedÿinÿtheÿscriptÿhasÿitsÿModifiersÿpropertyÿsetÿtoÿPublic.ÿIfÿ theÿcontrol'sÿModifiersÿpropertyÿisÿnotÿsetÿtoÿPublic,ÿtheÿcontrolÿcannotÿbeÿreferencedÿinÿscriptÿandÿanÿerrorÿ willÿbeÿraisedÿwhenÿtheÿreportÿisÿrun.ÿTheÿModifiersÿpropertyÿhasÿaÿdefaultÿvalueÿofÿPrivate,ÿsoÿyouÿmustÿ setÿthisÿpropertyÿinÿtheÿdesigner.ÿ l Useÿ"rpt."ÿTheÿscriptÿmustÿuseÿrptÿtoÿreferenceÿtheÿreportÿinsteadÿofÿthis (asÿinÿC#ÿcode-behind)ÿorÿMe (asÿinÿVBÿcode-behind).ÿÿ

        l Useÿerrorÿhandling.ÿWhenÿworkingÿwithÿscripting,ÿuseÿerrorÿhandlingÿaroundÿtheÿ.Run()ÿcall.ÿWhenÿ errorsÿareÿraised,ÿtheÿreturnedÿerrorÿshouldÿpointÿtoÿtheÿsectionÿofÿscriptÿcausingÿtheÿerror.ÿ

        l Useÿ((ControlType)rpt.Sections[SectionName].Controls[ControlName])ÿtoÿtypeÿcastÿaÿcontrolÿ andÿaccessÿitsÿproperties.

        l Createÿclassesÿinsideÿtheÿscriptÿtoÿcallÿmethods.ÿ l UseÿtheÿAddScriptReferenceÿmethodÿtoÿgainÿaccessÿtoÿ.NETÿ(orÿother)ÿnamespaces.

        ÿ l UseÿtheÿAddNamedItemÿmethodÿtoÿaccessÿclassÿfilesÿinÿaÿproject.

        l UseÿAddCodeÿtoÿinjectÿcodeÿintoÿtheÿscript.ÿ

        AccessÿControlsÿInÿScript ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ119

        Useÿ((ControlType)rpt.Sections[SectionName].Controls[ControlName])ÿtoÿtypeÿcastÿaÿcontrolÿandÿ accessÿitsÿproperties.ÿ IfÿtheÿprojectÿloadsÿanÿRPXÿfileÿintoÿaÿnewÿActiveReportÿobject,ÿtheÿscriptÿmustÿreferÿtoÿeachÿcontrolÿbyÿusingÿ ((ControlType)rpt.Sections[SectionName].Controls[ControlName]).ÿTheÿreasonÿforÿdoingÿthisÿisÿthatÿaÿnewÿ ActiveReportÿobjectÿisÿnotÿawareÿofÿtheÿobjectsÿcontainedÿinsideÿtheÿRPXÿfile.ÿIfÿyouÿareÿusingÿscriptÿinÿaÿ reportÿcontainedÿinÿaÿprojectÿandÿjustÿcreatingÿaÿnewÿinstanceÿofÿtheÿreportÿclassÿyouÿcanÿuseÿ"rpt".ÿ 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ MyBase.Load DimÿrptÿasÿnewÿActiveReport()ÿ Rpt.LoadLayout("ActiveReport1.rpx") rpt.Run() Me.Viewer1.Documentÿ=ÿrpt.Documentÿ EndÿSubÿ

        //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe)ÿ {ÿ ActiveReportÿrptÿ=ÿnewÿActiveReport();ÿ rpt.LoadLayout("ActiveReport1.rpx");ÿ rpt.Run();ÿ this.viewer1.Documentÿ=ÿrpt.Document;ÿ }

        'VB.NETÿScript PublicÿSubÿDetail_Format() CType(rpt.Sections("Detail").Controls("TextBox1"),ÿTextBox).Textÿ=ÿ"Hello" EndÿSub

        //C#ÿScript publicÿvoidÿDetail_Format()ÿ {ÿ ÿ ((TextBox)rpt.Sections["Detail"].Controls["TextBox1"]).Textÿ=ÿ"Hello";ÿ }

        ScriptÿClass

        Createÿclassesÿinsideÿtheÿscriptÿtoÿcallÿmethods. Ifÿtheÿscriptÿrequiresÿmethodÿcalls,ÿaÿclassÿcanÿbeÿconstructedÿinsideÿtheÿscript.ÿ 'VB.NETÿScript PublicÿClassÿMyFuncs PublicÿÿSubÿNew() EndÿSub PublicÿFunctionÿShowMyString()ÿAsÿString Returnÿ"Thisÿisÿmyÿstring" EndÿFunction EndÿClass

        PublicÿÿSubÿDetail_Format()ÿ DimÿfÿAsÿMyFuncsÿ=ÿÿNewÿMyFuncs()ÿ (CType(rpt.Sections("Detail").Controls("TextBox1"),ÿTextBox)).Textÿ=ÿf.ShowMyString() EndÿSub

        ÿ //C#ÿScript publicÿclassÿMyFuncs { publicÿMyFuncs() { } publicÿstringÿShowMyString() { ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ120

        returnÿ"Thisÿisÿmyÿstring"; } } publicÿvoidÿDetail_Format() {ÿ MyFuncsÿfÿ=ÿnewÿMyFuncs(); ÿ ((TextBox)rpt.Sections["Detail"].Controls["TextBox1"]).Textÿ=ÿf.ShowMyString(); }

        AddÿScriptÿReference

        UseÿtheÿAddScriptReferenceÿmethodÿtoÿgainÿaccessÿtoÿ.NETÿ(orÿother)ÿnamespaces.ÿ UseÿAddScriptReference()ÿinÿtheÿproject'sÿcodeÿtoÿaddÿreferencesÿtoÿtheÿscriptÿthatÿmightÿbeÿneeded.ÿ AddScriptReference()ÿwouldÿonlyÿneedÿtoÿbeÿusedÿifÿthereÿisÿaÿreferenceÿneededÿinsideÿtheÿscriptÿthatÿdoesÿ notÿgetÿinitializedÿinÿtheÿprojectÿbeforeÿtheÿscriptÿruns,ÿsuchÿasÿtheÿSystem.Data.dll.ÿ //C# privateÿvoidÿrunReport()ÿ {ÿ ActiveReport1ÿrptÿ=ÿnewÿActiveReport1();ÿ rpt.AddScriptReference("System.Data.dll");ÿ rpt.Run();ÿ this.viewer1.Documentÿ=ÿrpt.Document;ÿ }ÿ 'VisualÿBasic PrivateÿSubÿrunReport()ÿ DimÿrptÿasÿnewÿActiveReport1()ÿ rpt.AddScriptReference("System.Data.dll")ÿ rpt.Run()ÿ ÿ Me.Viewer1.Documentÿ=ÿrpt.Documentÿ EndÿSubÿ

        AddÿNamedÿItem

        UseÿtheÿAddNamedItemÿmethodÿtoÿaccessÿclassÿfilesÿinÿaÿproject.ÿ TheÿAddNamedItemÿmethodÿisÿusedÿtoÿallowÿtheÿscriptÿtoÿgainÿaccessÿtoÿfunctionsÿinÿaÿclassÿfileÿcontainedÿ withinÿaÿproject.ÿThisÿcanÿbeÿusefulÿforÿallowingÿsecureÿinformationÿsuchÿasÿaÿdatabaseÿconnectionÿstringÿorÿ aÿSQLÿqueryÿstringÿtoÿbeÿusedÿinÿtheÿscriptÿwithoutÿhavingÿtoÿsaveÿitÿintoÿtheÿRPXÿfile. 'VisualÿBasic PublicÿClassÿclsMyItemÿ PublicÿFunctionÿgetMyItem()ÿAsÿStringÿ getMyItemÿ=ÿ"Hello"ÿ EndÿFunctionÿ EndÿClassÿ

        //C# publicÿclassÿclsMyItemÿ {ÿ publicÿclsMyItem()ÿ {ÿ }ÿ publicÿstringÿgetMyItem()ÿ {ÿ returnÿ"Hello";ÿ }ÿ }

        'VisualÿBasic PrivateÿSubÿrptAddNamedItem_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStartÿ me.AddNamedItem("myItem",ÿnewÿclsMyItem())ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ121

        EndÿSubÿ

        //C# privateÿvoidÿrptAddNamedItem_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs)ÿ {ÿ this.AddNamedItem("myItem",ÿnewÿclsMyItem());ÿ }

        'VB.NETÿScript PublicÿSubÿDetail_Format()ÿ rpt.Label1.Textÿ=ÿmyItem.getMyItem() EndÿSub

        //C#ÿScript publicÿvoidÿDetail_Format()ÿ {ÿ ÿ rpt.Label1.Textÿ=ÿmyItem.getMyItem();ÿ }

        AddÿCode

        UseÿtheÿAddCodeÿmethodÿtoÿinjectÿcodeÿintoÿtheÿscript. TheÿAddCode methodÿallowsÿactualÿcodeÿsegmentsÿtoÿbeÿaddedÿtoÿtheÿscriptÿatÿrunÿtime.ÿThisÿisÿusefulÿforÿ allowingÿsecureÿinformation,ÿsuchÿasÿaÿdatabaseÿconnectionÿstringÿorÿSQLÿqueryÿstring,ÿtoÿbeÿusedÿinsideÿtheÿ scriptÿwithoutÿhavingÿtoÿsaveÿitÿintoÿtheÿRPXÿfile.ÿ //C# publicÿstringÿAddThisCode()ÿ {ÿ stringÿsCodeÿ=ÿ"publicÿstringÿShowACMessage()";ÿ sCodeÿ+=ÿ"{";ÿ sCodeÿ+=ÿ"returnÿ\"myÿAddedÿCode\";";ÿ sCodeÿ+="}";ÿ returnÿsCode;ÿ }ÿ privateÿvoidÿrptAddCode_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs)ÿ {ÿ this.AddCode(addThisCode());ÿ }

        'VisualÿBasic PublicÿFunctionÿaddThisCode()ÿAsÿStringÿ DimÿsCodeÿasÿStringÿ sCodeÿ=ÿ"publicÿstringÿShowACMessage(){returnÿ""myÿAddedÿCode"";}"ÿ addThisCodeÿ=ÿsCodeÿ EndÿFunctionÿ

        PrivateÿSubÿrptAddCode_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMyBase.ReportStartÿ this.AddCode(addThisCode())ÿ EndÿSubÿ

        //C#ÿScript publicÿvoidÿDetail_Format()ÿ {ÿ rpt.TextBox1.Textÿ=ÿShowACMessage();ÿ }ÿ

        'VB.NETÿScript PublicÿSubÿDetail_Format() ÿ rpt.TextBox1.Textÿ=ÿShowACMessage() EndÿSub

        GettingÿStarted ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ122

        ThisÿtopicÿwillÿshowÿyouÿhowÿtoÿbeginÿusingÿActiveReportsÿbyÿexplainingÿdifferentÿaspectsÿofÿActiveReportsÿ andÿshowingÿyouÿhowÿtoÿincludeÿitÿinÿyourÿVisualÿStudioÿ.NETÿIDEÿ(IntegratedÿDevelopmentÿEnvironment). ÿ ActiveReportsÿandÿtheÿWeb LearnÿaboutÿusingÿActiveReportsÿwithÿtheÿWeb.ÿ AddingÿActiveReportsÿControlsÿtoÿtheÿVisualÿStudioÿToolbox LearnÿhowÿtoÿaddÿActiveReportsÿcontrolsÿtoÿtheÿtoolboxÿinÿVisualÿStudio.ÿ AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿ.NETÿProject LearnÿhowÿtoÿaddÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject.ÿ ActiveReportsÿDesigner LearnÿhowÿtoÿuseÿtheÿActiveReportsÿdesigner.ÿ ViewingÿActiveReports LearnÿhowÿtoÿpreviewÿaÿreportÿatÿdesignÿtimeÿasÿwellÿasÿuseÿtheÿWinFormÿViewerÿtoÿviewÿaÿreportÿatÿrunÿ time.ÿ AddingÿFieldÿExpressions Learnÿhowÿtoÿaddÿfieldÿexpressionsÿtoÿaÿtextÿboxÿdataÿfield.ÿ BindingÿReportsÿtoÿaÿDataÿSource Learnÿhowÿtoÿbindÿreportsÿtoÿvariousÿdataÿsources.ÿ GroupingÿData LearnÿhowÿtoÿuseÿtheÿGroupHeaderÿtoÿgroupÿdataÿinÿaÿreport.ÿ SavingÿandÿLoadingÿRPX-basedÿReportÿLayouts LearnÿhowÿtoÿsaveÿandÿloadÿRPX-basedÿreportÿlayoutsÿinÿActiveReportsÿforÿ.NETÿ3.0.ÿ LocalizingÿtheÿViewerÿControl LearnÿhowÿtoÿlocalizeÿsettingsÿforÿtheÿActiveReportsÿViewerÿcontrol.ÿ MetricÿUnits LearnÿhowÿtoÿuseÿmetricÿunitsÿwithÿActiveReportsÿforÿ.NETÿ3.0.ÿ OptimizingÿActiveReports Learnÿhowÿtoÿoptimizeÿveryÿlargeÿreports.ÿ SavingÿandÿLoadingÿRDFÿFiles LearnÿhowÿtoÿsaveÿandÿloadÿreportsÿasÿRDFÿfilesÿatÿrunÿtime.ÿ SavingÿandÿLoadingÿRPXÿFiles LearnÿhowÿtoÿsaveÿandÿloadÿreportsÿasÿRPXÿfilesÿatÿrunÿtime.ÿ LimitationsÿinÿExportÿFormats LearnÿaboutÿsomeÿofÿtheÿlimitationsÿofÿtheÿvariousÿActiveReportsÿexportÿfilters.ÿ UsingÿCharts LearnÿaboutÿusingÿtheÿnewÿChartÿcontrol.ÿ UsingÿAnnotations LearnÿhowÿtoÿuseÿtheÿAnnotationsÿwithÿyourÿreports.ÿ

        RelatedÿSections Samples ActiveReportsÿincludesÿmanyÿsamplesÿwhichÿdemonstrateÿapplicationsÿtheÿdevelopersÿcreatedÿforÿ ActiveReports.ÿTheseÿsamplesÿshowÿtheÿuseÿofÿaÿcombinationÿofÿcontrolsÿandÿcodeÿtoÿproduceÿvariousÿ reports.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ123

        Walkthroughs LearnÿhowÿtoÿcreateÿvariousÿtypesÿofÿapplicationsÿinÿC#ÿandÿVisualÿBasicÿ.NET--oneÿstepÿatÿaÿtime.ÿ TechnicalÿSupport ÿ TechnicalÿsupportÿisÿavailableÿforÿActiveReportsÿforÿ.NETÿ3.0ÿinÿaÿvarietyÿofÿmedia.ÿ

        ActiveReportsÿandÿtheÿWeb

        ActiveXÿViewerÿControl Learnÿaboutÿtheÿproperties,ÿmethods,ÿandÿeventsÿforÿtheÿActiveXÿViewerÿControl.ÿ

        ManuallyÿConfiguringÿWebÿSamplesÿ LearnÿhowÿtoÿmanuallyÿconfigureÿActiveReportsÿWebÿSamples.ÿ

        ActiveXÿViewerÿControl

        Properties

        Property DataÿTypeÿ Descriptionÿ

        AllowSplitterÿ Booleanÿ Setsÿorÿreturnsÿwhetherÿorÿnotÿtheÿ viewerÿcanÿbeÿsplitÿintoÿtwoÿwindows.ÿ

        BackColorÿ OLE_COLORÿ Setsÿorÿreturnsÿtheÿbackgroundÿcolorÿofÿ theÿviewer.ÿ

        BorderStyleÿ BorderStyleÿ Setsÿorÿreturnsÿtheÿborderÿstyle.ÿ

        DataPathÿ Stringÿ Reportÿfileÿ(RDF)ÿURLÿforÿasynchronousÿ downloads.ÿ

        Objectÿ Objectÿ Returnsÿanÿobjectÿinÿaÿcollectionÿ

        Pagesÿ Pagesÿcollectionÿ Returnsÿaÿreferenceÿtoÿtheÿcurrentÿpagesÿ collectionÿdisplayedÿinÿtheÿviewer.ÿ

        PaperColorÿ OLE_COLORÿ Setsÿorÿreturnsÿtheÿpaperÿbackgroundÿ color.ÿ

        Printerÿ Printerÿ Returnsÿaÿreferenceÿtoÿtheÿviewer'sÿ printerÿobject.ÿ

        ReportSourceÿ Objectÿ Setsÿorÿreturnsÿaÿreferenceÿtoÿtheÿlinkedÿ subreport.ÿ

        RulerVisibleÿ Booleanÿ Setsÿorÿreturnsÿwhetherÿorÿnotÿtheÿ viewer'sÿtopÿandÿsideÿrulersÿareÿshownÿatÿ run-time.ÿ

        Statusÿ ViewerStatusÿ Returnsÿtheÿstatusÿofÿloadingÿpagesÿintoÿ theÿviewerÿcache.ÿ

        TOCÿ TOCÿ Returnsÿaÿreferenceÿtoÿtheÿtableÿofÿ contentsÿobject.ÿ

        TOCEnabledÿ Booleanÿ DisablesÿorÿenablesÿtheÿTOCÿtree.ÿ

        TOCVisibleÿ Booleanÿ Determinesÿwhetherÿtheÿtableÿofÿ contentsÿtreeÿisÿvisible.ÿ

        TOCWidthÿ Singleÿ SetsÿorÿreturnsÿtheÿwidthÿofÿtheÿTOCÿtreeÿ whenÿdisplayed.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ124

        Toolbarÿ DDToolbarÿ Returnsÿaÿreferenceÿtoÿtheÿbuilt -inÿ toolbarÿobject.ÿTheÿtoolbarÿobjectÿallowsÿ youÿmodifyÿtheÿtoolbar'sÿiconsÿandÿtools.ÿ

        ToolbarVisibleÿ Booleanÿ Determinesÿwhetherÿtheÿbuilt-inÿtoolbarÿ isÿvisible.ÿ

        UseSourcePrinterÿ Booleanÿ Sets/returnÿwhetherÿtheÿviewerÿorÿ ReportSourceÿprinterÿisÿusedÿtoÿprintÿtheÿ report.ÿ

        Zoomÿ Integerÿ Setsÿorÿreturnsÿtheÿzoomÿlevelÿofÿtheÿ currentÿpageÿview.ÿ

        Methods

        Method Description

        CopyPageToClipboardÿ Copiesÿtheÿindicatedÿpageÿtoÿtheÿclipboard.ÿ SubÿCopyPageToClipboard([Page])

        Findÿ Searchesÿaÿreportÿforÿaÿspecifiedÿstring.ÿ SubÿFind(View AsÿSplitViewTypes,ÿSearchText AsÿString,ÿ Direction AsÿSearchDirectionTypes,ÿMatchCase Asÿ Boolean,ÿMatchWord AsÿBoolean)

        Localizeÿ Allowsÿmodificationÿofÿtheÿcaptionÿofÿtheÿstringÿusedÿinÿtheÿ previewÿwindow.ÿ Localize(index AsÿInteger,ÿstr AsÿString)

        MultiplePageÿ Switchesÿtheÿviewerÿsettingsÿsoÿmultipleÿpagesÿcanÿbeÿdisplayedÿ atÿoneÿtime.ÿ SubÿMultiplePage(View AsÿSplitViewTypes,ÿrows Asÿ Integer,ÿcols AsÿInteger)

        PrintReportÿ Printsÿtheÿviewerÿpagesÿcollectionÿtoÿtheÿselectedÿdevice.ÿ SubÿPrintReport(bDisplayDialog AsÿBoolean)

        Refreshÿ Refreshesÿtheÿviewerÿcontrol.ÿ SubÿRefresh()

        SinglePageÿ Switchesÿtheÿviewerÿbackÿtoÿdisplayingÿaÿsingleÿpage.ÿ SubÿSinglePage(View AsÿSplitViewTypes)

        Events

        Eventÿ Descriptionÿ

        DblClickÿ Firedÿwhenÿtheÿuserÿdoubleÿclicksÿtheÿmouseÿinÿtheÿviewer.ÿ SubÿDblClick()ÿ

        Errorÿ Occursÿwhenÿanÿerrorÿfires.ÿ SubÿError(Number AsÿInteger,ÿByValÿDescription Asÿ String,ByValÿSCode AsÿLong,ÿByValÿSource AsÿString,ÿ ByValÿHelpFile AsÿString,ÿByValHelpContext AsÿLong,ÿ CancelDisplay AsÿBoolean)

        FindProgressÿ Thisÿeventÿfiresÿwhenÿaÿsearchÿisÿperformedÿonÿaÿreportÿ loadedÿintoÿtheÿviewer.ÿWhenÿaÿsearchÿreachesÿaÿreport'sÿendÿ orÿbeginning,ÿtheÿeventÿwillÿfire.ÿ EventÿFindProgress(ByValÿResultÿAsÿ DDActiveReortsViewer2Ctl.FindResults) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ125

        HyperLinkÿ Thisÿeventÿfiresÿwhenÿaÿhyperlinkÿisÿclicked.ÿTheÿeventÿcanÿbeÿ usedÿtoÿredirectÿtheÿhyperlinkÿorÿpreventÿtheÿlinkÿfromÿ activating.ÿ SubÿHyperlink(ByValÿButton AsÿInteger,ÿLink Asÿ String)

        KeyDownÿ Firedÿwhenÿaÿkeyÿisÿpressedÿdownÿwhileÿtheÿviewerÿhasÿfocus.ÿ SubÿKeyDown(KeyCode AsÿInteger,ÿShift AsÿInteger)

        KeyPressÿ FiredÿWhenÿaÿkeyÿisÿpressedÿandÿreleasedÿwhileÿtheÿviewerÿ hasÿfocus.ÿ SubÿKeyPress(KeyAscii AsÿInteger)

        KeyUpÿ Firedÿwhenÿaÿkeyÿisÿreleasedÿwhileÿtheÿviewerÿhasÿfocus.ÿ SubÿKeyUp(KeyCode AsÿInteger,ÿShift AsÿInteger)

        LoadCompletedÿ Firedÿwhenÿallÿtheÿpagesÿinÿtheÿreportÿsourceÿhaveÿbeenÿ loadedÿintoÿtheÿviewer.ÿ SubÿLoadCompleted()

        MouseDownÿ Firedÿwhenÿaÿmouseÿbuttonÿisÿpressedÿdown.ÿ SubÿMouseDown(Button AsÿInteger,ÿShift AsÿInteger,ÿ X AsÿSingle,Y AsÿSingle)

        MouseMoveÿ Firedÿasÿtheÿmouseÿmovesÿoverÿtheÿviewerÿarea.ÿ SubÿMouseMove(ButtonÿAsÿInteger,ÿShift AsÿInteger,ÿ X AsÿSingle,ÿY AsÿSingle)

        MouseOverÿ Thisÿeventÿfiresÿwhenÿtheÿmouseÿmovesÿoverÿaÿreportÿpage.ÿ Ifÿtheÿmouseÿmovesÿoverÿaÿcontrolÿwithÿaÿhyperlink,ÿthenÿtheÿ linkÿwillÿbeÿreturned.ÿ SubÿMouseOver(ByValÿPageX AsÿLong,ÿByValÿPageY Asÿ Long,ÿByValÿHyperlink AsÿString)

        MouseUpÿ Firedÿwhenÿaÿmouseÿbuttonÿisÿreleased.ÿ SubÿMouseUp(Button AsÿInteger,ÿShift AsÿInteger,ÿX AsÿSingle,ÿY AsÿSingle)

        PageModeChangedÿ Firedÿwhenÿtheÿviewerÿswitchesÿbetweenÿdisplayingÿaÿsingleÿ pageÿandÿmultipleÿpages.ÿ SubÿPageModeChanged(ByValÿMultiplePage AsÿBoolean)

        PrintAbortedÿ CalledÿinÿtheÿPrintReportÿMethodÿwhenÿtheÿuserÿcancelsÿaÿ printÿjobÿbeforeÿitÿfinishes.ÿ SubÿPrintAborted() TOCClickÿ FiredÿonÿaÿmouseÿclickÿinÿtheÿTOCÿtreeviewÿwindow.ÿ SubÿTOCClick(ByValÿButtonÿAsÿInteger,ÿByValÿAsÿ Long,ÿByValÿFlags AsÿLong)

        TOCSelChangeÿ FiredÿwhenÿtheÿTOCÿselectionÿchanges.ÿ SubÿTOCSelChangeÿ(ByValÿItemIndex AsÿLong)

        ToolbarClickÿ Firedÿwhenÿtheÿuserÿclicksÿonÿaÿtoolÿinÿtheÿviewerÿtoolbar.ÿ SubÿToolbarClick(ByValÿTool AsÿDDTool)

        ÿ ZoomChangedÿ Firedÿwhenÿtheÿviewer'sÿzoomÿpercentageÿchanges.ÿ SubÿZoomChanged()

        ManuallyÿConfiguringÿWebÿSamples ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ126

        InstallingÿtheÿSampleÿWebÿApplication

        Toÿinstallÿtheÿsampleÿwebÿapplication ÿ 1. InÿtheÿControlÿPanel,ÿdouble-clickÿ"AdministrativeÿTools."ÿDouble-clickÿ"InternetÿInformationÿServicesÿ (InternetÿServicesÿManagerÿforÿWindowsÿ2000)"ÿtoÿopenÿitsÿdialogÿwindow.ÿ

        2. Right-clickÿonÿ"DefaultÿWebÿSite"ÿthenÿclickÿNewÿ>ÿVirtualÿDirectory. 3. ClickÿNextÿwhenÿyouÿseeÿtheÿ"VirtualÿDirectoryÿCreationÿWizard."ÿ 4. InÿtheÿAliasÿfield,ÿenterÿoneÿofÿtheÿfollowingÿfolderÿnames,ÿdependingÿonÿwhichÿwebÿsampleÿyouÿneedÿtoÿ configure:ÿ ¡ ArWebSampleStdCsÿ

        ¡ ArWebSampleStdVbÿ ¡ ArWebSampleProCsÿ ¡ ArWebSampleProVbÿ 5. ClickÿNextÿtoÿcontinue.ÿ 6. ClickÿBrowse toÿfindÿtheÿfolderÿinÿwhichÿActiveReportsÿisÿinstalled.ÿFindÿandÿselectÿtheÿappropriateÿfolder.ÿ 7. ClickÿOK toÿcontinueÿandÿthenÿclickÿNext.ÿ 8. Makeÿsureÿtheÿ"Read"ÿandÿ"RunÿScripts"ÿpermissionsÿareÿcheckedÿandÿclickÿNext.ÿ 9. TheÿActiveReportsÿWebÿsampleÿisÿnowÿinstalled.ÿ ÿ Note IfÿyouÿareÿonlyÿconfiguringÿStandardÿEditionÿWebÿSamples,ÿyouÿdoÿnotÿneedÿtoÿcompleteÿtheÿ followingÿsteps.ÿ

        ConfiguringÿtheÿActiveReportsÿHTTPHandlers

        ToÿconfigureÿtheÿHTTPHandler ÿ 1. InÿtheÿControlÿPanel,ÿdouble-clickÿ"AdministrativeÿTools."ÿDouble-clickÿ"InternetÿInformationÿServices"ÿtoÿ openÿitsÿdialogÿwindow.ÿ 2. Right-clickÿonÿtheÿWebÿsiteÿthatÿyouÿneedÿtoÿconfigureÿtheÿHTTPHandlersÿfor,ÿthenÿclickÿProperties.ÿ 3. Clickÿonÿtheÿ"HomeÿDirectory"ÿtabÿofÿtheÿ"DefaultÿWebÿSiteÿProperties"ÿdialog.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ127

        4. ClickÿonÿtheÿConfigurationÿbutton.ÿ

        5. Inÿtheÿ"ApplicationÿMappings"ÿwindowÿofÿtheÿApplicationÿConfigurationÿdialog,ÿselectÿtheÿlistÿitemÿ withÿ.aspxÿinÿtheÿextensionÿcolumnÿandÿclickÿEdit.ÿNoteÿthatÿifÿyourÿmachineÿdoesÿnotÿhaveÿtheÿASP.NETÿ serverÿcomponentsÿinstalled,ÿtheÿ.aspxÿhandlerÿwillÿnotÿshowÿupÿinÿtheÿApplicationÿMappingsÿlist.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ128

        6. Selectÿandÿcopyÿallÿofÿtheÿtextÿinÿtheÿ"Executable"ÿfield.ÿClickÿCancel toÿreturnÿtoÿtheÿApplicationÿ Configurationÿdialog.ÿ 7. ClickÿAdd inÿtheÿApplicationÿConfigurationÿdialogÿtoÿaddÿaÿnewÿApplicationÿMapping.ÿ 8. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿandÿenterÿ".rpx"inÿtheÿExtensionÿfield.ÿ

        9. ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ ÿ

        Toÿconfigureÿtheÿcompiledÿreportÿhandler (continuingÿfromÿStepÿ9ÿinÿ"ToÿConfigureÿtheÿHTTPHandler)ÿ 1. InÿtheÿApplicationÿConfigurationÿdialog,ÿclickÿAdd toÿaddÿaÿnewÿApplicationÿMapping.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ129

        2. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿabove.ÿ 3. Enterÿ.ActiveReportÿinÿtheÿExtensionÿfield.ÿ 4. Makeÿsureÿtheÿ"Checkÿthatÿfileÿexists"ÿpermissionÿisÿunchecked.ÿ

        5. ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ ÿ

        ToÿconfigureÿtheÿWebCacheAccessHandlerÿ(continuingÿfromÿStepÿ9ÿinÿ"ToÿConfigureÿtheÿHTTPHandler)ÿÿÿ 1. InÿtheÿApplicationÿConfigurationÿdialog,ÿclickÿAdd toÿaddÿaÿnewÿApplicationÿMapping.ÿ 2. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿabove.ÿ 3. Enterÿ.ArCacheItemÿinÿtheÿExtensionÿfield.ÿ 4. Makeÿsureÿtheÿ"Checkÿthatÿfileÿexists"ÿpermissionÿisÿunchecked.ÿ

        5.ÿ ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ 6. ClickÿOK onÿtheÿremainingÿopenÿdialogsÿtoÿexitÿtheÿIISÿAdministrativeÿtool.ÿ

        AddingÿActiveReportsÿControlsÿtoÿtheÿVisualÿStudioÿToolbox

        AddingÿtheÿActiveReportsÿControls

        Toÿaddÿtheÿcontrols ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ130

        1. Right-clickÿonÿtheÿtoolboxÿtabÿwhereÿyouÿwantÿtoÿaddÿActiveReportsÿcontrols.ÿ 2. InÿVisualÿStudioÿ.NETÿÿ2003ÿselectÿAdd/RemoveÿItems;ÿinÿVisualÿStudioÿ2005ÿselectÿChooseÿItems. 3. SelectÿtheÿDesigner,ÿReportExplorer,ÿHtmlExport,ÿPdfExport,ÿViewerÿandÿWebViewerÿcontrolsÿinÿtheÿ DataDynamics.ActiveReportsÿnamespaceÿinÿtheÿcomponentsÿlistÿview.ÿ(Hint:ÿSortÿbyÿNamespaceÿtoÿseeÿallÿ ofÿtheÿDataDynamicsÿassembliesÿtogether.)ÿ

        ÿ

        4. ClickÿOK toÿaddÿtheÿcontrolsÿtoÿyourÿselectedÿtoolbox.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿ.NETÿProject

        CreatingÿtheÿProject TheÿfirstÿstepÿisÿcreatingÿaÿnewÿVisualÿStudioÿProject.

        Toÿcreateÿtheÿproject 1. FromÿtheÿFileÿmenu,ÿclickÿonÿNew andÿchooseÿProject. 2. SelectÿProject,ÿthenÿAddÿNewÿItem. 3. SelectÿActiveReportsÿ3.0ÿFile andÿnameÿyourÿnewÿreport.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ131

        ÿ

        4. ClickÿOpen toÿaddÿtheÿreportÿtoÿyourÿproject.

        ActiveReportsÿDesigner

        Withÿitsÿvariousÿtoolsÿandÿqualities,ÿActiveReportsÿforÿ.NETÿ3.0ÿoffersÿgreatÿflexibilityÿinÿconstructingÿreportÿ projects.ÿInÿthisÿsection,ÿyouÿwillÿlearnÿhowÿtoÿuseÿtheÿdifferentÿfeaturesÿofÿtheÿActiveReportsÿDesigner. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ132

        ÿ DesignÿSurface Learnÿmoreÿaboutÿtheÿfeaturesÿofÿtheÿdesignÿsurface.ÿ DesignerÿTabs Learnÿmoreÿaboutÿtheÿdesignerÿtabs.ÿ ReportÿExplorer LearnÿaboutÿtheÿfeaturesÿandÿfunctionalityÿofÿtheÿReportÿExplorer.ÿ ReportÿMenu Learnÿaboutÿtheÿdifferentÿaspectsÿofÿtheÿreportÿmenu.ÿ Toolbars LearnÿhowÿtoÿuseÿtheÿActiveReportsÿtoolbars.ÿ

        ÿ Toolbox LearnÿaboutÿtheÿfunctionsÿofÿtheÿcontrolsÿonÿtheÿActiveReportsÿtoolbox.ÿ

        DesignÿSurface

        TheÿActiveReportsÿdesignÿsurfaceÿleveragesÿyourÿcurrentÿknowledgeÿofÿVisualÿStudioÿ.NET'sÿdesignerÿinterfaceÿ andÿprovidesÿfullÿintegrationÿwithinÿtheÿVisualÿStudioÿenvironment. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ133

        ToÿaccessÿtheÿActiveReportsÿdesignÿsurface 1. OpenÿaÿVisualÿStudioÿproject.ÿ 2. AddÿanÿActiveReportÿtoÿyourÿproject.ÿ 3. Onceÿtheÿreportÿisÿadded,ÿyouÿwillÿseeÿtheÿreportÿdesignÿsurface.ÿ ÿ TheÿdefaultÿActiveReportsÿdesignÿsurfaceÿisÿmadeÿupÿofÿtheÿfollowingÿbaseÿcomponents: l PageHeaderÿsection--Thisÿsectionÿcanÿbeÿusedÿtoÿprintÿcolumnÿheaders,ÿpageÿnumbers,ÿpageÿtitles,ÿorÿanyÿ informationÿthatÿneedsÿtoÿbeÿprintedÿonceÿatÿtheÿtopÿofÿeachÿpage.ÿBoundÿcontrolsÿinÿtheÿPageHeaderÿorÿ PageFooterÿareÿnotÿsupported.ÿÿTheÿdataÿinÿsuchÿcontrolsÿmayÿnotÿbeÿinÿsynchÿwithÿtheÿdataÿdisplayedÿinÿ otherÿsectionsÿonÿtheÿpage.ÿ

        l Detailÿsection--Thisÿsectionÿisÿtheÿbodyÿofÿtheÿreportÿthatÿprintsÿonceÿforÿeachÿrecordÿinÿtheÿdataÿsource.ÿ

        l DataSourceÿicon--Thisÿcontrolÿcanÿbeÿusedÿtoÿconnectÿtheÿreport'sÿdataÿsourceÿsettingsÿtoÿanÿexistingÿdataÿ sourceÿ l PageFooterÿsection--Thisÿsectionÿcanÿbeÿusedÿtoÿprintÿpageÿtotals,ÿpageÿnumbersÿorÿanyÿotherÿinformationÿ thatÿneedsÿtoÿbeÿprintedÿonceÿatÿtheÿbottomÿofÿeachÿpage.ÿ l Designer/Script/Previewÿtabs--TheÿDesignerÿandÿScriptÿtabsÿcanÿbeÿclickedÿtoÿtoggleÿbetweenÿdesignÿandÿ ÿ scriptÿviews,ÿwhileÿtheÿPreviewÿtabÿallowsÿforÿaÿfullyÿfunctionalÿdesign-timeÿpreviewÿofÿhowÿaÿreportÿwillÿ lookÿandÿbehaveÿatÿrunÿtime.ÿÿÿ

        DesignerÿTabs

        TheÿdesignerÿtabsÿlocatedÿatÿtheÿbottomÿofÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿdesignÿsurfaceÿallowÿyouÿtoÿquicklyÿ accessÿvariousÿaspectsÿofÿActiveReports.ÿTheÿActiveReportsÿdesignerÿisÿequippedÿwithÿthreeÿtabs,ÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ134

        Designerÿtab,ÿtheÿScriptÿtab,ÿandÿtheÿPreviewÿtab.ÿ l DesignerÿTab:ÿByÿdefault,ÿwhenÿyouÿcreateÿorÿopenÿanÿActiveReportÿtheÿdesignerÿtabÿisÿselected.ÿWhileÿ inÿthisÿtabÿofÿtheÿActiveReport,ÿyouÿcanÿperformÿallÿdesign-timeÿandÿrun-timeÿfunctionsÿassociatedÿwithÿ yourÿreport,ÿsuchÿasÿcreatingÿaÿlayout,ÿbindingÿtoÿdataÿsources,ÿcreatingÿevent-handlingÿmethods,ÿandÿ more.ÿ

        ÿ l ScriptÿTab:ÿByÿselectingÿtheÿScriptÿtab,ÿyouÿopenÿtheÿscriptÿeditor,ÿwhichÿgivesÿyouÿtheÿabilityÿtoÿeasilyÿ andÿquicklyÿaddÿscriptingÿtoÿyourÿreport.ÿTheÿscriptÿeditorÿcontainsÿtwoÿcomboboxesÿthatÿallowÿyouÿtoÿ selectÿanyÿsectionÿofÿtheÿActiveReportÿandÿallÿeventsÿassociatedÿwithÿthatÿsection.ÿWhenÿyouÿselectÿaÿ sectionÿandÿanÿevent,ÿtheÿscriptÿeditorÿgeneratesÿaÿmethodÿstubÿforÿtheÿevent.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ135

        ÿ l PreviewÿTab:ÿTheÿPreviewÿtabÿallowsÿyouÿtoÿquicklyÿviewÿwhatÿyourÿreportÿlooksÿlikeÿatÿrunÿtimeÿwithoutÿ needingÿtoÿactuallyÿrunÿyourÿproject.ÿThisÿmakesÿitÿeasyÿtoÿquicklyÿseeÿtheÿrun-timeÿimpactÿofÿchangesÿ youÿmakeÿinÿtheÿdesignerÿorÿtheÿcode-behind.ÿToÿgainÿaÿreportÿpreview,ÿtoggleÿfromÿtheÿDesignerÿorÿ ScriptÿtabÿtoÿtheÿPreviewÿtab.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ136

        ÿ

        ReportÿExplorer

        InÿActiveReportsÿforÿ.NETÿ3.0ÿtheÿReportÿExplorerÿservesÿasÿtheÿinformationÿfocalÿpointÿforÿyourÿreport.ÿFromÿ it,ÿyouÿcanÿgainÿaÿquickÿoverviewÿofÿtheÿelementsÿthatÿcompriseÿtheÿreport,ÿremoveÿindividualÿcontrols,ÿaddÿ parametersÿandÿcalculatedÿfields,ÿchangeÿreportÿsettings,ÿbindÿdataÿfieldsÿtoÿtextboxÿcontrols,ÿandÿ modifyÿpropertiesÿandÿreportÿbehaviorÿviaÿtheÿPropertiesÿgrid. IfÿyouÿdoÿnotÿseeÿtheÿReportÿExplorerÿwithinÿtheÿVisualÿStudioÿIDE,ÿdoÿtheÿfollowing: 1. Right-clickÿonÿtheÿVisualÿStudioÿtoolbar.ÿ 2. SelectÿActiveReportsÿforÿ.NETÿ3.0 fromÿtheÿshortcutÿmenuÿtoÿdisplayÿtheÿdesignerÿtoolbar.ÿ 3. Onÿtheÿdesignerÿtoolbar,ÿclickÿtheÿViewÿReportÿExplorer button.

        Alternatively,ÿyouÿcanÿdisplayÿtheÿReportÿExplorerÿbyÿopeningÿtheÿView menu,ÿpointingÿtoÿOtherÿWindows,ÿ andÿclickingÿReportÿExplorer. Note:ÿOnceÿtheÿReportÿExplorerÿhasÿbeenÿaddedÿtoÿtheÿIDE,ÿitÿwillÿappearÿwhenÿaÿnewÿ WindowsÿApplicationÿisÿcreated.ÿIfÿyouÿdoÿnotÿwishÿtoÿseeÿtheÿReportÿExplorerÿyouÿcanÿcloseÿitÿ byÿselectingÿtheÿwindowÿandÿclosingÿit.ÿ TheÿReportÿExplorerÿlaysÿoutÿinÿoneÿplaceÿtheÿsumÿtotalÿofÿtheÿelementsÿcontainedÿinÿyourÿreport. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ137

        ÿ TheÿfollowingÿdemonstratesÿhowÿyouÿcanÿquicklyÿmodifyÿaÿreportÿusingÿtheÿReportÿExplorer.ÿ

        Toÿremoveÿindividualÿcontrols ÿ 1. InÿtheÿReportÿExplorer,ÿexpandÿtheÿtreeÿthatÿcontainsÿtheÿtheÿcontrolÿyouÿwishÿtoÿremove.ÿForÿexample,ÿifÿ youÿwantÿtoÿremoveÿaÿReportInfoÿcontrolÿfromÿaÿgroupÿheader,ÿexpandÿtheÿgroupÿheaderÿthatÿcontainsÿ theÿcontrol.ÿÿ 2. Right-clickÿonÿtheÿcontrolÿandÿselectÿDelete fromÿtheÿshortcutÿmenu.ÿ 3. ClickÿYesÿinÿtheÿReportÿExplorerÿdialogÿtoÿconfirmÿyourÿdecision.ÿ

        Toÿaddÿparameters 1. InÿtheÿReportÿExplorer,ÿright-clickÿonÿtheÿParameters node.ÿ 2. SelectÿAdd fromÿtheÿshortcutÿmenu.ÿ 3. SetÿanyÿdesiredÿpropertiesÿorÿeventsÿforÿtheÿparameterÿinÿtheÿPropertiesÿgrid.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ138

        4. DragÿtheÿparameterÿfromÿtheÿReportÿExplorerÿontoÿtheÿdesignÿsurfaceÿofÿyourÿreport. Thisÿwillÿcreateÿaÿ textboxÿobjectÿthatÿisÿboundÿtoÿtheÿparameter.

        Toÿaddÿcalculatedÿfields 1. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields tree.ÿ 2. Right-clickÿonÿtheÿCalculated node.ÿ 3. SelectÿAdd fromÿtheÿshortcutÿmenu.ÿ 4. SetÿanyÿdesiredÿpropertiesÿorÿeventsÿforÿtheÿfieldÿinÿtheÿPropertiesÿgrid.ÿ 5. DragÿtheÿfieldÿfromÿtheÿReportÿExplorerÿontoÿtheÿdesignÿsurfaceÿofÿyourÿreport. Thisÿwillÿcreateÿaÿtextboxÿ objectÿthatÿisÿboundÿtoÿtheÿfield.

        ÿ

        Toÿchangeÿreportÿsettings 1. InÿtheÿReportÿExplorer,ÿright-clickÿonÿtheÿSettings node.ÿ 2. SelectÿShow fromÿtheÿshortcutÿmenuÿtoÿopenÿtheÿReportÿSettingsÿdialog.ÿ 3. MakeÿanyÿdesiredÿchangesÿandÿclickÿOK .ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ139

        Toÿbindÿdataÿfieldsÿtoÿtextboxÿcontrols 1. InÿtheÿReportÿExplorer,ÿselectÿtheÿdataÿfieldÿyouÿwantÿtoÿbindÿtoÿaÿtextboxÿcontrol.ÿÿ 2. Dragÿtheÿfieldÿontoÿtheÿdesignÿsurfaceÿofÿtheÿreport.ÿAÿtextboxÿcontrolÿisÿcreatedÿandÿboundÿtoÿtheÿfield,ÿ whichÿisÿreflectedÿinÿtheÿtextbox'sÿDataField andÿName properties.ÿForÿexample,ÿifÿyouÿdraggedÿaÿfieldÿ namedÿ"EmployeeID,"ÿtheÿDataField propertyÿofÿtheÿtextboxÿisÿsetÿtoÿEmployeeID andÿtheÿtextboxÿisÿ namedÿ"txtEmployeeID1."ÿ

        Toÿmodifyÿpropertiesÿandÿreportÿbehavior 1. InÿtheÿReportÿExplorer,ÿselectÿtheÿreportÿelementÿyouÿwantÿtoÿmodify.ÿTheÿPropertiesÿgridÿdisplaysÿallÿ

        ÿ availableÿpropertiesÿandÿeventsÿforÿtheÿelement.ÿÿ 2. InÿtheÿPropertiesÿgrid,ÿchangeÿanyÿpropertiesÿorÿeventsÿtoÿimplementÿtheÿchanges.

        ReportÿMenu

        Theÿreportÿmenuÿallowsÿaccessÿtoÿsaveÿtheÿcurrentÿreportÿlayout,ÿloadÿexistingÿreportÿlayouts,ÿmodifyÿtheÿ reportÿdataÿsourceÿorÿmodifyÿreportÿsettings.ÿ

        Toÿaccessÿtheÿreportÿmenu 1. OpenÿaÿnewÿorÿexistingÿActiveReport.ÿ 2. Clickÿonÿanyÿsectionÿinÿtheÿreportÿtoÿselectÿit.ÿ 3. ClickÿonÿReport fromÿtheÿmainÿtoolbar.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ140

        ÿ TheÿReportÿMenuÿallowsÿtheÿfollowingÿoptions: l SaveÿLayoutÿ TheÿSaveÿLayoutÿoptionÿallowsÿforÿtheÿexistingÿreportÿlayoutÿtoÿbeÿsavedÿasÿanÿrpxÿfile.

        l LoadÿLayoutÿ TheÿLoadÿLayoutÿoptionÿallowsÿaccessÿtoÿloadÿanÿexistingÿreportÿlayoutÿintoÿtheÿopenÿActiveReport.

        l DataÿSourceÿ TheÿDataÿSourceÿoptionÿallowsÿaccessÿtoÿaddÿDataÿSourceÿparametersÿorÿmodifyÿexistingÿDataÿSourceÿ settings.

        ÿ l Settingsÿ TheÿSettingsÿoptionÿallowsÿaccessÿtoÿchangeÿprinterÿorÿpageÿsettings,ÿstylesheets,ÿorÿglobalÿsettings.

        Toolbars

        TheÿtoolbarsÿinÿActiveReportsÿcanÿbeÿeasilyÿcustomized.ÿActiveReports'ÿtoolbarsÿallowÿdevelopersÿtoÿrearrangeÿ buttonsÿandÿmenuÿoptions,ÿasÿwellÿasÿhide,ÿdisplay,ÿdockÿorÿfloatÿtoolbars.ÿ

        Toÿaccessÿaÿtoolbar'sÿshortcutÿmenu l Right-clickÿanywhereÿinÿtheÿtoolbarÿareaÿ Theÿshortcutÿmenuÿallowsÿyouÿtoÿshowÿorÿhideÿtoolbarsÿbyÿselectingÿtheÿtoolbarÿnameÿfromÿtheÿmenu.ÿInÿ addition,ÿyouÿcanÿcustomizeÿtheÿtoolbarsÿorÿcreateÿaÿnewÿtoolbarÿfromÿtheÿcustomizeÿoptionÿonÿtheÿmenu. ÿ

        TheÿActiveReportsÿtoolbarÿisÿmadeÿupÿofÿtheÿfollowingÿcomponents:ÿ l ReportÿExplorer--ShowsÿorÿhidesÿtheÿreportÿexplorerÿtreeÿandÿtheÿFieldsÿlist l StyleÿSheets--Setsÿtheÿstyleÿsheetÿforÿaÿcontrolÿ

        l Font--Setsÿtheÿtypefaceÿofÿtheÿselectedÿlabel,ÿcheckbox,ÿorÿtextboxÿcontrolÿ l Size--Setsÿtheÿfontÿsizeÿofÿtheÿselectedÿlabel,ÿcheckbox,ÿorÿtextboxÿcontrolÿ l ViewÿGrid--Turnsÿtheÿgridÿdisplayÿonÿorÿoffÿ

        l ReorderÿGroups--Displaysÿtheÿgroupsÿorderÿdialogÿ l New! ZoomÿOut--Incrementallyÿreducesÿtheÿmagnificationÿlevelÿofÿtheÿdesignÿsurfaceÿ

        l New! ZoomÿIn--Incrementallyÿincreasesÿtheÿmagnificationÿlevelÿofÿtheÿdesignÿsurfaceÿ

        l Bold--Setsÿtheÿboldÿtypefaceÿonÿorÿoffÿ l Italic--Setsÿtheÿitalicÿtypefaceÿonÿorÿoffÿ

        l Underline--Setsÿtheÿunderlineÿtypefaceÿonÿorÿoffÿ l AlignÿLeft--Alignsÿtheÿtextÿleftÿinÿtheÿcontrolÿareaÿ l AlignÿCenter--Alignsÿtheÿtextÿcenteredÿinÿtheÿcontrolÿareaÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ141

        l AlignÿRight--Alignsÿtheÿtextÿrightÿinÿtheÿcontrolÿareaÿ l Justify--Justifiesÿtheÿtextÿinÿtheÿcontrolÿareaÿ

        l Bullets--AddsÿbulletsÿtoÿtheÿtextÿinÿtheÿRichTextÿcontrolÿareaÿ

        ÿ l DecreaseÿIndent--DecreasesÿtheÿindentÿofÿtheÿtextÿinÿtheÿRichTextÿcontrolÿareaÿ

        l IncreaseÿIndent--IncreasesÿtheÿindentÿofÿtheÿtextÿinÿtheÿRichTextÿcontrolÿareaÿ

        Toolbox

        TheÿActiveReportsÿtoolboxÿdisplaysÿaÿvarietyÿofÿcontrolsÿavailableÿforÿuseÿinÿActiveReports.ÿTheÿitemsÿ availableÿfromÿtheÿtoolboxÿchangeÿdependingÿonÿtheÿdesignerÿcurrentlyÿinÿuse.

        ToÿaccessÿtheÿActiveReportsÿtoolbox 1. OpenÿaÿVisualÿStudioÿproject.ÿ 2. AddÿanÿActiveReportÿtoÿtheÿproject.ÿ 3. ClickÿonÿView >ÿToolbox.ÿ 4. ClickÿonÿtheÿActiveReportsÿ3.0 tab.ÿ ÿ TheÿActiveReportsÿtoolboxÿisÿmadeÿupÿofÿtheÿfollowingÿcomponents:ÿ

        l Pointer--Allowsÿyouÿtoÿselectÿcontrolsÿorÿsectionsÿofÿtheÿreportÿ l Barcode--AllowsÿyouÿtoÿinsertÿanÿActiveReportsÿBarcodeÿcontrolÿ

        l ChartControl--Allowsÿyouÿtoÿinsertÿaÿchartÿinÿanyÿofÿaÿvarietyÿofÿstylesÿ l Checkbox--Allowsÿyouÿtoÿinsertÿaÿcheckbox,ÿboundÿtoÿaÿdatabaseÿfieldÿorÿunboundÿ l Label--Allowsÿyouÿtoÿinsertÿaÿnewÿstaticÿlabelÿcontrolÿ

        l Line--Allowsÿyouÿtoÿinsertÿaÿlineÿcontrolÿ l OleObject--AllowsÿyouÿtoÿinsertÿanÿOLEÿobject,ÿboundÿtoÿaÿdatabaseÿfieldÿorÿunboundÿ

        l PageBreak--Allowsÿyouÿtoÿinsertÿaÿpageÿbreakÿwithinÿaÿselectionÿ

        l Picture--Allowsÿyouÿtoÿinsertÿanÿimageÿloadedÿfromÿaÿfileÿ l New! ReportInfo--Allowsÿyouÿtoÿdisplayÿreportÿinfoÿinÿaÿnumberÿofÿformatÿstringsÿsuchÿasÿ{PageNumber}ÿ ofÿ{PageCount}ÿ l Textbox--Allowsÿyouÿtoÿinsertÿaÿtextbox,ÿboundÿtoÿaÿdatabaseÿfieldÿorÿunboundÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ142

        l Shape--Allowsÿyouÿtoÿinsertÿaÿrectangle,ÿcircleÿorÿsquareÿshapeÿÿ l Subreport--AllowsÿyouÿtoÿinsertÿaÿSubreportÿcontrolÿtoÿlinkÿtoÿanotherÿreportÿ

        l RichTextBox--AllowsÿyouÿtoÿinsertÿanÿActiveReportsÿRichTextBoxÿcontrolÿ ÿ

        ToÿaccessÿtheÿActiveReportsÿcomponents Seeÿtheÿtopicÿ"AddingÿActiveReportsÿControlsÿtoÿtheÿVisualÿStudioÿToolbox." ÿ ActiveReportsÿcomponentsÿthatÿcanÿbeÿusedÿonÿformsÿorÿwebÿformsÿinclude:

        l Designer--AllowsÿyouÿtoÿinsertÿanÿActiveReportsÿDesignerÿcontrolÿ l ReportExplorer--AllowsÿyouÿtoÿinsertÿanÿActiveReportsÿReportExplorerÿcontrolÿ

        l HtmlExport--AllowsÿyouÿtoÿaddÿHTMLÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ

        l PdfExport--AllowsÿyouÿtoÿaddÿPDFÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ l RtfExport--AllowsÿyouÿtoÿaddÿRTFÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ

        l TextExport--AllowsÿyouÿtoÿaddÿtextÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ l TiffExport--AllowsÿyouÿtoÿaddÿTIFFÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ l New!Toolbox--Allowsÿyouÿtoÿaddÿaÿtoolboxÿcontrolÿtoÿuseÿinÿcreatingÿ

        l XlsExport--AllowsÿyouÿtoÿaddÿExcelÿexportingÿcapabilityÿtoÿanÿActiveReportsÿprojectÿ

        ÿ l Viewer--AllowsÿyouÿtoÿinsertÿanÿActiveReportsÿViewerÿcontrolÿ

        l WebViewer--AllowsÿyouÿtoÿinsertÿaÿcontrolÿtoÿviewÿanÿActiveReportÿonÿtheÿwebÿ

        AddingÿFieldÿExpressions

        InÿActiveReports,ÿC#ÿexpressionsÿcanÿbeÿusedÿinÿtheÿDataFieldÿpropertyÿtoÿspecifyÿtextboxÿoutputÿinÿaÿreport,ÿ suchÿasÿdate/time,ÿmathematicalÿcalculationsÿorÿconditionalÿvalues.ÿAnyÿfieldÿexpressionÿshouldÿbeginÿwithÿ theÿequalsÿ(=)ÿsign. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ143

        UsingÿFieldÿExpressions

        Toÿuseÿaÿmathematicalÿexpression ChangeÿtheÿDataFieldÿpropertyÿforÿtheÿtextÿboxÿtoÿtheÿmathematicalÿcalculationÿdesired.ÿ Examples:ÿ=UnitPrice+5ÿ =Quantity-5 =Quantity*UnitPrice =UnitPrice/QuantityPerUnit

        Toÿuseÿaÿsubstring ChangeÿtheÿDataFieldÿpropertyÿforÿtheÿtextÿboxÿtoÿtheÿsubstringÿneeded.ÿIfÿsettingÿupÿgrouping,ÿchangeÿtheÿ GroupHeader'sÿDataFieldÿpropertyÿtoÿtheÿsameÿsubstring.ÿ Example:ÿ=ProductName.Substring(0,ÿ1)

        Toÿuseÿdate/time ChangeÿtheÿDataFieldÿpropertyÿforÿtheÿtextÿboxÿtoÿtheÿfollowing.ÿ Example:ÿ=System.DateTime.Now.ToString()

        Toÿcreateÿaÿconditionalÿvalue ChangeÿtheÿDataFieldÿpropertyÿforÿtheÿtextÿboxÿtoÿtheÿconditionalÿstatementÿdesired.ÿ Example:ÿ=(UnitsInStockÿ>ÿ0)?"InÿStock":"Backorder"

        Toÿconcatenateÿfields ChangeÿtheÿDataFieldÿpropertyÿforÿtheÿtextÿboxÿtoÿtheÿfollowing.ÿ Examples:ÿ="Thereÿareÿ"ÿ+ÿUnitsInStockÿ+ÿ"ÿunitsÿofÿ"ÿ+ÿProductNameÿ+ÿ"ÿinÿstock." =TitleOfCourtesyÿ+ÿ"ÿ"ÿ+ÿFirstNameÿ+ÿ"ÿ"ÿ+ÿLastName NOTE: ActiveReportsÿforÿ.NETÿ3.0ÿautomaticallyÿhandlesÿnullÿvalues,ÿreplacingÿthemÿwithÿanÿemptyÿ string.

        Toÿroundÿaÿcalculation ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ144

        ChangeÿtheÿDataFieldÿPropertyÿforÿtheÿtextÿboxÿtoÿtheÿfollowing.ÿ Example:ÿ=(double)System.Math.Round(UnitPrice*UnitsOnOrder,2)

        Toÿuseÿmodularÿdivision ChangeÿtheÿDataFieldÿPropertyÿforÿtheÿtextÿboxÿtoÿtheÿfollowingÿtoÿgetÿtheÿremainderÿ(2ÿinÿthisÿcase).ÿ Example:ÿ=22%(5)

        Toÿreplaceÿaÿnullÿvalue

        ChangeÿtheÿDataFieldÿPropertyÿforÿtheÿtextÿboxÿtoÿtheÿfollowingÿtoÿreplaceÿnullsÿwithÿyourÿownÿvalue.ÿÿ =(Regionÿ==ÿSystem.DBNull.Value)ÿ?ÿ"Noÿregionÿspecified"ÿ:ÿRegion

        BindingÿReportsÿtoÿaÿDataÿSource

        ActiveReportsÿallowsÿmuchÿflexibilityÿinÿbindingÿreportsÿtoÿvariousÿkindsÿofÿdataÿsources.ÿInÿthisÿsection,ÿyouÿ willÿlearnÿhowÿtoÿuseÿdifferentÿmethodsÿtoÿbindÿreportsÿtoÿdataÿsources. Note DAOÿandÿRDOÿdataÿcontrolsÿareÿnoÿlongerÿsupportedÿinÿActiveReportsÿforÿ.NET.ÿTheÿADOÿdataÿ controlÿisÿconvertedÿtoÿanÿADO.NETÿdataÿsource.ÿDataÿcontrolsÿareÿremovedÿandÿreplacedÿwithÿaÿreportÿ dataÿsourceÿdialogÿaccessibleÿfromÿtheÿdataÿsourceÿiconÿonÿtheÿDetailÿsection ofÿtheÿreport.ÿTheÿXMLÿ DataÿcontrolÿisÿconvertedÿintoÿanÿXMLÿdataÿsource. dataset Learnÿhowÿtoÿbindÿaÿreportÿtoÿaÿdataÿsourceÿusingÿaÿdataset.ÿ DataÿView Learnÿhowÿtoÿbindÿaÿreportÿtoÿaÿdataÿsourceÿusingÿaÿdataÿview.ÿ DataÿSourceÿIcon ÿ LearnÿhowÿtoÿbindÿaÿreportÿtoÿaÿdataÿsourceÿusingÿtheÿDataSourceÿicon inÿtheÿActiveReportsÿDesigner.ÿ

        UsingÿtheÿDataSourceÿIcon

        ActiveReportsÿmakesÿitÿeasyÿtoÿbindÿyourÿreportÿtoÿaÿdataÿsourceÿbyÿusingÿtheÿgrayÿDataSourceÿicon locatedÿ inÿtheÿDetailÿsection ofÿtheÿreportÿdesignÿsurfaceÿorÿbyÿaccessingÿtheÿDataSourceÿdialogÿfromÿtheÿReportÿ Settingsÿmenu.

        ToÿuseÿtheÿDataSourceÿicon 1. OpenÿaÿVisualÿStudioÿproject.ÿ 2. AddÿanÿActiveReportÿtoÿyourÿproject.ÿ 3. Onceÿtheÿreportÿisÿadded,ÿyouÿwillÿseeÿtheÿreportÿdesignÿsurface.ÿ 4. ClickÿonÿtheÿgrayÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿofÿtheÿreportÿtoÿopenÿtheÿDatasourceÿdialog.ÿ 5. Youÿwillÿthenÿbeÿpromptedÿtoÿselectÿyourÿdataÿsource,ÿconnectionÿstring,ÿandÿquery.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ145

        ÿ

        ToÿconnectÿtoÿMicrosoftÿAccessÿusingÿJetÿ4.0 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿDatasourceÿdialog.ÿ 2. SelectÿtheÿOLEÿDBÿtab.ÿ 3. ClickÿonÿBuild. 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext. 5. EnterÿaÿdatabaseÿnameÿorÿClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿaÿdatabase.ÿ 6. ClickÿOpen onceÿyouÿhaveÿenteredÿaÿdatabaseÿnameÿorÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 7. ClickÿOK toÿcontinue.ÿ 8. EnterÿaÿSQLÿstatementÿinÿtheÿQueryÿboxÿ(e.g.ÿ"Selectÿ*ÿfromÿproducts").ÿ 9. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ToÿconnectÿtoÿSQLÿServerÿ 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿDatasourceÿdialog.ÿ 2. SelectÿtheÿSQLÿtab.ÿ 3. ClickÿonÿBuild. 4. Selectÿ"MicrosoftÿOLEÿDBÿProviderÿforÿSQLÿServer"ÿandÿclickÿNext. 5. Selectÿaÿserver.ÿ 6. ChoseÿWindowsÿintegratedÿsecurityÿorÿaÿspecificÿusernameÿandÿpassword.ÿ 7. ChooseÿtheÿdatabaseÿforÿconnectionÿandÿclickÿOK.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ146

        8. EnterÿaÿSQLÿstatementÿinÿtheÿQueryÿboxÿ(e.g.ÿ"Selectÿ*ÿfromÿproducts").ÿ 9. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ToÿconnectÿtoÿanÿXMLÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿDatasourceÿdialog.ÿ 2. SelectÿtheÿXMLÿtab.ÿÿ 3. ClickÿtheÿellipsisÿbuttonÿbesideÿFileÿURL toÿbrowseÿforÿtheÿaccessÿpathÿtoÿCustomer.xml.ÿ 4. ClickÿOpen onceÿyouÿhaveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. InÿtheÿRecordsetÿPattern field,ÿenterÿaÿpatternÿ(e.g.ÿ"//ITEM").ÿ 6. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ÿ Note: TheÿDatasourceÿdialogÿcontainsÿanÿUnboundÿtab.ÿThisÿtabÿdoesÿnotÿprovideÿtheÿmechanismÿbyÿ ÿ whichÿyouÿcanÿsetÿunboundÿdata,ÿbutÿprovidesÿanÿoverviewÿonÿhowÿtoÿstartÿworkingÿwithÿunboundÿdataÿ sources.

        UsingÿaÿDataset

        Inÿadditionÿtoÿbeingÿableÿtoÿsetÿtheÿreport'sÿdataÿsourceÿwithÿtheÿDataSourceÿicon,ÿActiveReportsÿforÿ.NETÿ3.0ÿ allowsÿyouÿtoÿuseÿtheÿdatasetÿandÿotherÿ.NETÿdataÿprovidersÿdirectlyÿwithinÿtheÿActiveReportÿenvironment.ÿToÿ useÿaÿdatasetÿatÿdesignÿtime,ÿaddÿtheÿnecessaryÿdataÿcontrolsÿtoÿtheÿActiveReport,ÿsetÿtheÿreport'sÿ DataSourceÿandÿDataMemberÿproperties,ÿandÿbindÿtheÿreport'sÿcontrolsÿtoÿtheÿcorrespondingÿdataÿfieldsÿ Note: IfÿyourÿprojectÿalreadyÿcontainsÿaÿdatasetÿthatÿyouÿwantÿtoÿuseÿwithinÿtheÿActiveReportÿdesigner,ÿ dragÿtheÿDataSetÿobjectÿfromÿtheÿDataÿtabÿofÿtheÿtoolboxÿontoÿtheÿreportÿsurface.ÿThisÿwillÿopenÿtheÿ AddÿDataset dialog.ÿToÿselectÿyourÿdataset,ÿselectÿtheÿTypedÿdataset optionÿthenÿchooseÿyourÿ dataset.

        ToÿaddÿdataÿcontrolsÿtoÿtheÿActiveReport 1. WhileÿinÿanÿActiveReport,ÿclickÿtheÿDataÿtoolboxÿtab.ÿSelectÿanyÿavailableÿDataAdapterÿobjectÿandÿdragÿitÿ ontoÿtheÿreportÿsurface;ÿtheÿDataÿAdapterÿConfigurationÿWizardÿwillÿopenÿandÿyouÿwillÿseeÿaÿvisualÿ representationÿofÿtheÿDataAdapterÿobjectÿinÿtheÿActiveReportsÿcomponentÿtray.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ147

        2. ClickÿNext.ÿÿ 3. ClickÿNewÿConnection,ÿwhichÿwillÿopenÿtheÿDataÿLinkÿPropertiesÿdialog,ÿandÿselectÿtheÿ"Provider"ÿtab.ÿ 4. Selectÿtheÿappropriateÿprovider.ÿ 5. Selectÿtheÿ"Connection"ÿtabÿandÿenterÿorÿbrowseÿforÿtheÿpathÿtoÿtheÿdesiredÿdatabaseÿfileÿandÿclickÿOKÿtoÿ closeÿtheÿdialogÿandÿreturnÿtoÿtheÿConfigurationÿWizard.ÿ 6. ClickÿNextÿtwice,ÿenterÿtheÿappropriateÿSQLÿSelectÿstatementÿandÿclickÿtheÿNext buttonÿagain.ÿ 7. ClickÿFinishÿtoÿcloseÿtheÿwizard.ÿAÿconnectionÿobjectÿwillÿnowÿresideÿwithÿtheÿDataAdapterÿobjectÿinÿtheÿ ActiveReportsÿcomponentÿtray.ÿ 8. Toÿgenerateÿtheÿdataset,ÿright-clickÿtheÿDataAdapterÿobject,ÿclickÿonÿ"GenerateÿDataSet,"ÿselectÿ"Addÿthisÿ datasetÿtheÿtheÿdesigner,"ÿandÿclickÿOK.ÿ

        Toÿsetÿtheÿreport'sÿDataSourceÿandÿDataMemberÿpropertiesÿ 1. ClickÿinÿtheÿgrayÿareaÿofÿtheÿdesignÿareaÿtoÿselectÿtheÿActiveReport.ÿ 2. FromÿtheÿPropertiesÿgrid,ÿsetÿtheÿDataSourceÿpropertyÿtoÿtheÿnewlyÿgeneratedÿdatasetÿandÿtheÿ DataMemberÿtoÿtheÿDataTable.ÿ

        Afterÿsettingÿtheÿreport'sÿdataÿsource,ÿallÿboundÿfieldsÿappearÿunderÿtheÿBoundÿnode,ÿwhichÿisÿaccessedÿbyÿ expandingÿtheÿFieldsÿnodeÿinÿtheÿReportÿExplorer. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ148

        ÿ

        Toÿbindÿtheÿreport'sÿcontrolsÿtoÿtheÿcorrespondingÿdataÿfields 1. DragÿanyÿdesiredÿcontrolsÿontoÿtheÿsectionÿofÿtheÿActiveReportÿinÿwhichÿyouÿwantÿtoÿplaceÿthem.ÿ Note: YouÿcanÿquicklyÿbindÿanÿActiveReportsÿTextBoxÿcontrolÿtoÿanyÿfieldÿbyÿdirectlyÿdraggingÿtheÿ fieldÿfromÿtheÿReportÿExplorerÿontoÿtheÿActiveReportÿdesignÿsurface. 2. Writeÿcodeÿtoÿfillÿtheÿdataset.ÿInÿthisÿcase,ÿtheÿdatasetÿisÿfilledÿduringÿtheÿReportStart_Event. 'VisualÿBasic PrivateÿSubÿrptDataSet_ReportStart(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)_ HandlesÿMyBase.ReportStart Me.OleDbDataAdapter1.Fill(Me.DataSet11.Employees) EndÿSub ÿ //C# privateÿvoidÿrptDataSet_ReportStart(objectÿsender,ÿSystem.EventArgsÿe) { ÿ this.oleDbDataAdapter1.Fill(this.dataSet11.Employees); }ÿ

        UsingÿaÿDataÿView

        Inÿadditionÿtoÿusingÿaÿdataset,ÿtheÿreport'sÿdataÿsourceÿcanÿbeÿsetÿtoÿaÿdataÿview.ÿThisÿcanÿbeÿusefulÿforÿ creatingÿreportsÿcontainingÿfilteredÿinformation.ÿToÿuseÿtheÿdataÿviewÿinÿtheÿreport,ÿsetÿtheÿreport'sÿ DataSourceÿpropertyÿtoÿtheÿdataÿviewÿcreatedÿfromÿtheÿfilteredÿdataset.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ149

        Dimÿm_dbPathÿAsÿString DimÿusViewÿAsÿNewÿDataView() PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load m_dbPathÿ=ÿgetDatabasePath() Me.oleDbConnection1.ConnectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;_ ÿ DataÿSource="ÿ+ÿm_dbPathÿ+ÿ"\\Northwind.mdb;PersistÿSecurityÿInfo=False" Me.oleDbDataAdapter1.Fill(Me.dataSet11) usViewÿ=ÿme.dataSet11.Tables("employees")) usView.RowFilterÿ=ÿ"Countryÿ=ÿ'USA'" Me.dataGrid2.DataSourceÿ=ÿusView EndÿSub //C# DataViewÿusView; privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { stringÿm_dbPathÿ=ÿgetDatabasePath(); this.oleDbConnection1.ConnectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0; DataÿSource="ÿ+ÿm_dbPathÿ+ÿ"\\Northwind.mdb;PersistÿSecurityÿInfo=False"; this.oleDbDataAdapter1.Fill(this.dataSet11); usViewÿ=ÿnewÿDataView(this.dataSet11.Tables["employees"]); usView.RowFilterÿ=ÿ"Countryÿ='USA'"; ÿ this.dataGrid2.DataSourceÿ=ÿusView; }

        DeployingÿTheÿEndÿUserÿReportÿDesigner

        WhenÿdeployingÿaÿsolutionÿthatÿincludesÿtheÿEndÿUserÿReportÿDesigner,ÿyouÿmustÿincludeÿtheÿversionÿofÿtheÿ MicrosoftÿRichÿTextÿEditÿControlÿDLLÿwhichÿisÿinstalledÿwithÿActiveReportsÿinÿaÿlocationÿlikeÿthis:ÿC:\Programÿ Files\CommonÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\riched20.dll. IfÿyouÿdoÿnotÿdeployÿProductÿversionÿ4ÿ(Fileÿversionÿ5.40.11.2210)ÿorÿhigherÿofÿriched20.dllÿwithÿtheÿEndÿUserÿ ReportÿDesigner,ÿitÿmightÿloadÿaÿversionÿthatÿisÿunableÿtoÿrenderÿRTFÿtablesÿcorrectlyÿinÿeditÿmodeÿofÿtheÿ RichTextÿcontrol. ThisÿfileÿshouldÿbeÿplacedÿinÿtheÿsameÿdirectoryÿasÿtheÿActiveReportsÿassemblies.

        ToÿdeployÿthisÿDLL 1. OpenÿtheÿRegistryÿEditor.ÿ 2. ExpandÿtheÿtreeviewÿtoÿMyÿComputer\HKEY_CURRENT_USER\Software\DataÿDynamics\ActiveReportsÿ forÿ.NETÿ3.0.ÿ 3. Right-clickÿinÿtheÿpaneÿtoÿtheÿright,ÿandÿchooseÿNewÿ>ÿStringÿValue.ÿ

        4.ÿ NameÿtheÿnewÿStringÿValueÿRtfPath.ÿ 5. Double-clickÿRtfPath,ÿandÿtypeÿinÿtheÿpathÿtoÿtheÿnewerÿversionÿofÿriched20.dll.

        GroupingÿData

        InÿActiveReports,ÿaÿreportÿcanÿconsistÿofÿsingleÿorÿmultipleÿnestedÿgroups,ÿwithÿeachÿgroupÿhavingÿitsÿownÿ headerÿandÿfooterÿsections.ÿTheÿheaderÿsectionÿisÿinsertedÿandÿprintedÿimmediatelyÿbeforeÿtheÿDetailÿsection.ÿ TheÿfooterÿsectionÿisÿinsertedÿandÿprintedÿimmediatelyÿafterÿtheÿDetailÿsection.ÿUpÿtoÿ32ÿnestedÿgroupsÿareÿ allowedÿinÿaÿsingleÿreport.ÿ Note: ActiveReportsÿdoesÿnotÿorderÿrecordsÿforÿgrouping.ÿItÿassumesÿtheÿdataÿisÿalreadyÿsortedÿinÿtheÿ sameÿgroupingÿorder.ÿTheÿdataÿsourceÿneedsÿtoÿbeÿorderedÿbyÿtheÿfieldÿonÿwhichÿyouÿwantÿyourÿdataÿ groupedÿtoÿachieveÿtheÿdesiredÿresults.ÿ

        GroupingÿDataÿinÿaÿReport

        Toÿgroupÿdataÿinÿaÿreport 1. Right-clickÿinÿtheÿDetailÿsectionÿofÿtheÿreportÿdesignÿsurface,ÿselectÿInsert,ÿandÿclickÿonÿGroupÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ150

        Header/Footer.ÿ 2. Thisÿwillÿinsertÿaÿnewÿgroupÿheader/footerÿsectionÿintoÿyourÿreport.ÿ 3. InÿtheÿPropertiesÿwindowÿforÿtheÿgroupÿheader,ÿchangeÿtheÿDataFieldÿpropertyÿtoÿtheÿfieldÿonÿwhichÿyouÿ wantÿyourÿdataÿgrouped.ÿ

        4.ÿ Changeÿtheÿnameÿofÿtheÿgroupÿheaderÿtoÿreflectÿtheÿfieldÿonÿwhichÿdataÿisÿbeingÿgrouped.ÿÿForÿexample,ÿ "ghCategories"ÿwouldÿbeÿtheÿnameÿofÿtheÿgroupÿheaderÿfieldÿwithÿtheÿDataFieldÿpropertyÿofÿ"CategoryID".ÿ

        LimitationsÿinÿExportÿFormats

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿExcel,ÿTIFFÿandÿ plainÿtext.ÿForÿinformationÿonÿusingÿtheseÿexportÿfilters,ÿseeÿtheÿExportingÿOutput orÿCustomÿWebÿ Exporting walkthrough.ÿPleaseÿnoteÿtheÿfollowingÿlimitationsÿinÿuseÿforÿeachÿActiveReportsÿexportÿfilter.ÿ

        HTMLÿLegacyÿ Notÿ100%ÿWYSIWYG Doesÿnotÿsupport:ÿ

        l Lineÿcontrolÿ l Controlÿbordersÿ

        l Shapesÿ(otherÿthanÿfilledÿrectangles)ÿ l Overlappingÿcontrols.ÿ

        HTMLÿDHTML Notÿ100%ÿWYSIWYG Doesÿnotÿsupport:ÿ l Diagonalÿlineÿcontrolÿ

        l Controlÿbordersÿ l Shapesÿ(otherÿthanÿfilledÿrectangles)ÿ

        PDF WYSIWYGÿasÿlongÿasÿyouÿuseÿtheÿcorrectÿfontsÿwithÿforeignÿtext.ÿ

        l Doesÿnotÿsupportÿfullÿjustificationÿ

        Excel Notÿ100%ÿWYSIWYG Doesÿnotÿsupport:ÿ l Lineÿcontrolÿ

        l Shapesÿ(otherÿthanÿfilledÿrectangles)ÿ l Overlappingÿcontrolsÿ l Bordersÿonÿcontrolsÿwithÿangledÿtextÿ

        Tiff Imageÿofÿpage,ÿsoÿit'sÿ100%ÿWYSIWYG.ÿ

        RTF NotÿWYSIWYG Doesÿnotÿsupport:ÿ l Fullÿjustificationÿ(unlessÿyouÿsetÿtheÿEnableShapes*ÿpropertyÿtoÿTrue)ÿ

        l Lineÿcontrolÿ(unlessÿyouÿsetÿtheÿEnableShapes*ÿpropertyÿtoÿTrue)ÿ

        l SectionÿBackcolorsÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ151

        l ControlÿBackcolorsÿ(unlessÿyouÿsetÿtheÿEnableShapes*ÿpropertyÿtoÿTrue)ÿ l Shapesÿ(unlessÿyouÿsetÿtheÿEnableShapes*ÿpropertyÿtoÿTrue)ÿ

        l Overlappingÿcontrolsÿ l Controlÿbordersÿ(unlessÿyouÿsetÿtheÿEnableShapes*ÿpropertyÿtoÿTrue)ÿ

        l Angledÿtextÿ *Note: IfÿyouÿsetÿtheÿEnableShapesÿpropertyÿtoÿTrue,ÿtheÿresultingÿRTFÿfileÿdisplaysÿcorrectlyÿonlyÿinÿ WebÿLayoutÿView inÿMicrosoftÿWord.

        Text NotÿWYSIWYGÿ

        ÿ l Supportsÿplainÿtextÿonly.ÿ

        l Supportsÿencodingÿforÿforeignÿlanguageÿsupport.ÿ

        LocalizingÿtheÿViewerÿControl

        InÿActiveReports,ÿyouÿcanÿlocalizeÿsettingsÿforÿtheÿWindowsÿFormsÿViewerÿcontrolÿbyÿmodifyingÿaÿprovidedÿ "strings"ÿtextÿfile,ÿgeneratingÿaÿresourcesÿfile,ÿembeddingÿtheÿresourcesÿfileÿinÿyourÿActiveReportsÿprojectÿandÿ addingÿtheÿlocalizationÿcodeÿneededÿinÿyourÿForm_Loadÿevent.

        Makingÿlocalizationÿchangesÿtoÿtheÿstringsÿtextÿfile

        Toÿmakeÿchangesÿtoÿtheÿtextÿfile 1. Clickÿhereÿ(Script\Strings.txt) toÿopenÿtheÿtextÿfileÿinÿyourÿbrowser.ÿ 2. Right-clickÿonÿtheÿtextÿandÿselectÿ"ViewÿSource."ÿ 3. ThisÿwillÿopenÿtheÿfileÿinÿNotepad.ÿMakeÿchangesÿtoÿlocalizeÿsettingsÿforÿtheÿviewerÿcontrol.ÿ 4. ClickÿonÿSaveÿAs.,ÿrenameÿyourÿtextÿfileÿ"localization.txt"ÿandÿsaveÿitÿtoÿtheÿlocationÿofÿyourÿchoice.ÿ

        Generatingÿtheÿresourcesÿfileÿfromÿtheÿtextÿfile

        Toÿgenerateÿtheÿresourcesÿfile 1. FromÿtheÿStartÿbar,ÿclickÿonÿAllÿProgramsÿ>ÿMicrosoftÿVisualÿStudio.NETÿ>ÿVisualÿStudioÿ.NETÿToolsÿ>ÿ VisualÿStudioÿ.NETÿCommandÿPrompt.ÿ 2. Changeÿtheÿpromptÿpathÿtoÿreflectÿtheÿlocationÿofÿyourÿlocalization.txtÿfile.ÿ 3. Typeÿ"resgenÿlocalization.txtÿlocalization.resources."ÿ 4. Thisÿcreatesÿaÿresourcesÿfileÿinÿtheÿsameÿlocationÿasÿtheÿtextÿfile.ÿ

        AddingÿtheÿresourcesÿfileÿtoÿyourÿWindowsÿapplication

        Toÿaddÿtheÿresourcesÿfile 1. OpenÿyourÿActiveReportsÿWindowsÿapplicationÿwhichÿincludesÿanÿActiveReportsÿWindowsÿFormsÿViewerÿ control.ÿ 2. InÿtheÿSolutionÿExplorerÿwindow,ÿclickÿonÿtheÿiconÿtoÿ"ShowÿAllÿFiles."ÿ 3. Right-clickÿonÿtheÿnameÿofÿyourÿprojectÿandÿclickÿAdd >ÿAddÿExistingÿItem. 4. Selectÿtheÿappropriateÿfileÿpathÿtoÿtheÿlocalization.resourcesÿfileÿandÿclickÿOpen.ÿ 5. Thisÿaddsÿtheÿresourcesÿfileÿtoÿyourÿapplication.ÿ

        AddingÿcodeÿtoÿtheÿForm1_Loadÿevent

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿVisualÿBasic l Right-clickÿonÿForm1,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿform.ÿAtÿtheÿtopÿleftÿofÿtheÿ codeÿviewÿforÿForm1,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ(BaseÿClassÿEvents) .ÿAtÿtheÿtopÿrightÿofÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ152

        codeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿLoad.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ Form1_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿC#

        l ClickÿonÿtheÿblueÿsectionÿatÿtheÿtopÿofÿForm1ÿtoÿselectÿtheÿform.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿForm1.ÿDouble-clickÿLoad.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿresÿAsÿNewÿResourceManager("YourProjectName.localization",ÿMe.GetType()ÿ_ ÿ .Assembly) Me.Viewer1.Localizeÿ=ÿres DimÿrptÿAsÿNewÿrptLocalize() Viewer1.Documentÿ=ÿrpt.Document rpt.Run(True) EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { ResourceManagerÿresÿ=ÿnewÿResourceManager("YourProjectName.localization",ÿ this.GetType().Assembly); this.viewer1.Localizeÿ=ÿres; rptLocalizeÿrptÿ=ÿnewÿrptLocalize(); viewer1.Documentÿ=ÿrpt.Document; ÿ rpt.Run(true); }

        UsingÿMetricÿUnits

        InÿActiveReports,ÿrulerÿmeasurementsÿcanÿbeÿchangedÿfromÿinchesÿtoÿcentimetersÿandÿcentimetersÿtoÿinchesÿ fromÿdesignÿtime.ÿConversionÿvaluesÿforÿcentimetersÿtoÿinchesÿorÿinchesÿtoÿcentimetersÿcanÿbeÿcalledÿatÿrunÿ timeÿasÿwell.ÿ

        Toÿchangeÿrulerÿmeasurementsÿatÿdesignÿtime 1. InÿanÿexistingÿActiveReportsÿproject,ÿclickÿonÿReport> Settings. 2. InÿtheÿReportÿSettings dialog,ÿclickÿonÿGlobalÿSettings.ÿ 3. ChangeÿRulerÿUnitsÿfromÿinchesÿtoÿcentimetersÿorÿcentimetersÿtoÿinches.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ153

        Toÿcallÿaÿmeasurementÿconversionÿatÿrunÿtime

        l CallÿtheÿCmToInchÿmethodÿorÿInchToCmÿmethodÿwheneverÿneeded.ÿForÿexample,ÿifÿyouÿwereÿworkingÿinÿ centimetersÿandÿneededÿtoÿconvertÿaÿlabel'sÿpositionÿmeasurementsÿfromÿcentimetersÿtoÿinchesÿatÿrunÿ time,ÿyouÿwouldÿuseÿtheÿfollowingÿcode.ÿ ÿ 'VisualÿBasic Me.lblMyLabel.Leftÿ=ÿActiveReport.CmToInch(2) Me.lblMyLabel.Topÿ=ÿActiveReport.CmToInch(2) //C# ÿ this.lblMyLabel.Leftÿ=ÿActiveReport.CmToInch(2); this.lblMyLabel.Topÿ=ÿActiveReport.CmToInch(2);

        OptimizingÿActiveReports

        Optimizationÿcanÿbeÿcrucialÿforÿveryÿlargeÿreportsÿ(i.e.ÿwellÿoverÿ100ÿpages).ÿHereÿisÿsomeÿinformationÿwhichÿ willÿhelpÿyouÿtoÿachieveÿtheÿbestÿpossibleÿresultsÿforÿsuchÿreports.ÿToÿoptimizeÿActiveReportsÿforÿtheÿweb,ÿ pleaseÿreferÿtoÿtheÿmemoryÿconsiderationsÿsection.

        MemoryÿConsiderations l ImagesÿLimitÿtheÿuseÿofÿlargeÿimagesÿwhenÿexportingÿtoÿRTFÿandÿTIFFÿformats.ÿNoteÿthatÿevenÿoneÿ imageÿusesÿaÿlotÿofÿmemoryÿifÿit'sÿrepeatedÿonÿeveryÿpageÿofÿaÿveryÿlongÿreportÿexportedÿtoÿTIFFÿorÿRTF.ÿ Ifÿyouÿareÿnotÿexporting,ÿorÿifÿyouÿareÿexportingÿtoÿExcel,ÿPDF,ÿorÿHTML,ÿrepeatedÿimagesÿareÿstoredÿonlyÿ onceÿtoÿsaveÿmemory,ÿbutÿtheÿcomparisonÿnecessaryÿtoÿdetectÿduplicateÿimagesÿslowsÿtheÿprocessingÿ timeÿforÿtheÿreport.ÿ

        l Subreports Limitÿtheÿuseÿofÿsubreportsÿinÿrepeatingÿsectionsÿbecauseÿeachÿsubreportÿinstanceÿconsumesÿ memory.ÿForÿexample,ÿconsiderÿthatÿaÿsubreportÿinÿtheÿDetailÿsectionÿofÿaÿreportÿinÿwhichÿtheÿDetailÿ sectionÿisÿrepeatedÿ2,000ÿtimesÿwillÿhaveÿ2,000ÿinstancesÿofÿtheÿsubreport.ÿNestedÿsubreportsÿwillÿ compoundÿtheÿnumberÿofÿinstances.ÿIfÿyouÿneedÿtoÿuseÿsubreportsÿinÿrepeatingÿsections,ÿinstantiateÿthemÿ inÿtheÿReportStartÿeventÿinsteadÿofÿtheÿFormatÿeventÿofÿtheÿrepeatingÿsectionÿsoÿthatÿtheyÿwillÿbeÿ instantiatedÿonlyÿonceÿandÿuseÿlessÿmemory.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ154

        l CacheToDisk SetÿtheÿCacheToDiskÿpropertyÿofÿtheÿDocumentÿobjectÿtoÿTrue.ÿAlthoughÿitÿwillÿslowÿdownÿ theÿprocessingÿtime,ÿthisÿwillÿcauseÿtheÿdocumentÿtoÿbeÿcachedÿtoÿdiskÿinsteadÿofÿloadingÿtheÿwholeÿreportÿ inÿmemory.ÿTheÿPDFÿexportÿwillÿalsoÿdetectÿthisÿsettingÿandÿuseÿtheÿcachedÿreportÿtoÿexport.ÿPleaseÿnoteÿ thatÿonlyÿtheÿPDFÿexportÿisÿaffectedÿbyÿtheÿCacheToDiskÿProperty;ÿotherÿexportsÿmayÿrunÿoutÿofÿmemoryÿ withÿveryÿlargeÿreports.ÿAlsoÿnoteÿthatÿCacheToDiskÿusesÿIsolatedStorageÿtoÿstoreÿaÿpage’sÿcanvasItemsÿ toÿdisk.ÿToÿuseÿCacheToDiskÿyouÿmustÿhaveÿIsolatedStorageFilePermission.ÿ l Summaries Placingÿsummariesÿ(primarilyÿpageÿcountÿandÿreportÿtotals)ÿinÿheaderÿsectionsÿwillÿhaveÿanÿ adverseÿeffectÿonÿmemoryÿasÿwellÿasÿrenderingÿspeedÿwithÿlargeÿreportsÿusingÿtheÿCacheToDiskÿproperty.ÿ SinceÿtheÿrenderingÿofÿtheÿheaderÿisÿdelayedÿuntilÿActiveReportsÿdeterminesÿtheÿtotalÿorÿpageÿcountÿofÿtheÿ followingÿsections,ÿCacheToDiskÿisÿunableÿtoÿperformÿanyÿoptimization.ÿTheÿgreaterÿtheÿnumberÿofÿ affectedÿsections,ÿtheÿlongerÿrenderingÿisÿdelayedÿandÿtheÿlessÿoptimizationÿCacheToDiskÿwillÿoffer.ÿ Therefore,ÿaÿgroupÿtotalÿinÿaÿgroupÿheaderÿsectionÿdoesÿnotÿaffectÿperformanceÿandÿmemoryÿasÿmuchÿasÿaÿ reportÿtotalÿinÿtheÿreportÿheader.ÿ

        SpeedÿConsiderations

        l ImagesÿAnÿimageÿrepeatedÿonÿeveryÿpageÿofÿaÿveryÿlongÿreportÿisÿstoredÿonlyÿonceÿtoÿimproveÿmemory,ÿ butÿtheÿcomparisonÿnecessaryÿtoÿdetectÿduplicateÿimagesÿslowsÿperformance.ÿThisÿisÿnotÿonlyÿtheÿcaseÿ withÿtheÿreportÿdocumentÿitself,ÿbutÿalsoÿwithÿtheÿExcel,ÿPDF,ÿandÿHTMLÿexportsÿasÿtheyÿperformÿtheirÿ ownÿcomparisons.ÿ

        l Summaries Placingÿsummariesÿ(primarilyÿpageÿcountÿandÿreportÿtotals)ÿinÿheaderÿsectionsÿwillÿslowÿ reportÿprocessing.ÿActiveReportsÿmustÿdetermineÿtheÿtotalÿorÿpageÿcountÿofÿtheÿfollowingÿsectionsÿbeforeÿ itÿcanÿrenderÿtheÿheaderÿsection.ÿTheÿgreaterÿtheÿnumberÿofÿaffectedÿsections,ÿtheÿlongerÿrenderingÿisÿ delayed.ÿTherefore,ÿaÿgroupÿtotalÿinÿaÿgroupÿheaderÿsectionÿdoesÿnotÿaffectÿperformanceÿandÿmemoryÿasÿ muchÿasÿaÿreportÿtotalÿinÿtheÿreportÿheader.ÿ

        l CacheToDisk BeÿsureÿthatÿtheÿCacheToDiskÿpropertyÿofÿtheÿDocumentÿobjectÿisÿnotÿsetÿtoÿTrue.ÿSettingÿ itÿtoÿTrueÿincreasesÿtheÿamountÿofÿtimeÿtheÿreportÿtakesÿtoÿload,ÿandÿshouldÿonlyÿbeÿusedÿwithÿveryÿlargeÿ reportsÿthatÿuseÿaÿlotÿofÿmemory.ÿIfÿthisÿisÿusedÿwithÿsmallerÿreportsÿofÿlessÿthanÿ100ÿpages,ÿitÿmayÿ actuallyÿcauseÿmoreÿmemoryÿtoÿbeÿused.ÿÿ l StoredÿProcedures UsingÿstoredÿproceduresÿinsteadÿofÿSELECTÿstatementsÿspeedsÿupÿtheÿprocessingÿ timeÿofÿaÿreport,ÿasÿitÿreducesÿtheÿnumberÿofÿrecordsÿhandledÿbyÿActiveReports.ÿUsingÿSELECTÿ*ÿ statementsÿisÿnotÿrecommendedÿunlessÿyouÿareÿactuallyÿusingÿallÿofÿtheÿdataÿreturnedÿbyÿsuchÿaÿ ÿ statement.ÿConsultÿyourÿdatabaseÿadministratorÿforÿotherÿwaysÿtoÿspeedÿupÿdataÿretrieval,ÿsuchÿasÿ indexingÿtables.

        ViewingÿReports

        ActiveReportsÿforÿ.NETÿ3.0ÿprovidesÿtwoÿwaysÿforÿyouÿtoÿpreviewÿreportÿoutput.ÿOneÿwayÿtoÿ previewÿyourÿreportÿisÿbyÿaddingÿtheÿActiveReportsÿWinformsÿviewerÿcontrol.ÿThisÿrequiresÿyouÿtoÿrunÿ yourÿproject.ÿAÿsecondÿwayÿisÿtoÿpreviewÿtheÿreportÿviaÿtheÿdesigner'sÿpreviewÿtab. UsingÿtheÿActiveReportsÿWinFormÿviewer LearnÿhowÿtoÿpreviewÿreportsÿwithÿtheÿWinFormÿviewer.ÿ

        ÿ UsingÿtheÿDesigner'sÿPreviewÿtab Learnÿhowÿtoÿpreviewÿreportsÿatÿdesignÿtimeÿwithÿtheÿdesigner'sÿpreviewÿtab.ÿ

        UsingÿtheÿActiveReportsÿWinFormÿViewer

        ÿ ToÿuseÿtheÿActiveReportsÿWinFormÿViewerÿtoÿpreviewÿreportÿoutput 1. AddÿanÿActiveReportÿtoÿyourÿVisualÿStudioÿprojectÿandÿrenameÿitÿrptMain.ÿ 2. Addÿaÿnewÿ"WindowsÿForm"ÿtoÿyourÿproject.ÿ 3. ClickÿonÿtheÿActiveReportsÿviewerÿcontrolÿinÿtheÿappropriateÿtoolboxÿandÿdragÿitÿontoÿyourÿWindowsÿform.ÿ 4. Setÿtheÿviewerÿcontrol'sÿDockÿpropertyÿtoÿFill.ÿ

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿVisualÿBasic ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ155

        l Double-clickÿtheÿtitleÿbarÿofÿtheÿWindowsÿFormÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm_Loadÿ event.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrun

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿC#

        l Double-clickÿtheÿtitleÿbarÿofÿtheÿWindowsÿFormÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm_Loadÿ event.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrunÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ MyBase.Load DimÿrptÿAsÿNewÿrptMain() Viewer1.Documentÿ=ÿrpt.Document rpt.Run() EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptMainÿrptÿ=ÿnewÿrptMain(); this.viewer1.Documentÿ=ÿrpt.Document; rpt.Run(); }

        ÿ Note: YouÿneedÿtoÿincludeÿreferencesÿtoÿtheÿRtfExportÿandÿTextExportÿdllsÿinÿorderÿtoÿenableÿtheÿ viewer'sÿcopyÿbutton

        PreviewingÿReportsÿatÿDesignÿTime

        ActiveReportsÿforÿ.NETÿmakesÿitÿeasyÿforÿyouÿtoÿpreviewÿyourÿreportÿwhileÿyouÿareÿstillÿcreatingÿit.ÿToÿgetÿaÿ previewÿofÿyourÿreport,ÿclickÿonÿtheÿPreviewÿtabÿatÿtheÿbottomÿofÿtheÿActiveReportÿdesigner.ÿInÿthisÿwayÿyouÿ canÿseeÿandÿworkÿwithÿtheÿreportÿwithoutÿneedingÿtoÿrunÿyourÿprojectÿforÿvisualÿfeedbackÿeachÿtimeÿyouÿmakeÿ changes.ÿ

        ÿ

        ÿ

        SavingÿandÿLoadingÿRDFÿFiles

        ActiveReportsÿallowsÿreportsÿtoÿbeÿsavedÿintoÿtheirÿownÿstandardÿformatÿcalledÿanÿRDFÿfileÿ(ReportÿDocumentÿ Format).ÿOnceÿaÿreportÿhasÿbeenÿsavedÿtoÿanÿRDFÿfile,ÿitÿcanÿbeÿloadedÿintoÿtheÿviewerÿcontrolÿandÿusedÿtoÿ displayÿreportsÿinÿcustomÿpreviewÿapplications.ÿÿ

        ToÿwriteÿtheÿcodeÿtoÿsaveÿaÿreportÿasÿanÿRDFÿfileÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿWindowsÿForm,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿcodeÿtoÿcreateÿtheÿsaveRDFÿevent.ÿ

        ToÿwriteÿtheÿcodeÿtoÿsaveÿaÿreportÿasÿanÿRDFÿfileÿinÿC#

        l Double-clickÿonÿtheÿWindowsÿFormÿtoÿseeÿtheÿcodeÿviewÿforÿtheÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿ createÿtheÿsaveRDFÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic DimÿrptÿAsÿNewÿActiveReport1() ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ156

        PrivateÿSubÿsaveRDF() rpt.Run() rpt.Document.Save(Application.StartupPathÿ+ÿ"\\NewRDF.RDF" EndÿSub //C# privateÿvoidÿsaveRDF() { ActiveReport1ÿrptÿ=ÿnewÿActiveReport1(); rpt.Run(); rpt.Document.Save(Application.StartupPathÿ+ÿ"\\NewRDF.RDF"; } ÿ

        ToÿwriteÿtheÿcodeÿtoÿloadÿtheÿsavedÿRDFÿintoÿtheÿActiveReportsÿviewerÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿWindowsÿForm,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿcodeÿtoÿcreateÿtheÿloadRDFÿevent.ÿ

        ToÿwriteÿtheÿcodeÿtoÿloadÿtheÿsavedÿRDFÿintoÿtheÿActiveReportsÿviewerÿinÿC#

        l Double-clickÿonÿtheÿWindowsÿFormÿtoÿseeÿtheÿcodeÿviewÿforÿtheÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿ createÿtheÿloadRDFÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿloadRDF() rpt.Run() Viewer1.Document.Load(Application.StartupPathÿ+ÿ"\\NewRDF.RDF" EndÿSub //C# privateÿvoidÿloadRDF() { ActiveReport1ÿrptÿ=ÿnewÿActiveReport1(); rpt.Run(); ÿ viewer1.Document.Load(Application.StartupPathÿ+ÿ"\\NewRDF.RDF"); }

        SavingÿandÿLoadingÿRPXÿFiles

        AlthoughÿActiveReportsÿforÿ.NETÿ3.0ÿwritesÿreportÿlayoutsÿinÿC#ÿorÿVB.NET,ÿdependingÿonÿtheÿ.NETÿ environmentÿinÿwhichÿtheÿreportÿisÿcreated,ÿyouÿcanÿchooseÿtoÿsaveÿyourÿtheÿlayoutÿofÿyourÿreportÿasÿanÿRPXÿ (reportÿXML)ÿfileÿforÿportabilityÿandÿediting.ÿIfÿyouÿmakeÿchangesÿtoÿtheÿRPXÿandÿbringÿtheÿreportÿbackÿintoÿ theÿVisualÿStudioÿIDE,ÿActiveReportsÿwillÿreflectÿtheÿchangesÿinÿC#ÿorÿVB.NET. Note: WhenÿanÿRPX-basedÿlayoutÿisÿloadedÿintoÿaÿprojectÿitÿwillÿsupersedeÿtheÿcurrentlyÿactiveÿreport.ÿ Thus,ÿinÿorderÿtoÿavoidÿreplacingÿanyÿimportantÿlayoutsÿinÿtheÿcurrentÿproject,ÿaÿnewÿblankÿActiveReportÿ mustÿbeÿcreatedÿbefore loadingÿtheÿfile.ÿAfterÿyouÿhaveÿcreatedÿtheÿnewÿActiveReport,ÿloadÿtheÿRPXÿfileÿ intoÿit.ÿ

        ToÿsaveÿaÿcurrentÿreportÿasÿanÿRPXÿfile 1. WhileÿinÿanÿActiveReport,ÿfromÿtheÿReportÿmenu,ÿselect SaveÿLayout.

        2. Nameÿtheÿfileÿappropriatelyÿandÿselectÿtheÿlocationÿinÿwhichÿtoÿsaveÿit. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ157

        3. Selectÿtheÿtypeÿofÿlayoutÿyouÿwishÿtoÿsave.ÿYouÿcanÿchooseÿtheÿoldÿArnetÿFormat forÿbackwardÿ compatibility,ÿorÿtheÿnewÿArnet3ÿFormat whichÿsavesÿcomponentÿtrayÿitems.ÿNoteÿthatÿdatasetsÿareÿnotÿ ableÿtoÿbeÿsavedÿinÿtheÿcomponentÿtray,ÿbutÿcanÿbeÿeasilyÿregeneratedÿfromÿtheÿdataÿadapter,ÿwhichÿisÿ saved.ÿ 4. ClickÿSaveÿtoÿsaveÿtheÿselectedÿreportÿlayout.ÿ

        ToÿloadÿanÿexistingÿRPXÿfile 1. WhileÿinÿanÿActiveReport,ÿclick Reportÿ> LoadÿLayout.ÿ 2. SelectÿtheÿRPXÿfileÿfromÿtheÿappropriateÿlocation.ÿ 3. ClickÿOpenÿtoÿloadÿtheÿselectedÿreportÿlayout.ÿ

        ToÿwriteÿtheÿcodeÿtoÿsaveÿaÿreportÿasÿanÿRPXÿfileÿinÿVisualÿBasic l Right-clickÿonÿtheÿWindowsÿFormÿandÿselectÿViewÿCode fromÿtheÿshortcutÿmenuÿtoÿseeÿtheÿcodeÿviewÿforÿ theÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿcreateÿtheÿsaveRPXÿevent.ÿ

        ToÿwriteÿtheÿcodeÿtoÿsaveÿaÿreportÿasÿanÿRPXÿfileÿinÿC#

        l Right-clickÿonÿtheÿWindowsÿFormÿandÿselectÿViewÿCode fromÿtheÿshortcutÿmenuÿtoÿseeÿtheÿcodeÿviewÿforÿ theÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿcreateÿtheÿsaveRPXÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ158

        'VisualÿBasic DimÿrptÿAsÿNewÿActiveReport1() PrivateÿSubÿSaveRPX() rpt.Run() rpt.SaveLayout("C:\NewRPX.RPX",ÿDataDynamics.ActiveReports.ActiveReport3.RpxFormat.Arnet3) EndÿSub //C# privateÿvoidÿSaveRPX() { NewActiveReport1ÿrptÿ=ÿnewÿActiveReport1(); rpt.Run(); rpt.SaveLayout(@"C:\NewRPX.RPX",ÿDataDynamics.ActiveReports.ActiveReport3.RpxFormat.Arnet3); } Note: TheÿSaveLayoutÿmethodÿusesÿutf-16ÿencodingÿwhenÿyouÿsaveÿtoÿaÿstream,ÿandÿutf-8ÿencodingÿ whenÿyouÿsaveÿtoÿaÿfile.

        ToÿwriteÿtheÿcodeÿtoÿloadÿtheÿsavedÿRPXÿintoÿtheÿActiveReportsÿviewerÿinÿVisualÿBasic l Double-clickÿonÿtheÿWindowsÿFormÿtoÿseeÿtheÿcodeÿviewÿforÿtheÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿ createÿtheÿloadRPXÿevent.ÿ

        ToÿwriteÿtheÿcodeÿtoÿloadÿtheÿsavedÿRPXÿintoÿtheÿActiveReportsÿviewerÿinÿC#

        l Double-clickÿonÿtheÿWindowsÿFormÿtoÿseeÿtheÿcodeÿviewÿforÿtheÿWindowsÿform.ÿAddÿtheÿfollowingÿcodeÿtoÿ createÿtheÿloadRPXÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic DimÿrptÿAsÿNewÿActiveReport1() PrivateÿSubÿLoadRPX() rpt.LoadLayout("C:\NewRPX.RPX") Viewer1.Documentÿ=ÿrpt.Document rpt.Run() EndÿSub //C# privateÿvoidÿloadRPX() { NewActiveReport1ÿrptÿ=ÿnewÿActiveReport1(); rpt.LoadLayout(@"C:\NewRPX.rpx"); viewer1.Documentÿ=ÿrpt.Document; rpt.Run(); } Note:ÿWhenÿsavingÿtoÿanÿRPXÿfile,ÿbeÿsureÿtoÿsaveÿtheÿreportÿbeforeÿitÿruns.ÿSavingÿtheÿlayoutÿafterÿtheÿ reportÿrunsÿwillÿcauseÿanyÿdynamicÿchangesÿmadeÿtoÿpropertiesÿorÿsectionsÿtoÿbeÿsavedÿinÿtheÿlayout.ÿ WhenÿcallingÿSaveLayoutÿinsideÿtheÿreport'sÿcode,ÿuseÿtheÿReportStartÿevent.ÿAlsoÿnoteÿthatÿwhenÿ savingÿaÿreportÿlayout,ÿonlyÿtheÿcodeÿinÿtheÿscriptÿeditorÿwillÿbeÿsavedÿtoÿtheÿfile.ÿAnyÿcodeÿbehindÿtheÿ reportÿinÿtheÿ.csÿorÿ.vbÿfileÿwillÿnotÿbeÿsavedÿtoÿtheÿRPXÿfile.

        NotesÿAboutÿDatasetsÿandÿComponentÿTrays WhenÿsavingÿaÿlayoutÿwhichÿcontainsÿaÿdatasetÿtoÿtheÿArnet3ÿFormat,ÿtheÿdataÿadapterÿandÿdataÿ connectionÿareÿsavedÿinÿtheÿcomponentÿtray,ÿbutÿtheÿdatasetÿitselfÿisÿlost.ÿWhenÿtheÿsavedÿlayoutÿisÿloadedÿ intoÿanotherÿreport,ÿyouÿmustÿgenerateÿtheÿdatasetÿagain,ÿasÿthereÿisÿnoÿconvenientÿwayÿtoÿreconnectÿtheÿoldÿ dataset. IfÿyouÿloadÿanÿArnet3ÿFormatÿRPXÿfileÿwithÿitemsÿinÿtheÿcomponentÿtrayÿintoÿaÿreport,ÿandÿsubsequentlyÿloadÿ anÿArnetÿFormat RPXÿfileÿintoÿtheÿsameÿreport,ÿtheÿcomponentÿtrayÿremainsÿonÿtheÿreport.ÿSinceÿthereÿwasÿ noÿcomponentÿtrayÿinÿtheÿoldÿformat,ÿloadingÿanÿoldÿformatÿlayoutÿfileÿignoresÿanyÿexistingÿcomponentÿtrayÿonÿÿ theÿreport.

        UsingÿCharts

        TheÿnewÿChartÿcontrolÿinÿActiveReportsÿallowsÿyouÿtoÿdisplayÿdataÿwithÿevenÿgreaterÿvisualÿimpact. Adding,ÿMovingÿorÿDeletingÿaÿChart ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ159

        Learnÿhowÿtoÿadd,ÿmove,ÿorÿdeleteÿaÿchart.ÿ CreatingÿaÿSimpleÿBarÿChartÿ Learnÿhowÿtoÿcreateÿaÿsimpleÿbarÿchart.ÿ SavingÿandÿLoadingÿChartsÿ ÿ LearnÿhowÿtoÿsaveÿchartsÿtoÿXMLÿfilesÿandÿloadÿchartsÿfromÿXMLÿfiles.ÿ

        Adding,ÿMovingÿorÿDeletingÿaÿChart

        ToÿaddÿaÿChartÿcontrolÿtoÿanÿActiveReport 1. SelectÿtheÿChartControlÿfromÿtheÿActiveReportsÿtoolbox.ÿ 2. Drawÿtheÿchartÿontoÿtheÿreportÿdesignÿsurface.ÿ

        Toÿmoveÿtheÿchart 1. Clickÿtheÿchartÿonÿtheÿreport.ÿ 2. Dragÿitÿtoÿtheÿnewÿlocation.ÿ

        Toÿdeleteÿtheÿchart

        1.ÿ Clickÿtheÿchartÿtoÿselectÿit.ÿ 2. Right-clickÿandÿchooseÿDelete fromÿtheÿshortcutÿmenu.ÿ

        CreatingÿaÿSimpleÿBarÿChart

        InÿActiveReports,ÿyouÿcanÿcreateÿaÿsimpleÿbarÿchartÿbyÿplacingÿaÿchartÿcontrolÿonÿtheÿreportÿandÿaddingÿsomeÿ dataÿpoints.

        Placingÿaÿchartÿcontrolÿonÿtheÿreport

        Toÿplaceÿaÿchartÿcontrolÿonÿtheÿreport 1. Resizeÿtheÿsectionÿinÿwhichÿyouÿwantÿtoÿplaceÿtheÿchart.ÿ 2. SelectÿtheÿChartControlÿfromÿtheÿActiveReportsÿtoolboxÿandÿdrawÿitÿontoÿtheÿreport.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ160

        Addingÿdataÿpointsÿtoÿtheÿchart

        Toÿaddÿdataÿpointsÿtoÿtheÿchart 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿCustomize verbÿbelowÿtheÿPropertiesÿpanelÿtoÿopenÿ theÿChartÿDesigner dialog.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ161

        ÿ 2. ClickÿtheÿSeries buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner.ÿ

        ÿ 3. WithÿSeries1ÿselected,ÿclickÿtheÿPoints tabÿonÿtheÿrightÿsideÿofÿtheÿChartÿDesigner.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ162

        ÿ 4. AddÿpointsÿtoÿtheÿseriesÿbyÿclickingÿtheÿAddÿnewÿitemÿicon.ÿ

        ÿ 5. Forÿeachÿpointÿthatÿyouÿadd,ÿsupplyÿanÿXValueÿandÿYValueÿinÿtheÿPointÿPropertiesÿbox.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ163

        ÿ 6. DeleteÿSeries2ÿandÿSeries3,ÿleavingÿonlyÿtheÿfirstÿone.ÿ

        ÿ ÿ 7. ClickÿtheÿFinish buttonÿtoÿseeÿtheseÿvaluesÿreflectedÿinÿaÿsimpleÿbarÿchart.

        SavingÿandÿLoadingÿCharts ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ164

        AfterÿyouÿhaveÿaddedÿaÿchartÿcontrolÿtoÿyourÿActiveReport,ÿyouÿcanÿsaveÿtheÿchartÿtoÿanÿXMLÿfileÿasÿwellÿasÿ loadÿanÿexistingÿXML-basedÿchartÿintoÿyourÿproject.ÿAÿchartÿcanÿbeÿsavedÿtoÿorÿloadedÿfromÿanÿXMLÿfileÿatÿ designÿtimeÿusingÿtheÿ"Load"ÿandÿ"SaveÿAs"ÿverbsÿbelowÿtheÿPropertiesÿwindow.

        Note: WhenÿanÿXML-basedÿchartÿlayoutÿisÿloadedÿintoÿaÿprojectÿitÿwillÿsupersedeÿtheÿchartÿlayoutÿinÿtheÿ currentlyÿactiveÿreport.ÿThus,ÿinÿorderÿtoÿavoidÿreplacingÿanyÿimportantÿlayoutsÿinÿtheÿcurrentÿproject,ÿaÿ newÿblankÿActiveReportÿmustÿbeÿcreatedÿbefore loadingÿtheÿfile.ÿAfterÿyouÿhaveÿcreatedÿtheÿnewÿ ActiveReport,ÿloadÿtheÿXMLÿfileÿintoÿit.ÿ Theÿfollowingÿcodeÿdemonstratesÿhowÿyouÿcanÿdoÿthisÿprogrammatically. 'VB PrivateÿSubÿReportHeader_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿReportHeader.Format Me.ChartControl2.Save(Application.StartupPathÿ&ÿ"\savedChart.xml") EndÿSub

        PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.ChartControl1.Load(Application.StartupPathÿ&ÿ"\Bezier.xml") EndÿSub ÿ //C# privateÿvoidÿReportHeader_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.ChartControl2.Save(System.Windows.Forms.Application.StartupPathÿ+ÿ "\\savedChart.xml"); privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.ChartControl1.Load(System.Windows.Forms.Application.StartupPathÿ+ÿ "\\Bezier.xml"); }ÿ } ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ165

        UsingÿAnnotations

        TheÿWinFormsÿviewerÿcontrolÿnowÿprovidesÿforÿtheÿplacementÿofÿannotationsÿonÿtheÿviewer'sÿreportÿviewÿviaÿ theÿAnnotationsÿbuttonÿonÿtheÿviewerÿcontrol'sÿtoolbar.ÿThisÿmakesÿitÿpossibleÿtoÿaddÿnotes,ÿspecialÿ instructions,ÿetc.,ÿdirectlyÿonÿtheÿActiveReportÿitself,ÿmakingÿteamÿcollaboration,ÿfeedback,ÿandÿend-userÿ supportÿanÿeasierÿtask.ÿDesign -timeÿannotationsÿliveÿoffÿofÿtheÿPageÿobjectÿinÿwhichÿtheyÿareÿplaced,ÿthereforeÿ theyÿareÿdestroyedÿwhenÿtheÿreportÿcloses.ÿInÿorderÿtoÿsaveÿannotationsÿyouÿmustÿaddÿthemÿviaÿcode.ÿOnceÿ addedÿinÿcode,ÿyouÿcanÿsaveÿyourÿreportÿasÿanÿRDFÿwithÿyourÿannotationsÿintact.ÿ TheÿfollowingÿshowsÿseveralÿtypesÿofÿActiveReports'ÿannotationsÿandÿhowÿtheyÿcanÿbeÿusedÿtoÿconveyÿspecialÿ instructions.ÿ

        ÿ

        AddingÿAnnotationsÿtoÿyourÿActiveReport ActiveReportsÿforÿ.NETÿ3.0ÿmakesÿitÿeasyÿtoÿaddÿannotationsÿtoÿyourÿprojects.ÿYouÿcanÿdoÿsoÿatÿdesignÿtimeÿ viaÿtheÿreport'sÿtoolbarÿorÿatÿrunÿtimeÿthroughÿtheÿAnnotationsÿcollection.

        Toÿaddÿannotationsÿatÿdesignÿtime 1. ClickÿtheÿAnnotationsÿbuttonÿonÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿtoolbar.ÿ

        ÿ 2. Selectÿtheÿtypeÿofÿannotationÿyouÿwantÿtoÿaddÿfromÿtheÿannotationÿmenuÿandÿdragÿitÿontoÿtheÿviewer.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ166

        Availableÿannotationsÿinclude:ÿ ¡ AnnotationText—Displaysÿaÿrectangularÿboxÿthatÿcanÿhaveÿtextÿwithinÿit.ÿ

        ¡ AnnotationCircle—Displaysÿaÿcircleÿwithoutÿtextÿfunctionality.ÿ ¡ AnnotationRectangle—Displaysÿaÿrectangularÿboxÿwithoutÿtextÿfunctionality.ÿ

        ¡ AnnotationArrow—Displaysÿaÿ2Dÿarrowÿthatÿcanÿhaveÿtextÿwithinÿit.ÿ

        ¡ AnnotationBalloon—Displaysÿaÿballoonÿcaptionÿthatÿcanÿhaveÿtextÿwithinÿit.ÿTheÿballoon'sÿ"tail"ÿcanÿbeÿ placedÿinÿoneÿofÿeightÿpositionsÿaroundÿtheÿballoon.ÿ ¡ AnnotationLine—Displaysÿaÿlineÿwithÿareaÿforÿtext.ÿ ÿ 3. Setÿtheÿannotationÿlookÿandÿfeelÿorÿdeleteÿitÿfromÿyourÿprojectÿbyÿright-clickingÿtheÿannotationÿandÿ selectingÿProperties orÿDeleteÿfromÿtheÿshortcutÿmenu.ÿ

        Toÿaddÿannotationsÿatÿrunÿtime TheÿfollowingÿexampleÿshowsÿhowÿannotationsÿcanÿbeÿaddedÿatÿrunÿtimeÿandÿsavedÿtoÿanÿRDFÿfile. 'VisualÿBasic ImportsÿDataDynamics.Viewer.Annotations ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ167

        DimÿrptÿAsÿNewÿrptAnnotations PrivateÿSubÿAddAnnotations()ÿ 'Runÿtheÿreportÿfirst rpt.Run()

        'Assignÿtheÿviewer Me.Viewer1.Documentÿ=ÿrpt.Document

        'Createÿanÿannotationÿandÿassignÿpropertyÿvalues DimÿcircleÿAsÿNewÿAnnotationCircle circle.Colorÿ=ÿSystem.Drawing.Color.GreenYellow circle.Border.Colorÿ=ÿSystem.Drawing.Color.Chartreuse

        'Addÿtheÿannotation circle.Attach(1,1)ÿ'screenÿlocation Me.Viewer1.Document.Pages(0).Annotations.Add(circle)

        'Setÿtheÿsizeÿproperties.ÿTheÿannotationÿmustÿbeÿaddedÿtoÿtheÿpageÿfirst. circle.Heightÿ=ÿ0.25 circle.Widthÿ=ÿ0.50

        'SaveÿannotationsÿtoÿanÿRDFÿfile rpt.Document.Save("C:\\MyAnnotations.rdf") EndÿSub

        //C# usingÿDataDynamics.ActiveReports.Viewer.Annotations;

        rptAnnotationsÿrptÿ=ÿnewÿrptAnnotations(); privateÿvoidÿAddAnnotations() { //Runÿtheÿreportÿfirst rpt.Run(); ÿ //Assignÿtheÿviewer this.viewer1.Documentÿ=ÿrpt.Document; ÿ //Createÿanÿannotationÿandÿassignÿpropertyÿvalues AnnotationCircleÿcircleÿ=ÿnewÿAnnotationCircle(); circle.Colorÿ=ÿSystem.Drawing.Color.GreenYellow; circle.Border.Colorÿ=ÿSystem.Drawing.Color.Chartreuse; ÿ //Addÿtheÿannotation circle.Attach(1,1)ÿ//screenÿlocation this.viewer1.Document.Pages[0].Annotations.Add(circle);

        //Setÿtheÿsizeÿproperties.ÿTheÿannotationÿmustÿbeÿaddedÿtoÿtheÿpageÿfirst. circle.Heightÿ=ÿ0.25f; circle.Widthÿ=ÿ0.50f;

        //SaveÿannotationsÿtoÿanÿRDFÿfile ÿ rpt.Document.Save("C:\\MyAnnotations.rdf"); }

        What'sÿNew

        ActiveReportsÿforÿ.NETÿ3.0ÿhasÿmanyÿnewÿfeaturesÿthatÿenhanceÿtheÿreportingÿcapabilitiesÿalreadyÿpraisedÿbyÿ developersÿinÿpreviousÿversionsÿofÿActiveReports. NewÿSupportÿforÿVisualÿStudio.NETÿ2005 ActiveReportsÿforÿ.NETÿ3.0ÿnowÿoffersÿsupportÿforÿVisualÿStudioÿ.NETÿVersionsÿ2003ÿandÿ2005.ÿ NewÿFileÿFormat ActiveReportsÿareÿnowÿwrittenÿinÿC#ÿorÿVisualÿBasicÿforÿ.NET,ÿdependingÿonÿtheÿtypeÿofÿ.NETÿenvironmentÿ inÿwhichÿyouÿcreateÿtheÿreport.ÿAÿnewÿActiveReportsÿReportÿConverterÿcanÿbeÿusedÿtoÿconvertÿRPX-basedÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ168

        reports,ÿensuringÿthatÿolderÿActiveReportsÿwillÿbeÿfullyÿsupportedÿbyÿtheÿnewÿarchitecture.ÿ NewÿChartÿtypes Withÿtheÿadditionÿofÿtheÿsevenÿnewÿchartÿtypes,ÿdevelopersÿareÿfreedÿfromÿtheÿneedÿtoÿfindÿaÿseparateÿ chartingÿcomponent.ÿThisÿnotÿonlyÿsavesÿmoney,ÿbutÿalsoÿtime,ÿasÿtheÿChartÿcontrolÿisÿalreadyÿintegratedÿ intoÿActiveReports.ÿNewÿchartÿtypesÿincludeÿtheÿfollowing:ÿ l FunnelÿCharts showÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿtheÿwhole.ÿ l GanttÿCharts graphÿtheÿprogressÿofÿprojectÿtasks.ÿ

        l KagiÿCharts displayÿsupplyÿandÿdemandÿtrends.ÿ l PointÿandÿFigureÿCharts defineÿpricingÿtrends.ÿ l PyramidÿCharts shareÿtheÿsameÿfunctionÿasÿFunnelÿchartsÿbutÿshowÿtheÿdataÿinÿaÿdifferentÿformat.ÿ

        l RenkoÿCharts keepÿtrackÿofÿpriceÿmovement.ÿ l ThreeÿLineÿBreakÿCharts illustrateÿpriceÿchanges.ÿ NewÿDesign-timeÿFunctionality ActiveReportsÿboastsÿnewÿdesign-timeÿfeaturesÿthatÿcanÿreduceÿtheÿamountÿofÿwrittenÿcodeÿandÿgiveÿyouÿ greaterÿcontrolÿoverÿtheÿlayoutÿofÿyourÿreports,ÿsuchÿasÿtheÿfollowing:ÿ l Aÿpreviewÿtabÿthatÿprovidesÿreal-timeÿreportÿfeedback,ÿallowingÿyouÿtoÿquicklyÿseeÿtheÿrun-timeÿimpactÿ ofÿyourÿcodingÿandÿdesign-timeÿdrag-and-dropÿactions.ÿWithÿaÿclickÿofÿtheÿmouse,ÿyouÿcanÿpreviewÿ yourÿreportÿandÿthenÿreturnÿtoÿtheÿdesignerÿtoÿmakeÿchanges.ÿ ToÿpreviewÿyourÿActiveReport,ÿclickÿtheÿPreviewÿtabÿbelowÿtheÿreportÿdesignÿsurface.ÿToÿreturnÿtoÿtheÿ designÿsurface,ÿclickÿtheÿDesignerÿtab.

        ÿ

        l Theÿadditionÿofÿaÿzoomÿtoolbarÿitemÿallowsÿdevelopersÿandÿendÿusersÿtoÿmagnifyÿtheÿdesignÿsurfaceÿofÿ theÿreportÿforÿmoreÿpreciseÿplacementÿandÿviewingÿofÿreportÿcontrols.ÿ

        Note:ÿTheÿmagnificationÿComboBoxÿisÿviewableÿinÿPreviewÿmode,ÿatÿrunÿtime,ÿandÿwithÿtheÿEnd- UserÿReportÿDesignerÿthatÿisÿincludedÿinÿtheÿProfessionalÿedition.ÿOnlyÿtheÿzoomÿcontrolÿisÿ availableÿatÿdesignÿtime.

        l TheÿReportÿExplorer'sÿFieldsÿlistboxÿhasÿbeenÿreplacedÿbyÿtheÿFieldsÿnode,ÿgivingÿtheÿReportÿExplorerÿaÿ moreÿself-containedÿlookÿandÿfeel.ÿExpandingÿtheÿFieldsÿnodeÿrevealsÿtheÿreport'sÿdataÿfields.ÿ l TheÿReportÿExplorerÿnowÿcontainsÿaÿnodeÿforÿCalculatedÿFields.ÿYouÿcanÿadd,ÿdelete,ÿandÿ modifyÿcalculatedÿfieldsÿatÿdesignÿtime.ÿÿ

        ÿ

        l AÿParametersÿnodeÿhasÿbeenÿaddedÿtoÿtheÿReportÿExplorer.ÿYouÿcanÿeasilyÿadd,ÿdelete,ÿandÿmodifyÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ169

        reportÿparametersÿatÿdesignÿtime.ÿÿÿ

        ÿ l .NETÿdataÿcomponentsÿcanÿnowÿbeÿdroppedÿdirectlyÿontoÿtheÿdesignÿsurfaceÿofÿanÿActiveReport,ÿ resultingÿinÿaÿvisualÿrepresentationÿofÿtheÿcomponentÿinÿtheÿnewÿActiveReportsÿcomponentÿtray.ÿThisÿ makesÿitÿeasyÿtoÿuseÿcustomÿdata.ÿ

        ÿ l MoreÿShortcutÿKeyÿSupportÿ

        ¡ PressingÿCTRL+A whileÿinÿaÿreportÿsectionÿselectsÿallÿofÿtheÿcontrolsÿinÿthatÿselection.ÿ

        ¡ PressingÿtheÿCTRL keyÿwhileÿdraggingÿaÿcontrolÿallowsÿyouÿtoÿcopy theÿcontrolÿtoÿaÿdifferentÿreportÿ section.ÿ ¡ PressingÿtheÿSHIFT keyÿwhileÿdraggingÿaÿcontrolÿallowsÿyouÿtoÿmove thatÿcontrolÿtoÿaÿdifferentÿ reportÿsection.ÿ l NewÿReportInfoÿcontrolÿcanÿbeÿdraggedÿfromÿtheÿActiveReportsÿ3.0ÿtoolboxÿontoÿanyÿsectionÿofÿtheÿ report,ÿallowingÿyouÿtoÿeasilyÿdisplayÿreportÿinformationÿsuchÿasÿ"pageÿNÿofÿM"ÿand/orÿrun-timeÿ datesÿinÿmultipleÿformatsÿthroughÿmanipulationÿofÿtheÿReportInfo.FormatStringÿproperty.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ170

        ÿ ViewerÿEnhancements TheÿViewerÿcontrolÿinÿActiveReportsÿforÿ.NETÿ3.0ÿhasÿbeenÿimprovedÿwithÿseveralÿnewÿfeaturesÿthatÿ improveÿtheÿlookÿandÿfeelÿandÿbehaviorÿofÿyourÿActiveReportsÿprojects.ÿ l AnnotationsÿinÿtheÿViewerÿcontrol TheÿWinFormsÿviewerÿcontrolÿnowÿprovidesÿforÿtheÿplacementÿofÿannotationsÿonÿtheÿviewer'sÿreportÿ view.ÿThisÿmakesÿitÿpossibleÿtoÿaddÿnotes,ÿspecialÿinstructions,ÿetc.,ÿdirectlyÿonÿtheÿActiveReportÿitself,ÿ makingÿteamÿcollaboration,ÿfeedback,ÿandÿend-userÿsupportÿanÿeasierÿtask. l TabbedÿViewingÿ ActiveReportsÿnowÿusesÿtheÿHyperLinkÿpropertyÿofÿcontrolsÿtoÿprovideÿtabbedÿviewingÿforÿTOCÿcontentsÿ andÿWebÿlinks.ÿWhenÿhyperlinksÿthatÿpointÿtoÿaÿWebÿpageÿorÿtheÿTOC,ÿActiveReportsÿopensÿtheÿlinkÿasÿ aÿnewÿtabÿwithinÿtheÿviewer.ÿInÿthisÿway,ÿreportÿnavigationÿbecomesÿmuchÿeasierÿandÿmoreÿappealingÿ toÿendÿusers,ÿwhoÿcanÿquicklyÿmoveÿfromÿlinksÿbackÿtoÿtheirÿoriginalÿplaceÿinÿtheÿreportÿbyÿclickingÿtheÿ tabsÿatÿtheÿtopÿofÿtheÿreport.ÿAdditionally,ÿlinksÿsetÿtoÿe-mailÿaddressesÿshellÿoutÿtoÿtheÿoperatingÿ system,ÿwhichÿopensÿtheÿdefaultÿe-mailÿprogram.

        l NewÿHyperLinkÿPropertiesÿforÿtheÿViewerÿControl Fiveÿadditionalÿhyperlinkÿpropertiesÿhaveÿbeenÿaddedÿtoÿtheÿviewerÿcontrolÿthatÿallowÿdevelopersÿtoÿ furtherÿcustomizeÿtheÿlookÿandÿbehaviorÿofÿtheirÿreports.ÿ

        Property Function

        HyperLinkForeColor Setsÿtheÿforegroundÿcolorÿofÿtheÿviewer'sÿhyperlinksÿ

        HyperLinkBackColor Setsÿtheÿbackgroundÿcolorÿofÿtheÿcontrolÿthatÿhostsÿaÿhyperlink

        HyperLinkUnderline Determinesÿwhetherÿhyperlinksÿwillÿbeÿunderlined

        SearchResultsForeColor Setsÿtheÿforegroundÿcolorÿofÿtheÿhighlightedÿtextÿwhenÿusingÿ theÿfindÿdialogÿ

        SearchResultsBackColor Setsÿtheÿbackgroundÿcolorÿofÿtheÿhighlightedÿtextÿwhenÿusingÿ theÿfindÿdialogÿ

        EnhancedÿEnd-UserÿReportÿDesigner TheÿprofessionalÿeditionÿofÿActiveReportsÿnowÿcontainsÿaÿredesignedÿend-userÿreportÿdesignerÿthatÿ exposesÿtheÿCommandBarÿlibraryÿforÿdevelopersÿwhoÿwishÿtoÿcustomizeÿtheÿlookÿandÿfeelÿofÿtheÿuserÿ interface.ÿDevelopersÿnowÿhaveÿatÿtheirÿdisposalÿallÿofÿtheÿanyÿorÿallÿofÿtheÿinherentÿtoolbarÿitemsÿ packagedÿwithinÿActiveReportsÿasÿwellÿasÿtheÿoptionÿtoÿplaceÿtheirÿownÿcustomÿtoolbarÿobjectsÿonÿtheÿend- userÿreportÿdesigner.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ171

        ChangeÿtoÿtheÿDocument.Print()ÿMethod TheÿDocument.Print()ÿmethodÿnowÿreturnsÿBooleanÿoverloadsÿtoÿindicateÿwhetherÿreportÿprintingÿhasÿbeenÿ abortedÿdueÿtoÿanÿunhandledÿexception,ÿtheÿuserÿpressingÿtheÿCancelÿbutton,ÿorÿifÿtheÿreportÿcompletedÿ printing.ÿ AddedÿScriptingÿCapabilities ActiveReportsÿnowÿsupportsÿtheÿuseÿofÿVisualÿBasicÿ.NETÿandÿC#ÿasÿscriptingÿlanguages.ÿToÿtakeÿ advantageÿofÿthisÿnewÿfeature,ÿspecifyÿyourÿpreferredÿscriptingÿlanguageÿbyÿsettingÿtheÿScriptLanguageÿ propertyÿonÿActiveReports,ÿwhichÿwillÿbeÿsavedÿinÿtheÿRPXÿfileÿforÿtheÿreport.ÿ

        Toÿaccessÿtheÿscriptÿeditor,ÿclickÿtheÿScriptÿtabÿ belowÿtheÿreportÿdesignÿsurface.

        EnhancedÿAccessÿConversion EasilyÿconvertÿexistingÿMicrosoft®ÿAccess®ÿreportsÿintoÿActiveReportsÿwithÿtheÿnewÿActiveReportsÿ MicrosoftÿAccessÿImportÿWizard.ÿ NewÿBarcode NewÿbarcodeÿtypeÿEAN128.ÿ NewÿCacheToDiskLocationÿpropertyÿonÿtheÿDocumentÿobject TheÿnewÿCacheToDiskLocationÿpropertyÿallowsÿusersÿtoÿspecifyÿtheÿlocationÿofÿtheÿCacheToDiskÿtempÿfiles.ÿ AÿNewÿEventÿinÿtheÿEndÿUserÿReportÿDesignerÿcontrol WithÿtheÿadditionÿofÿtheÿDataSourceIconClickÿevent,ÿdevelopersÿcanÿcustomizeÿtheÿdatasourceÿdialogÿthatÿ endÿusersÿseeÿinÿtheÿProfessionalÿEdition.ÿ NewÿWebÿViewerÿExportÿOptions YouÿcanÿnowÿsetÿexportÿpropertiesÿdirectlyÿonÿtheÿWebViewerÿcontrolÿusingÿtheÿPropertiesÿgrid.ÿExpandÿtheÿ HtmlExportOptionsÿandÿPdfExportOptionsÿpropertiesÿinÿtheÿPropertiesÿgridÿtoÿseeÿallÿofÿtheÿpropertiesÿyouÿ ÿ canÿset.ÿ

        LicensingÿReports

        LicensingÿaÿMachineÿforÿActiveReportsÿforÿ.NETÿ3.0

        ToÿlicenseÿaÿmachineÿforÿActiveReportsÿforÿ.NETÿ3.0 1. LocateÿtheÿoriginalÿdownloadedÿelectronicÿstoreÿpackageÿorÿshippedÿCD.ÿ 2. Locateÿtheÿlicensingÿapplicationÿbasedÿonÿtheÿeditionÿ ¡ StandardÿEdition:ÿLicenseStd3.exeÿorÿUpgradeStd3.exeÿ

        ¡ ProfessionalÿEdition:ÿLicensePro3.exeÿorÿUpgradePro3.exe 3. Runÿtheÿmachineÿlicensingÿexecutableÿyouÿlocatedÿinÿtheÿaboveÿstep.ÿ 4. Enterÿtheÿinformationÿasÿpromptedÿ(UserÿName,ÿCompanyÿName)ÿwithoutÿcommasÿorÿperiods.ÿ(Theÿkeysÿ inÿtheÿweb.configÿfileÿareÿcommaÿdelimitedÿandÿenteringÿaÿcommaÿwillÿcauseÿerrors.)ÿ 5. DetermineÿwhetherÿyourÿprojectÿisÿaÿWindowsÿFormsÿSolutionÿorÿaÿWebÿFormÿSolution.ÿVisitÿtheÿ appropriateÿsectionÿbelow.

        CheckingÿActiveReportsÿWindowsÿApplicationsÿforÿLicensing

        ToÿcheckÿanÿexistingÿActiveReportsÿWindowsÿapplicationÿforÿlicensing 1. OpenÿanÿexistingÿActiveReportsÿWindowsÿapplicationÿproject.ÿ 2. InÿtheÿSolutionÿExplorerÿwindow,ÿchooseÿtheÿ"ShowÿAllÿFiles"ÿicon.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ172

        3. Ifÿthereÿisÿaÿfileÿcalledÿ"licenses.licx"ÿinÿyourÿapplication'sÿfileÿlist,ÿtheÿActiveReportsÿapplicationÿisÿlicensed.ÿ 4. Ifÿtheÿ"licenses.licx"ÿfileÿdoesÿnotÿappearÿinÿyourÿapplication'sÿfileÿlist,ÿfollowÿtheÿinstructionsÿunderÿ "LicensingÿExistingÿWindowsÿFormsÿProjects"ÿbelow.ÿ

        LicensingÿaÿProjectÿUsingÿtheÿSetLicenseÿMethod

        ToÿlicenseÿaÿprojectÿusingÿtheÿSetLicenseÿmethod 1. Createÿaÿ"web.config"ÿkeyÿbyÿrunningÿtheÿ"CreateÿWeb.ConfigÿKey"ÿdescribedÿinÿtheÿWebÿFormsÿsectionÿ below.ÿ 2. Inÿyourÿapplicationÿclass,ÿcreateÿaÿreportÿinstanceÿandÿuseÿtheÿSetLicense()ÿmethodÿtoÿproperlyÿsetÿtheÿ keyÿyouÿcreatedÿfromÿStepÿA.ÿTheÿstringÿvalueÿforÿtheÿgeneratedÿkeyÿshouldÿbeÿ"[Name],ÿ[Companyÿ Name],ÿ[SerialÿNumber],ÿ[HashÿCode]".ÿ

        LicensingÿExistingÿWindowsÿFormsÿProjects

        ToÿlicenseÿWindowsÿFormsÿProjects Note:ÿPleaseÿnoteÿthatÿtheÿaboveÿstepsÿwillÿlicenseÿyourÿmachineÿforÿnew WindowsÿFormsÿprojectsÿ only.ÿIfÿyouÿhaveÿanÿexisting WindowsÿFormsÿprojectÿcreatedÿbeforeÿyouÿpurchasedÿtheÿlicense,ÿyouÿ mustÿopenÿtheÿprojectÿafterÿperformingÿtheÿstepsÿaboveÿandÿrebuild theÿsolution.ÿThisÿwillÿworkÿunlessÿ yourÿprojectÿisÿaÿspecialÿsolutionÿasÿlistedÿbelow.ÿ 1. Ifÿtheÿprojectÿdoesÿnotÿhaveÿaÿlicenses.licxÿfileÿinÿtheÿstartupÿproject,ÿuseÿoneÿofÿtheÿfollowingÿmethods:ÿ

        ¡ AddÿaÿtemporaryÿActiveReportÿtoÿtheÿstartupÿprojectÿandÿchooseÿRebuildÿfromÿtheÿBuildÿmenuÿbeforeÿ deletingÿtheÿActiveReport.ÿ

        ¡ Orÿcopyÿtheÿlicenses.licxÿfromÿtheÿprojectÿcontainingÿtheÿreportsÿtoÿtheÿstartupÿproject.ÿEnsureÿthatÿ theÿbuildÿactionÿisÿsetÿtoÿ"EmbeddedÿResource." 2. Ifÿtheÿstartupÿprojectÿincludesÿaÿlicenses.licxÿfile,ÿverifyÿthatÿitÿincludesÿtheÿfollowingÿline:ÿ "DataDynamics.ActiveReports.ActiveReport3,ÿActiveReports"ÿ 3. IfÿtheÿstartupÿprojectÿonlyÿcontainsÿanÿEndÿUserÿDesignerÿuseÿoneÿofÿtheÿfollowingÿmethodsÿtoÿlicenseÿit:ÿ ¡ AddÿaÿnewÿdesignerÿtoÿtheÿprojectÿandÿchooseÿRebuildÿfromÿtheÿBuildÿmenu.ÿOnceÿthisÿisÿdone,ÿandÿ you'veÿverifiedÿthatÿtheÿ"DataDynamics.ActiveReports.Designer.Designer,ÿActiverReports.Design"ÿlineÿ hasÿbeenÿaddedÿtoÿyourÿlicenses.licxÿfile,ÿyouÿcanÿsafelyÿremoveÿtheÿextraÿdesignerÿfromÿtheÿproject.ÿ ¡ Orÿaddÿtheÿlineÿ"DataDynamics.ActiveReports.Designer.Designer,ÿActiverReports.Design"ÿtoÿtheÿ licenses.licxÿfileÿmanually.ÿOnceÿthisÿisÿadded,ÿRebuildÿtheÿsolutionÿfromÿtheÿBuildÿmenu.

        LicensingÿWebÿFormsÿProjects

        ToÿlicenseÿWebÿFormsÿProjectsÿ 1. IfÿyouÿareÿusingÿaÿWebÿFormsÿprojectÿyouÿmustÿcreateÿaÿweb.configÿkeyÿforÿyourÿprojectÿusingÿtheÿutilityÿ locatedÿinÿtheÿStartÿMenuÿunderÿAllÿProgramsÿ>ÿDataÿDynamicsÿ>ÿActiveReportsÿforÿ.NETÿ>ÿCreateÿ Web.ConfigÿKey.ÿ 2. Enterÿtheÿsameÿinformationÿyouÿusedÿtoÿlicenseÿtheÿmachineÿandÿitÿwillÿcreateÿaÿkeyÿthatÿyouÿcanÿcopyÿ intoÿyourÿproject'sÿWeb.Configÿfileÿbetweenÿÿandÿÿtoÿremoveÿtheÿlicensingÿ message.ÿTheÿweb.configÿkeyÿlooksÿlikeÿthis:ÿ ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ173

        GettingÿAssistance

        ThisÿtopicÿwillÿshowÿyouÿhowÿtoÿlocateÿReadmeÿinformationÿasÿwellÿasÿhowÿtoÿobtainÿsupportÿforÿActiveReportsÿ forÿ.NETÿ3.0. ÿ ReadmeÿFile FindÿoutÿhowÿtoÿlocateÿtheÿReadmeÿfile.ÿ ProductÿSupportÿ FindÿoutÿhowÿtoÿobtainÿproductÿsupportÿforÿActiveReportsÿforÿ.NETÿ3.0.ÿ

        RelatedÿSections IntroducingÿActiveReportsÿforÿ.NETÿ3.0 ActiveReportsÿleveragesÿtheÿlatestÿtechnologiesÿincludingÿXML,ÿscriptingÿandÿCSSÿalongÿwithÿ openÿarchitectureÿtoÿprovideÿaÿfully-integratedÿandÿuser-friendlyÿreportÿdesigner.ÿ FrequentlyÿAskedÿQuestions ThisÿsectionÿlistsÿquestionsÿandÿanswersÿaboutÿActiveReportsÿforÿ.NETÿ3.0.ÿ InstallationÿandÿSetup ThisÿtopicÿwillÿhelpÿyouÿfindÿoutÿwhatÿisÿnecessaryÿtoÿinstallÿActiveReportsÿandÿdirectÿyouÿtoÿ appropriateÿhelpÿforÿtheÿinstallationÿprocess.ÿ SamplesÿandÿWalkthroughs Thisÿsectionÿcontainsÿsampleÿcodeÿandÿapplicationsÿthatÿillustrateÿbasicÿtechniquesÿandÿusesÿofÿ ÿ ActiveReports.ÿ

        ReadmeÿFile

        Afterÿinstallation,ÿyouÿcanÿlocateÿtheÿReadme.htaÿfileÿinÿtheÿ"Introduction"ÿfolderÿofÿtheÿrootÿActiveReportsÿÿ forÿ.NETÿ3.0ÿinstallationÿfolder.ÿUseÿyourÿInternetÿbrowserÿtoÿopenÿandÿviewÿtheÿfile.ÿ

        ProductÿSupport

        ThisÿtopicÿwillÿexplainÿhowÿtoÿregisterÿyourÿActiveReportsÿforÿ.NETÿ3.0ÿpurchaseÿandÿobtainÿtechnicalÿsupport.

        Inÿthisÿsection ProductÿRegistration LearnÿhowÿtoÿregisterÿyourÿproductÿpurchaseÿwithÿDataÿDynamics.ÿ TechnicalÿSupport ÿ FindÿhowÿtoÿreceiveÿtechnicalÿsupportÿforÿActiveReportsÿforÿ.NETÿ3.0.ÿ

        ProductÿRegistration

        Inÿorderÿtoÿreceiveÿtelephoneÿsupport,ÿproductÿnews,ÿandÿupgradeÿannouncements,ÿyouÿmustÿregisterÿyourÿ productÿpurchaseÿwithÿDataÿDynamics.ÿWeÿencourageÿyouÿtoÿregisterÿyourÿpurchaseÿasÿsoonÿasÿyouÿreceiveÿitÿ byÿcompletingÿtheÿregistrationÿformÿonÿourÿWebÿsiteÿatÿÿ http://www.datadynamics.com/Products/Register.aspx.ÿ

        TechnicalÿSupport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ174

        TechnicalÿsupportÿisÿavailableÿforÿActiveReportsÿforÿ.NETÿ3.0ÿinÿaÿvarietyÿofÿmedia.ÿ

        TelephoneÿSupport TelephoneÿsupportÿisÿavailableÿforÿregisteredÿusersÿofÿActiveReportsÿforÿ.NETÿ3.0. WhenÿcontactingÿDataÿDynamicsÿwithÿsupportÿquestions,ÿbeÿpreparedÿtoÿprovideÿaÿserialÿnumber,ÿtheÿfullÿ versionÿnumberÿofÿActiveReports,ÿaÿcompleteÿdescriptionÿofÿtheÿproblem,ÿasÿwellÿasÿhardwareÿandÿoperatingÿ environmentÿspecifications. Supportÿtelephoneÿnumber:ÿÿ(614)ÿ895-3142ÿ(9:00am-5:00pmÿUSÿEasternÿStandardÿTime)

        E-mailÿSupport E-mailÿsupportÿisÿavailableÿforÿActiveReportsÿforÿ.NETÿ3.0.ÿContactÿ [email protected].ÿ

        Webÿsite TheÿDataÿDynamicsÿwebÿsiteÿoffersÿtheÿlatestÿproductÿnews,ÿwhiteÿpapers,ÿtutorials,ÿreportÿsamplesÿandÿ productÿserviceÿpacks.ÿPleaseÿvisitÿtheÿwebÿsiteÿforÿtheÿlatestÿnewsÿaboutÿActiveReportsÿforÿ.NETÿ3.0ÿbeforeÿ contactingÿtechnicalÿsupport.

        ProductÿUpgrades MinorÿupgradesÿandÿserviceÿpacksÿwillÿbeÿmadeÿavailableÿforÿdownloadÿfromÿtheÿDataÿDynamicsÿwebÿsiteÿfreeÿ ofÿcharge. http://www.datadynamics.com/Products/default.aspx?Mode=Downloads Majorÿupgradesÿwillÿcarryÿanÿupgradeÿpriceÿthatÿisÿdeterminedÿseparatelyÿforÿeachÿrelease.ÿYouÿwillÿbeÿeligibleÿ forÿaÿfreeÿmajorÿupgradeÿifÿyouÿpurchasedÿtheÿproductÿwithinÿ30ÿdaysÿofÿtheÿupgradeÿreleaseÿdate.

        KnowledgeBaseÿarticles TheÿDataÿDynamicsÿKnowledgeBaseÿcontainsÿhundredsÿofÿhelpfulÿarticlesÿforÿallÿDataÿDynamicsÿproducts.ÿYouÿ canÿsearchÿtheÿentireÿKnowledgeBaseÿforÿkeywordsÿorÿnarrowÿdownÿyourÿsearchÿfirstÿbyÿchoosingÿaÿspecificÿ productÿbeforeÿsubmittingÿyourÿsearchÿcriteria. KnowledgeBaseÿ(http://www.datadynamics.com/Products/default.aspx? Mode=Knowledge+Base)

        SupportÿForums TheÿDataÿDynamicsÿsupportÿforumsÿcanÿbeÿusedÿtoÿreadÿandÿpostÿquestionsÿandÿanswersÿaboutÿissuesÿyouÿ encounterÿwithÿActiveReportsÿforÿ.NETÿ3.0.ÿTipsÿandÿtricksÿcanÿbeÿcommunicatedÿwithÿotherÿusersÿandÿaccessÿ toÿtheÿDataÿDynamicsÿtechnicalÿsupportÿteamÿcanÿbeÿgainedÿinÿanÿonlineÿcommunityÿforum.ÿDataÿDynamics'ÿ technicalÿsupportÿengineersÿmonitorÿtheÿforumsÿconstantlyÿandÿareÿavailableÿtoÿanswerÿquestionsÿandÿassistÿ withÿanyÿissuesÿencounteredÿusingÿtheÿproduct.ÿProductÿannouncementsÿwillÿalsoÿbeÿpostedÿtoÿtheÿforums.

        SupportÿforumÿaddressÿforÿActiveReportsÿforÿ.NETÿ3.0:ÿÿ http://www.datadynamics.com/ShowForum.aspx?ForumID=73

        SamplesÿandÿWalkthroughs

        Thisÿsectionÿcontainsÿexampleÿcodeÿandÿsampleÿapplicationsÿthatÿillustrateÿbasicÿtechniquesÿandÿusesÿofÿ ActiveReports.ÿ

        InÿThisÿSection Samples ReviewÿvariousÿsamplesÿinÿC#ÿandÿVisualÿBasicÿ.NET.ÿÿ Walkthroughs Learnÿhowÿtoÿcreateÿvariousÿreportsÿandÿreportÿconstituentsÿwithÿstep-by-stepÿinstructions.ÿ

        RelatedÿSections IntroducingÿActiveReportsÿforÿ.NETÿ3.0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ175

        ActiveReportsÿleveragesÿtheÿlatestÿtechnologiesÿincludingÿXML,ÿScriptingÿandÿCSSÿalongÿwithÿopenÿ architectureÿtoÿprovideÿyouÿwithÿaÿfully-integratedÿandÿuser-friendlyÿreportÿdesigner.ÿÿ GettingÿAssistance ThisÿtopicÿshowsÿyouÿhowÿtoÿlocateÿReadmeÿinformationÿasÿwellÿasÿhowÿtoÿobtainÿsupportÿforÿActiveReportsÿ ÿ forÿ.NETÿ3.0.ÿ

        Samples

        ActiveReportsÿincludesÿmanyÿsamplesÿwhichÿdemonstrateÿapplicationsÿtheÿdevelopersÿcreatedÿforÿ ActiveReportsÿforÿ.NETÿ3.0.ÿTheseÿsamplesÿshowÿtheÿuseÿofÿaÿcombinationÿofÿcontrolsÿandÿcodeÿtoÿproduceÿ variousÿreports.

        Inÿthisÿsection StandardÿEditionÿSamples ProvidesÿlinksÿtoÿsamplesÿofÿStandardÿEditionÿapplications.ÿ ProfessionalÿEditionÿSamples ProvidesÿlinksÿtoÿsamplesÿofÿProfessionalÿEditionÿapplications.ÿ

        AdditionalÿInformation Walkthroughs Walkthroughsÿgiveÿbasicÿstep-by-stepÿinstructionsÿforÿcommonÿsituationsÿinÿActiveReports.ÿThisÿfeatureÿ ÿ makesÿwalkthroughsÿanÿexcellentÿwayÿtoÿlearnÿmoreÿaboutÿtheÿbasicÿfeaturesÿofÿtheÿproduct.ÿ

        StandardÿEditionÿSamples

        AnnualÿReport Demonstratesÿsubreports,ÿNestedÿsubreports,ÿmodifyingÿdataÿsourceÿpropertiesÿatÿrunÿtime,ÿ parametersÿinÿtheÿchartÿcontrol,ÿalternateÿrowÿhighlightingÿandÿpagebreakÿcontrol.ÿ ASP.NETÿStandardÿEditionÿWebÿSample DemonstratesÿusingÿStandardÿEditionÿinÿASP.NET.ÿItÿshowsÿhowÿtoÿuseÿcustomÿexportingÿwithoutÿ theÿProÿEditionÿserverÿcontrolsÿorÿRPXÿhandlersÿasÿwellÿasÿrunningÿreportsÿonÿtheÿserver,ÿexportingÿoutputÿ toÿHTMLÿorÿPDFÿstreamsÿandÿpushingÿcontentÿtoÿtheÿclient.ÿTheÿsampleÿalsoÿdemonstratesÿusingÿtheÿ ActiveXÿviewerÿcontrol toÿviewÿreportÿoutputÿonÿtheÿclientÿmachine.ÿ BoundÿDataÿSample DemonstratesÿbindingÿtoÿADO.NETÿDataÿobjects.ÿ CacheToDiskÿSample DemonstratesÿtheÿusageÿandÿeffectsÿofÿtheÿCacheToDiskÿproperty.ÿ CalculatedÿFieldsÿSample Demonstratesÿusingÿanÿunboundÿdataÿfieldÿtoÿperformÿaÿcalculationÿwhichÿcanÿthenÿbeÿaggregated.ÿ CategoryÿSelection Demonstratesÿusingÿtheÿadÿhocÿreportÿfilterÿbyÿmodifyingÿtheÿreport'sÿSQLÿqueryÿatÿrunÿtime.ÿ ChartingÿSample DemonstratesÿtheÿuseÿofÿtheÿChartÿcontrolÿinÿbothÿboundÿandÿunboundÿmodes.ÿ Cross-Tab Demonstratesÿusingÿunboundÿdata,ÿconditionalÿhighlightingÿandÿdistributingÿdataÿacrossÿcolumnsÿtoÿ createÿaÿcross-tabÿviewÿandÿdataÿaggregation.ÿ CustomÿPreview Demonstratesÿusingÿviewerÿcontrolÿcustomization,ÿexportÿfilters,ÿrichÿeditÿcontrolÿandÿmail-merge,ÿ parametersÿinÿtheÿchartÿcontrol,ÿandÿgrouping.ÿ DataFieldÿExpressions DemonstratesÿtheÿuseÿofÿexpressionsÿinÿtheÿDataFieldÿpropertiesÿofÿcontrols.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ176

        E-mail Demonstratesÿrenderingÿaÿstand-aloneÿRPXÿfileÿtoÿPDFÿandÿe-mailingÿtheÿPDFÿfileÿasÿanÿattachmentÿ usingÿtheÿdefaultÿmailÿclient.ÿ HyperlinksÿandÿDrill-Downs Demonstratesÿusingÿhyperlinksÿandÿtheÿviewerÿhyperlinkÿeventÿtoÿsimulateÿdrill-downÿfromÿoneÿ reportÿtoÿanother.ÿ iListÿBindingÿSample Demonstratesÿhowÿtoÿbindÿreportsÿtoÿobjects.ÿ PrintÿMultipleÿPagesÿPerÿSheet Demonstratesÿhowÿtoÿprintÿmultipleÿpagesÿofÿaÿreportÿonÿaÿsingleÿsheetÿofÿpaper.ÿ RDFÿFileÿViewer DemonstratesÿcustomizingÿtheÿWinFormsÿviewerÿcontrolÿtoolbar,ÿloadingÿReportÿDocumentÿFilesÿ (RDF)ÿandÿusingÿtheÿexportÿfilters.ÿ ReportÿAssemblies Demonstratesÿdistributingÿreportsÿasÿseparateÿassemblyÿfilesÿandÿcallingÿthemÿfromÿtheÿmainÿ applicationÿ.exeÿfile.ÿ Subreports ShowsÿtheÿproperÿuseÿofÿReportsÿwithÿSubReportsÿtoÿminimizeÿmemoryÿusage.ÿ UnboundÿData Demonstratesÿretrievingÿdataÿfromÿanÿarrayÿandÿfromÿaÿtextÿfileÿinÿunboundÿmode.ÿ

        XMLÿDataÿ DemonstratesÿtheÿXMLÿdataÿsourceÿandÿusingÿitÿtoÿrunÿmulti-levelÿreportsÿwithÿandÿwithoutÿusingÿ subreports.ÿ

        AnnualÿReportÿSample

        TheÿAnnualÿReportÿSampleÿdemonstratesÿsubreports,ÿNestedÿsubreports,ÿmodifyingÿdataÿsourceÿpropertiesÿatÿ runÿtime,ÿparametersÿinÿtheÿchartÿcontrol,ÿalternateÿrowÿhighlighting,ÿandÿtheÿpagebreakÿcontrol.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        ASP.NETÿStandardÿEditionÿWebÿSampleÿforÿVisualÿStudioÿ2003

        TheÿASP.NETÿWebÿsampleÿdemonstratesÿusingÿStandardÿEditionÿinÿASP.NET.ÿItÿshowsÿhowÿtoÿuseÿcustomÿ exportingÿwithoutÿtheÿProÿEditionÿserverÿcontrolsÿasÿwellÿasÿrunningÿreportsÿonÿtheÿserver,ÿexportingÿoutputÿtoÿ HTMLÿorÿPDFÿstreamsÿandÿpushingÿcontentÿtoÿtheÿclient.ÿTheÿsampleÿalsoÿdemonstratesÿusingÿtheÿActiveXÿ viewerÿcontrol toÿviewÿreportÿoutputÿonÿtheÿclientÿmachine. Notes: TheÿwebÿsamplesÿforÿVisualÿStudioÿ2003ÿwillÿneedÿtoÿbeÿconfiguredÿusingÿtheÿauto-configurationÿ utilityÿorÿconfiguredÿmanuallyÿbeforeÿtheÿsamplesÿcanÿbeÿrunÿ(seeÿManuallyÿConfiguringÿWebÿ Samples forÿhelp).ÿAlso,ÿtheÿASP.NETÿuserÿmachineÿwillÿneedÿtoÿhaveÿASP.NETÿwriteÿaccessÿbeforeÿ runningÿtheÿsamplesÿorÿanÿexceptionÿmayÿbeÿthrownÿduringÿexecution.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        BoundÿDataÿSample ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ177

        TheÿBoundÿDataÿSampleÿdemonstratesÿbindingÿtoÿADO.NETÿDataÿobjects.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        CacheToDiskÿSample

        TheÿCacheToDiskÿSampleÿdemonstratesÿtheÿusageÿandÿeffectsÿofÿtheÿCacheToDiskÿproperty.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        CalculatedÿFieldsÿSample

        TheÿCalculatedÿFieldsÿSampleÿdemonstratesÿusingÿanÿunboundÿdataÿfieldÿtoÿperformÿaÿcalculationÿthatÿcanÿ thenÿbeÿaggregated.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        CategoryÿSelectionÿSample

        TheÿCategoryÿSelectionÿSampleÿdemonstratesÿusingÿtheÿadÿhocÿreportÿfilterÿbyÿmodifyingÿtheÿreport'sÿSQLÿ queryÿatÿrunÿtime.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        ChartingÿSample

        TheÿChartingÿSampleÿdemonstratesÿtheÿuseÿofÿtheÿChartÿcontrolÿinÿbothÿboundÿandÿunboundÿmodes.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        Cross-TabÿSample ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ178

        TheÿCross-TabÿSampleÿdemonstratesÿusingÿunboundÿdata,ÿconditionalÿhighlightingÿandÿdistributingÿdataÿ acrossÿcolumnsÿtoÿcreateÿaÿcross-tabÿviewÿandÿdataÿaggregation.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        CustomÿPreviewÿSample

        TheÿCustomÿPreviewÿSampleÿdemonstratesÿusingÿviewerÿcontrolÿcustomization,ÿexportÿfilters,ÿrichÿeditÿcontrolÿ andÿmail-merge,ÿparametersÿinÿtheÿchartÿcontrol,ÿandÿgrouping.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        DataFieldÿExpressionsÿSample

        TheÿDataFieldÿExpressionsÿSampleÿdemonstratesÿtheÿuseÿofÿexpressionsÿinÿtheÿDataFieldÿpropertiesÿofÿ controls.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        E-mailÿSample

        TheÿE-mailÿSampleÿdemonstratesÿrenderingÿaÿstand-aloneÿRPXÿfileÿtoÿPDFÿandÿe-mailingÿtheÿPDFÿfileÿasÿanÿ attachmentÿusingÿtheÿdefaultÿmailÿclient.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        HyperlinksÿandÿDrill-DownÿSample

        TheÿHyperlinksÿandÿDrill-DownsÿSampleÿdemonstratesÿusingÿhyperlinksÿandÿtheÿviewerÿhyperlinkÿeventÿtoÿ simulateÿdrill-downÿfromÿoneÿreportÿtoÿanother.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ179 iListÿBindingÿSample

        TheÿiListBindingÿSampleÿdemonstratesÿhowÿtoÿbindÿreportsÿtoÿobjects.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        PrintÿMultipleÿPagesÿPerÿSheetÿSample

        TheÿPrintÿMultipleÿPagesÿPerÿSheetÿSampleÿdemonstratesÿhowÿtoÿprintÿmultipleÿpagesÿofÿaÿreportÿonÿaÿsingleÿ sheetÿofÿpaperÿusingÿpageÿscaling.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        RDFÿFileÿViewerÿSample

        TheÿRDFÿFileÿViewerÿSampleÿdemonstratesÿcustomizingÿtheÿWinFormsÿviewerÿcontrolÿtoolbar,ÿloadingÿReportÿ DocumentÿFilesÿ(RDF)ÿandÿusingÿtheÿexportÿfilters.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        ReportÿAssembliesÿSample

        TheÿReportÿAssembliesÿSampleÿdemonstratesÿdistributingÿreportsÿasÿseparateÿassemblyÿfilesÿandÿcallingÿthemÿ fromÿtheÿmainÿapplicationÿ.exeÿfile.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        SubreportsÿSample

        TheÿSubReportsÿSampleÿshowsÿtheÿproperÿuseÿofÿReportsÿwithÿSubReportsÿtoÿminimizeÿmemoryÿusage.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ180

        UnboundÿDataÿSample

        TheÿUnboundÿDataÿSampleÿdemonstratesÿretrievingÿdataÿfromÿanÿarrayÿandÿfromÿaÿtextÿfileÿinÿunboundÿmode.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        XMLÿDataÿSample

        TheÿXMLÿDataÿSampleÿdemonstratesÿtheÿXMLÿdataÿsourceÿandÿusingÿitÿtoÿrunÿmulti -levelÿreportsÿwithÿandÿ withoutÿusingÿsubreports.

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        ProfessionalÿEditionÿSamples

        ASP.NETÿWebÿSample DemonstratesÿtheÿuseÿofÿProfessionalÿEditionÿASP.NETÿfeatures,ÿincludingÿRPXÿHTTPÿHandlers,ÿReportÿ CachingÿandÿtheÿServerÿViewerÿControl.ÿ End-UserÿReportÿDesignerÿControl DemonstratesÿaÿcustomÿEnd-UserÿReportÿDesigner thatÿcanÿbeÿintegratedÿinÿyourÿapplicationsÿtoÿallowÿ ÿ usersÿtoÿmodifyÿreportÿlayouts.ÿ

        ASP.NETÿWebÿSample

        TheÿASP.NETÿWebÿSampleÿdemonstratesÿtheÿuseÿofÿProfessionalÿEditionÿASP.NETÿfeatures,ÿincludingÿHTTPÿ Handlers,ÿReportÿCaching,ÿandÿtheÿServerÿViewerÿControl. Note Theÿwebÿsamplesÿwillÿneedÿtoÿbeÿconfiguredÿusingÿtheÿauto-configurationÿutilityÿorÿconfiguredÿ manuallyÿbeforeÿtheÿsamplesÿcanÿbeÿrunÿ(seeÿManuallyÿConfiguringÿWebÿSamples forÿhelp).ÿAlso,ÿ theÿASP.NETÿuserÿmachineÿwillÿneedÿtoÿhaveÿASP.NETÿwriteÿaccessÿbeforeÿrunningÿtheÿsamplesÿorÿanÿ exceptionÿmayÿbeÿthrownÿduringÿexecution.ÿ

        Toÿrunÿthisÿsample 1. Openÿtheÿsampleÿfolderÿatÿ\Samplesÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        End-UserÿReportÿDesignerÿSample

        TheÿEnd-UserÿReportÿDesigner Sampleÿdemonstratesÿaÿcustomÿend-userÿreportÿdesignerÿthatÿcanÿbeÿ integratedÿinÿyourÿapplicationsÿtoÿallowÿusersÿtoÿmodifyÿreportÿlayouts.

        Toÿrunÿthisÿsample ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ181

        1. Openÿtheÿsampleÿfolderÿatÿ\Samples\ProfessionalÿEditionÿ

        2.ÿ Openÿtheÿ.slnÿfile.ÿ 3. PressÿF5 toÿstartÿtheÿapplication.ÿ

        Walkthroughs

        LearnÿhowÿtoÿcreateÿvariousÿapplicationsÿinÿC#ÿandÿVisualÿBasicÿ.NET--oneÿstepÿatÿaÿtime.

        Inÿthisÿsection StandardÿEditionÿWalkthroughs Thisÿsectionÿincludesÿstep-by-stepÿinstructionsÿforÿcreatingÿapplicationsÿinÿtheÿStandardÿeditionÿofÿ ActiveReportsÿforÿ.NETÿ3.0.ÿ ProfessionalÿEditionÿWalkthroughs Thisÿsectionÿincludesÿstep-by-stepÿinstructionsÿforÿcreatingÿapplicationsÿusingÿfeaturesÿavailableÿinÿtheÿ ProfessionalÿeditionÿofÿActiveReportsÿforÿ.NETÿ3.0.ÿ

        AdditionalÿInformation Samples ActiveReportsÿincludesÿmanyÿsamplesÿwhichÿdemonstrateÿapplicationsÿtheÿdevelopersÿcreatedÿforÿ ActiveReports.ÿTheseÿsamplesÿshowÿtheÿuseÿofÿaÿcombinationÿofÿcontrolsÿandÿcodeÿtoÿproduceÿvariousÿ ÿ reports.ÿ

        StandardÿEditionÿWalkthroughs

        Walkthroughsÿgiveÿbasicÿstep-by-stepÿinstructionsÿforÿcommonÿsituationsÿinÿActiveReports.ÿThisÿfeatureÿ makesÿwalkthroughsÿanÿexcellentÿwayÿtoÿlearnÿmoreÿaboutÿtheÿbasicÿfeaturesÿofÿtheÿproduct.ÿForÿmostÿ walkthroughs,ÿitÿisÿassumedÿthatÿreferencesÿtoÿtheÿDataDynamics.ActiveReportsÿandÿ DataDynamics.ActiveReports.Documentÿnamespacesÿhaveÿbeenÿaddedÿtoÿtheÿproject.

        Inÿthisÿsection AddressÿLabels Describesÿhowÿtoÿprintÿlabelsÿusingÿcolumns.ÿ Bookmarks DescribesÿhowÿtoÿsetÿupÿBookmarksÿtoÿorganizeÿreportsÿforÿeasyÿnavigation.ÿ CalculatedÿFields Describesÿhowÿtoÿuseÿaÿfield'sÿDataFieldÿpropertyÿtoÿperformÿcalculationsÿinÿaÿreport.ÿ Charts DescribesÿhowÿtoÿuseÿtheÿChartÿcontrolÿinÿaÿreport.ÿ ColumnarÿReports Describesÿhowÿtoÿformatÿaÿreportÿtoÿuseÿcolumns.ÿ CustomÿControlsÿandÿChartFX DescribesÿhowÿtoÿChartFXÿasÿaÿcustomÿcontrolÿwithÿActiveReports.ÿ CustomizingÿtheÿViewerÿControl Describesÿhowÿtoÿcustomizeÿtheÿviewerÿcontrolÿinÿaÿreport.ÿ DataÿBoundÿReports DescribesÿhowÿtoÿconnectÿaÿreportÿtoÿaÿdataÿsourceÿusingÿtheÿDataSourceÿicon.ÿ DatasetsÿContainingÿRelationshipsÿwithÿSubreports Describesÿhowÿtoÿuseÿdatasetsÿcontainingÿrelationshipsÿwithÿsubreports.ÿ DeployingÿCompiledÿReports Describesÿhowÿtoÿdeployÿcompiledÿreports.ÿ ExportingÿOutput ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ182

        Describesÿhowÿtoÿuseÿexportÿfiltersÿtoÿmakeÿreportsÿavailableÿinÿotherÿformats.ÿ GreenÿBarÿReports Describesÿhowÿtoÿuseÿbackgroundÿcolorÿtoÿcreateÿaÿgreenÿbarÿreport.ÿ GroupingÿData Describesÿhowÿtoÿincorporateÿgroupingÿinÿaÿreport.ÿ Hyperlinks Describesÿtheÿincorporationÿandÿfunctionÿofÿhyperlinksÿinÿaÿreport.ÿ Localization DescribesÿhowÿtoÿlocalizeÿActiveReports.ÿ MasterÿDetailÿReports Describesÿhowÿtoÿimplementÿmasterÿdetailÿreports.ÿ ModifyingÿReportÿDocuments Describesÿseveralÿmethodsÿofÿmodifyingÿreportÿdocuments.ÿ PageÿNumbering Describesÿhowÿtoÿuseÿpageÿnumberingÿinÿtheÿpageÿfooterÿandÿinÿtheÿgroupÿheader.ÿ Parameters Describesÿhowÿtoÿuseÿparametersÿwithÿsimpleÿreportsÿandÿsubreports.ÿ Printing Describesÿhowÿtoÿuseÿdifferentÿprintingÿfunctionsÿinÿaÿreport.ÿ RichÿText DescribesÿhowÿtoÿuseÿRichÿText,ÿfieldÿmerging,ÿandÿHTMLÿinÿaÿreport.ÿ Run-TimeÿReporting Describesÿhowÿtoÿcreateÿdynamicÿreportsÿatÿrunÿtime.ÿ SavingÿandÿLoadingÿtoÿaÿMemoryÿStream Describesÿhowÿtoÿsaveÿreportsÿtoÿandÿloadÿreportsÿfromÿaÿmemoryÿstream.ÿ Scripting Describesÿhowÿtoÿuseÿscriptingÿtoÿgenerateÿstand-aloneÿreports,ÿincludingÿsubreports.ÿ SpreadBuilder DescribesÿhowÿtoÿuseÿtheÿSpreadBuilderÿtoÿcreateÿExcelÿfiles.ÿ StyleÿSheets Describesÿhowÿtoÿuseÿstyleÿsheetsÿinÿaÿreport.ÿ Subreports Describesÿhowÿtoÿaddÿsubreportsÿtoÿaÿreport.ÿ SummaryÿFields Describesÿhowÿtoÿaddÿsummaryÿfieldsÿtoÿaÿreportÿtoÿcalculateÿtotals,ÿcounts,ÿaveragesÿandÿotherÿ aggregations.ÿ TopÿNÿReports Describesÿhowÿtoÿdisplayÿtheÿtopÿtenÿcustomersÿinÿaÿreport.ÿ UnboundÿReports DescribesÿtheÿbasicsÿofÿusingÿtheÿData_InitializeÿandÿFetch_Dataÿeventsÿtoÿconnectÿaÿreportÿtoÿaÿdataÿ ÿ source.ÿ

        AddressÿLabels

        ActiveReportsÿcanÿbeÿusedÿtoÿprintÿanyÿlabelÿsizeÿbyÿusingÿtheÿnewspaperÿcolumnÿlayout. Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿreportÿthatÿprintsÿlabelsÿtoÿaÿlaserÿprinterÿlabelsÿsheetÿandÿ toÿrepeatÿlabelsÿusingÿtheÿLayoutActionÿproperty.ÿTheÿlabelsÿinÿthisÿexampleÿareÿ1"ÿxÿ2.5"ÿandÿprintÿ30ÿlabelsÿ perÿ8½"ÿxÿ11"ÿsheet.ÿ Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ183

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Addingÿcodeÿtoÿtheÿdetail_Formatÿeventÿtoÿrepeatÿlabelsÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿ C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptLabels.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ184

        3. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿicon inÿtheÿDetailÿsection toÿopenÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿÿ 3. ClickÿtheÿBuild button.ÿ 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"SelectÿContactName,ÿCompanyName,ÿAddress,ÿCity,ÿPostalCode,ÿCountryÿFROMÿ Customers".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. RemoveÿtheÿPageHeaderÿandÿFooterÿsectionsÿfromÿtheÿreportÿbyÿright-clickingÿinÿtheÿPageHeaderÿsectionÿ andÿselectingÿ"Delete."ÿ 2. InÿtheÿReportÿmenu,ÿclickÿSettings andÿchangeÿtheÿmarginsÿasÿfollows:ÿ ¡ Topÿmargin:ÿ0.5ÿ

        ¡ Bottomÿmargin:ÿ0.5ÿ ¡ Leftÿmargin:ÿ0.2ÿ ¡ Rightÿmargin:ÿ0.2ÿ 3. SelectÿrptLabelsÿinÿtheÿVisualÿStudioÿPropertiesÿWindowÿandÿSetÿtheÿPrintWidth propertyÿofÿtheÿreportÿ toÿ8.1 (theÿwidthÿofÿtheÿlabelÿsheetÿlessÿtheÿLeftÿandÿRightÿmargins).ÿ 4. Clickÿonÿtheÿdetailÿsectionÿofÿtheÿreportÿtoÿselectÿitÿandÿmakeÿtheÿfollowingÿchanges:ÿ ¡ SetÿtheÿCanGrow andÿCanShrink propertiesÿtoÿFalseÿ

        ¡ ChangeÿtheÿColumnCount propertyÿtoÿ3 ¡ ChangeÿtheÿColumnDirection propertyÿtoÿAcrossDown ¡ SetÿtheÿColumnSpacing propertyÿtoÿ0.2

        ¡ SetÿtheÿheightÿofÿtheÿDetailÿsectionÿtoÿ1ÿ(theÿheightÿofÿtheÿlabel) 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿText andÿLocation propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        ContactName ContactÿNameÿ 0,ÿ0ÿ

        CompanyNameÿ CompanyÿNameÿ 0,ÿ0.198ÿ

        Address Address 0,ÿ0.396

        City City 0,ÿ0.594

        PostalCode PostalÿCode 0,ÿ0.792

        Country Country 1.5,ÿ0.792

        ÿ Notes: WhenÿyouÿdragÿaÿfieldÿfromÿtheÿReportÿExplorerÿontoÿtheÿdesignÿsurfaceÿofÿtheÿ report,ÿtheÿDataField andÿName propertiesÿofÿtheÿtextboxÿobjectÿareÿautomaticallyÿsetÿtoÿtheÿfield.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ185

        Addingÿcodeÿtoÿtheÿdetail_Formatÿeventÿtoÿrepeatÿlabels

        Toÿaddÿcodeÿtoÿtheÿtheÿdetail_Formatÿevent 1. Double-clickÿinÿtheÿdetailÿsectionÿtoÿcreateÿaÿDetail_Formatÿeventÿ 2. Addÿtheÿfollowingÿcodeÿtoÿtheÿeventÿtoÿrepeatÿeachÿlabelÿacrossÿallÿthreeÿcolumns.ÿ 'ÿVisualÿBasic PrivateÿSubÿDetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail.Format 'printÿeachÿlabelÿthreeÿtimes StaticÿcounterÿAsÿInteger counterÿ=ÿcounterÿ+ÿ1 Ifÿcounterÿ<=ÿ2ÿThen Me.LayoutActionÿ=ÿ3 Else Me.LayoutActionÿ=ÿ7 counterÿ=ÿ0 EndÿIf EndÿSub //C# intÿcounter=0;ÿ privateÿvoidÿDetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { //printÿeachÿlabelÿthreeÿtimes counterÿ=ÿcounterÿ+ÿ1;ÿ ifÿ(counterÿ<=ÿ2)ÿ {ÿ this.LayoutActionÿ=ÿÿLayoutAction.MoveLayout|LayoutAction.PrintSection;ÿ }ÿ elseÿ {ÿ this.LayoutActionÿ=ÿLayoutAction.MoveLayout|LayoutAction.NextRecord|LayoutAction ÿ .PrintSection;ÿ counterÿ=ÿ0;ÿ } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿyourÿWindowsÿformÿandÿsetÿitsÿDock propertyÿtoÿFill.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿ ofÿtheÿdesigner.

        BookmarksÿWalkthroughs

        SettingÿupÿBookmarksÿ(formerlyÿcalledÿTableÿofÿContents)ÿallowsÿreportsÿtoÿbeÿorganizedÿandÿeasilyÿ navigated.ÿByÿdefault,ÿnoÿBookmarksÿareÿcreatedÿwhenÿaÿreportÿisÿrun.ÿHowever,ÿbyÿaddingÿsimpleÿcodeÿtoÿ theÿdesiredÿsectionÿevent,ÿBookmarkÿentriesÿcanÿbeÿsetÿupÿasÿtheÿreportÿruns. Note: OnlyÿaddÿbookmarksÿatÿtheÿPageÿlevelÿduringÿreportÿprocessing.ÿDoÿnotÿaddÿorÿremoveÿthemÿ usingÿtheÿBookmarksCollectionÿmethodsÿuntilÿafterÿtheÿdocumentÿisÿcompletelyÿloadedÿintoÿtheÿviewer.ÿ ThisÿisÿbecauseÿtheÿviewerÿclearsÿtheÿBookmarksCollectionÿandÿthenÿrecreatesÿitÿusingÿtheÿbookmarksÿ thatÿareÿcontainedÿinÿeachÿindividualÿpage. BookmarksÿwithÿGrouping DescribesÿhowÿBookmarksÿcanÿbeÿusedÿwithÿgrouping.ÿ BookmarksÿwithÿSimpleÿReports DescribesÿhowÿBookmarksÿcanÿbeÿusedÿwithÿsimpleÿreports.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ186

        BookmarksÿwithÿSubreports ÿ DescribesÿhowÿBookmarksÿcanÿbeÿusedÿwithÿsubreports.ÿ

        Walkthrough:ÿBookmarksÿwithÿGrouping

        ActiveReportsÿallowsÿBookmarksÿtoÿbeÿeasilyÿsetÿupÿandÿusedÿwithÿgroupingÿbyÿaddingÿcodeÿtoÿtheÿ Detail_FormatÿeventÿofÿtheÿreportÿandÿinÿtheÿgroupÿheaderÿFormatÿevent. ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿandÿuseÿBookmarksÿwithÿgroupingÿinÿaÿreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities: l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿcodeÿtoÿtheÿDetail_Formatÿeventÿ

        l AddingÿcodeÿtoÿtheÿGroupHeader_Formatÿeventÿ l PreviewingÿtheÿreportÿandÿBookmarksÿcollectionÿinÿtheÿdesignerÿ

        l Viewingÿtheÿreportÿÿ

        l ViewingÿtheÿBookmarksÿcollectionÿ l Addingÿspecialÿbookmarksÿatÿrunÿtimeÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ187

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptBookmarkGroup.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿorderÿbyÿcountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ188

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptBookmarkGroupÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghCustomersÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿRosyBrownÿÿ

        ¡ ChangeÿtheÿDataField propertyÿtoÿCountryÿ 3. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldÿontoÿ theÿGroupHeaderÿsectionÿandÿsetÿtheÿText andÿLocation propertiesÿofÿtheÿcreatedÿtextboxÿasÿindicated.ÿ

        Field Text Location

        Countryÿ Countryÿ 0,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Location

        CompanyName CompanyÿName 0,ÿ0

        City City 2.375,ÿ0

        ÿ

        AddingÿcodeÿtoÿtheÿDetail_Formatÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptBookmarkGroup.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptBookmarkGroup'sÿDetail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿupÿaÿbookmarkÿforÿeachÿcityÿ

        l Nestÿcityÿbookmarksÿwithinÿeachÿcountry

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptBookmarkGroup.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptBookmarkGroup'sÿDetail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Setÿupÿaÿbookmarkÿforÿeachÿcityÿ l Nestÿcityÿbookmarksÿwithinÿeachÿcountry Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail1.AddBookmark(txtCountry1.Textÿ+ÿ"\"ÿ+ÿtxtCity1.Textÿ+ÿ"\"ÿ+ÿ_ txtCompanyName1.Text) EndÿSub //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { detail1.AddBookmark(txtCountry1.Textÿ+ÿ"\\"ÿ+ÿtxtCity1.Textÿ+ÿ"\\"ÿ+ÿ txtCompanyName1.Text); }

        AddingÿcodeÿtoÿtheÿghCustomers_Formatÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿinÿtheÿGroupÿHeaderÿsectionÿofÿrptBookmarkGroup.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿ forÿrptBookmarkGroup'sÿghCustomers_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ189

        l Setÿupÿaÿbookmarkÿforÿeachÿcountry ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿinÿtheÿGroupÿHeaderÿsectionÿofÿrptBookmarkGroup.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿ forÿrptBookmarkGroup'sÿghCustomers_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿupÿaÿbookmarkÿforÿeachÿcountry Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿghCustomers_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿghCustomers.Format Me.ghCustomers.AddBookmark(txtCountry1.Text) EndÿSub //C# privateÿvoidÿghCustomers_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.ghCustomers.AddBookmark(txtCountry1.Text); }

        PreviewingÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner

        ToÿpreviewÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner 1. Clickÿtheÿ"Preview"ÿtabÿatÿtheÿbottomÿofÿtheÿdesigner.ÿ 2. Clickÿonÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        ViewingÿtheÿreportÿandÿBookmarksÿCollectionÿatÿrunÿtime

        Toÿviewÿtheÿreportÿatÿrunÿtime 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿyourÿWindowsÿform.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ 3. PressÿF5 toÿrunÿtheÿreport.ÿ 4. Clickÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        AddingÿSpecialÿBookmarksÿatÿRunÿTime Toÿcreateÿandÿaddÿspecialÿbookmarksÿtoÿtheÿbookmarksÿcollectionÿatÿrunÿtime,ÿaddÿtheÿbookmarksÿtoÿtheÿ reportÿdocument'sÿpagesÿcollectionÿsinceÿtheÿbookmarksÿareÿgeneratedÿfromÿtheÿpagesÿcollection. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿiÿAsÿInteger Try Forÿiÿ=ÿ0ÿToÿMe.Document.Pages.Countÿ - 1 Me.Document.Pages(1).AddBookmark("NewÿBookmark",ÿ8) Next CatchÿexÿAsÿException ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ190

        EndÿTry EndÿSub

        //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { for(intÿiÿ=ÿ0;ÿi

        Walkthrough:ÿBookmarksÿwithÿSimpleÿReports

        ActiveReportsÿallowsÿBookmarksÿtoÿbeÿeasilyÿsetÿupÿandÿusedÿinÿsimpleÿreportsÿbyÿaddingÿcodeÿtoÿtheÿ Detail_Formatÿeventÿofÿtheÿreport. ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿandÿuseÿBookmarksÿinÿaÿsimpleÿreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities: l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿcodeÿtoÿtheÿDetailÿFormatÿeventÿtoÿsetÿupÿbookmarksÿ

        l Viewingÿtheÿreportÿÿ

        l ViewingÿtheÿBookmarksÿcollectionÿwithÿtheÿreportÿ l Addingÿspecialÿbookmarksÿatÿrunÿtimeÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ191

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptBookmarks.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcategoriesÿinnerÿjoinÿproductsÿonÿcategories.categoryidÿ=ÿ products.categoryidÿorderÿbyÿcategoryname,ÿproductname".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ192

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport l InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        DataField Text Location

        ProductName ProductÿName 1.125,ÿ0

        CategoryName CategoryÿName 0,ÿ0

        UnitsInStock UnitsÿInÿStock 2.25,ÿ0

        UnitsOnOrder UnitsÿOnÿOrder 3.375,ÿ0

        UnitPrice UnitÿPrice 4.5,ÿ0

        l SetÿtheÿBackColor propertyÿofÿtheÿdetailÿsectionÿtoÿThistle.ÿ l SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.

        AddingÿcodeÿtoÿtheÿDetail_Formatÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿonÿtheÿdetailÿsectionÿofÿtheÿreport.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptBookmarks'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l SetÿupÿBookmarksÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿonÿtheÿdetailÿsectionÿofÿtheÿreport.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptBookmarks'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l SetÿupÿBookmarksÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail1.AddBookmark(txtCategoryName1.text) EndÿSub //C# privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { detail1.AddBookmark(txtCategoryName1.Text); } Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿtoÿsetÿupÿleveledÿorÿ nestedÿBookmarks. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail1.AddBookmark(txtCategoryName1.Textÿ+ÿ"\"ÿ+ÿtxtProductName1.Text) EndÿSub //C# privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { detail1.AddBookmark(txtCategoryName1.Textÿ+ÿ"\\"ÿ+ÿtxtProductName1.Text); }

        PreviewingÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner

        ToÿpreviewÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner 1. Clickÿtheÿ"Preview"ÿtabÿatÿtheÿbottomÿofÿtheÿdesigner.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ193

        2. Clickÿonÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        ViewingÿtheÿreportÿandÿBookmarksÿCollectionÿatÿrunÿtime

        Toÿviewÿtheÿreportÿatÿrunÿtime 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿyourÿWindowsÿform.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ 3. PressÿF5 toÿrunÿtheÿreport.ÿ 4. Clickÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        AddingÿSpecialÿBookmarksÿatÿRunÿTime Toÿcreateÿandÿaddÿspecialÿbookmarksÿtoÿtheÿbookmarksÿcollectionÿatÿrunÿtime,ÿyouÿwillÿneedÿtoÿaddÿtheÿ bookmarksÿtoÿtheÿreportÿdocument'sÿpagesÿcollectionÿsinceÿtheÿbookmarksÿareÿgeneratedÿfromÿtheÿpagesÿ collection. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿiÿAsÿInteger Try Forÿiÿ=ÿ0ÿToÿMe.Document.Pages.Countÿ - 1 Me.Document.Pages(1).AddBookmark("NewÿBookmark",ÿ8) Next CatchÿexÿAsÿException EndÿTry EndÿSub //C#

        privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { for(intÿiÿ=ÿ0;ÿi

        Walkthrough:ÿBookmarksÿwithÿSubreports

        ActiveReportsÿallowsÿBookmarksÿtoÿbeÿeasilyÿsetÿupÿandÿusedÿinÿsubreportsÿbyÿaddingÿcodeÿtoÿtheÿ Detail_Formatÿeventÿofÿtheÿparentÿandÿchildÿreports. ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿandÿuseÿBookmarksÿinÿaÿsubreport. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ194

        Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities: l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ l ConnectingÿrptMainÿtoÿaÿdataÿsourceÿ

        l AddingÿcontrolsÿtoÿrptMainÿtoÿcontainÿdataÿ l AddingÿcontrolsÿtoÿrptSubÿtoÿcontainÿdataÿ

        l Addingÿtheÿcodeÿneededÿtoÿsaveÿtheÿcurrentÿrecord'sÿCategoryIDÿtoÿuseÿinÿtheÿrptSub'sÿSQLÿqueryÿ

        l AddingÿtheÿcodeÿtoÿcreateÿaÿdataÿsourceÿforÿrptÿMainÿandÿpassÿitÿtoÿrptSubÿ l AddingÿcodeÿtoÿtheÿDetailÿFormatÿeventÿofÿrptMainÿtoÿsetÿupÿbookmarksÿ

        l AddingÿcodeÿtoÿtheÿDetailÿFormatÿeventÿofÿrptSubÿÿtoÿsetÿupÿbookmarksÿ l Viewingÿtheÿreportÿÿ l ViewingÿtheÿBookmarksÿcollectionÿwithÿtheÿreportÿ

        l Addingÿspecialÿbookmarksÿatÿrunÿtimeÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ195

        2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMain.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptSub.ÿ 7. ClickÿOpen.ÿ

        ConnectingÿrptMainÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿparentÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿofÿrptMainÿtoÿopenÿtheÿreportÿDataSourceÿ dialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcategories."ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        AddingÿcontrolsÿtoÿrptMainÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptMain:ÿ

        Control DataField Name Text Location Miscellaneous

        Label lblProductName Productÿ 0,ÿ0.31 Name:ÿ

        Label lblCategoryName Categoryÿ 0,ÿ0ÿ Name:ÿ

        TextBox CategoryNameÿ txtCategoryName1 CategoryNameÿ 1.25,ÿ0ÿ Bold; ForeColorÿ=ÿ DarkGreen

        Subreport ctlSubreport 1.25,ÿ 0.31ÿ

        2. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ

        AddingÿaÿcontrolÿtoÿrptSubÿtoÿcontainÿdata

        Toÿaddÿaÿcontrolÿtoÿtheÿreport 1. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ 2. SetÿtheÿBackColor propertyÿofÿtheÿDetailÿsectionÿtoÿDarkSeaGreen.ÿ 3. AddÿtheÿfollowingÿcontrolÿtoÿtheÿDetailÿsectionÿofÿrptSub:ÿ

        Control DataField Name Text Location Miscellaneous

        TextBox ProductName txtProductName ProductName 0,ÿ0 Sizeÿ=ÿ3,ÿ0.19

        Addingÿtheÿcodeÿneededÿtoÿsaveÿtheÿcurrentÿrecord'sÿcategoryID

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ196

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptMain,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptMain,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ (BaseÿClassÿEvents )ÿ(orÿ(rptMainÿevents)ÿinÿVisualÿStudioÿ2005).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿ theÿdrop-downÿarrowÿandÿselectÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptMain'sÿ FetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Saveÿtheÿcurrentÿrecord'sÿcategoryIDÿtoÿuseÿinÿtheÿsubreport'sÿSQLÿqueryÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿgrayÿareaÿbelowÿrptMainÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptMain'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Saveÿtheÿcurrentÿrecord'sÿcategoryIDÿtoÿuseÿinÿtheÿsubreport'sÿSQLÿqueryÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic Dimÿm_categoryIDÿAsÿString PrivateÿSubÿrptMain_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamicsÿ_ .ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData m_categoryIDÿ=ÿMe.Fields("CategoryID").Value EndÿSub //C# stringÿm_categoryID; privateÿvoidÿrptMain_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3 .FetchEventArgsÿeArgs) { m_categoryIDÿ=ÿFields["CategoryID"].Value.ToString(); }

        AddingÿtheÿcodeÿtoÿcreateÿaÿdataÿsourceÿforÿrptMainÿandÿpassÿitÿtoÿrptSub

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC#

        l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptMain.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptMain'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        ¡ CreateÿaÿnewÿDataDynamicsÿOleDBDataSourceÿ ¡ Setÿtheÿconnectionÿstringÿ ¡ SetÿtheÿSQLÿqueryÿ

        ¡ Passÿtheÿnewÿdataÿsourceÿtoÿtheÿsubreport Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿrptÿAsÿNewÿrptSub() DimÿsubDSÿAsÿNewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource() subDS.ConnectionStringÿ=ÿMe.DataSource.ConnectionString subDS.SQLÿ=ÿ"Selectÿ*ÿfromÿproductsÿwhereÿcategoryIDÿ=ÿ"ÿ+ÿm_categoryID rpt.DataSourceÿ=ÿsubDS Me.ctlSubreport.Reportÿ=ÿrpt EndÿSub //C# privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptSubÿrptÿ=ÿnewÿrptSub(); DataDynamics.ActiveReports.DataSources.OleDBDataSourceÿsubDSÿ=ÿnewÿDataDynamics. ActiveReports.DataSources.OleDBDataSource(); subDS.ConnectionStringÿ=ÿthis.DataSource.ConnectionString; subDS.SQLÿ=ÿ"Selectÿ*ÿfromÿproductsÿwhereÿcategoryIDÿ=ÿ"ÿ+ÿm_categoryID; rpt.DataSourceÿ=ÿsubDS; ctlSubReport.Reportÿ=ÿrpt; } ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ197

        AddingÿcodeÿtoÿtheÿDetailÿFormatÿeventÿforÿbothÿreports

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptMainÿtoÿreturnÿtoÿtheÿreport'sÿDetailÿFormatÿevent.ÿ

        l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptSub.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿreport'sÿDetailÿ Formatÿevent.ÿÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptMainÿtoÿreturnÿtoÿtheÿreport'sÿDetailÿFormatÿevent.ÿ

        l Double-clickÿinÿtheÿDetailÿsectionÿofÿrptSub.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿreport'sÿDetailÿ Formatÿevent.ÿÿÿ

        l TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿforÿrptMain. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail1.AddBookmark(txtCategoryName1.text) EndÿSub //C# privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { detail.AddBookmark(txtCategoryName1.Text); } TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿforÿrptSub. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail.AddBookmark(CType(Me.ParentReport.Sections("Detail1").Controlsÿ_ ("txtCategoryName1"),ÿTextBox).Textÿ+ÿ"\"ÿ+ÿMe.txtProductName1.Text) EndÿSub //C# privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.detail1.AddBookmark(((TextBox)(this.ParentReport.Sections["Detail1"].Controls ["txtCategoryName1"])).Textÿ+ÿ"\\"ÿ+ÿthis.txtProductName1.Text); }

        PreviewingÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner

        ToÿpreviewÿtheÿreportÿandÿBookmarksÿCollectionÿinÿtheÿdesigner 1. Clickÿtheÿ"Preview"ÿtabÿatÿtheÿbottomÿofÿtheÿdesigner.ÿ 2. Clickÿonÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        ViewingÿtheÿreportÿandÿBookmarksÿCollectionÿatÿrunÿtime

        Toÿviewÿtheÿreportÿatÿrunÿtime 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿyourÿWindowsÿform.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ 3. PressÿF5 toÿrunÿtheÿreport.ÿ 4. Clickÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ198

        AddingÿSpecialÿBookmarksÿatÿRunÿTime Toÿcreateÿandÿaddÿspecialÿbookmarksÿtoÿtheÿbookmarksÿcollectionÿatÿrunÿtime,ÿyouÿwillÿneedÿtoÿaddÿtheÿ bookmarksÿtoÿtheÿreportÿdocument'sÿpagesÿcollectionÿsinceÿtheÿbookmarksÿareÿgeneratedÿfromÿtheÿpagesÿ collection. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿiÿAsÿInteger Try Forÿiÿ=ÿ0ÿToÿMe.Document.Pages.Countÿ - 1 Me.Document.Pages(1).AddBookmark("NewÿBookmark",ÿ8) Next CatchÿexÿAsÿException EndÿTry EndÿSub //C#

        privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { for(intÿiÿ=ÿ0;ÿi

        Walkthrough:ÿCalculatedÿFields

        ActiveReportsÿallowsÿyouÿtoÿuseÿtheÿDataFieldÿpropertyÿofÿaÿtextboxÿtoÿperformÿcalculationsÿbasedÿonÿtheÿ valueÿofÿspecificÿdataÿfields.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿreportÿusingÿcalculatedÿfields. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿrun-timeÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ199

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCalFields.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"SelectÿCustomers.CompanyName,ÿProducts.ProductName,ÿ[Orderÿ Details].UnitPrice,ÿ[OrderÿDetails].QuantityÿFROMÿProductsÿINNERÿJOINÿ((CustomersÿINNERÿJOINÿOrdersÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ200

        ONÿCustomers.CustomerIDÿ=ÿOrders.CustomerID)ÿINNERÿJOINÿ[OrderÿDetails]ÿONÿOrders.OrderIDÿ=ÿ [OrderÿDetails].OrderID)ÿONÿProducts.ProductIDÿ=ÿ[OrderÿDetails].ProductIDÿWHEREÿ(((DatePart("yyyy",ÿ [OrderDate]))ÿ=ÿ1996))ÿORDERÿBYÿCustomers.CompanyName,ÿProducts.ProductName".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCalFields.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProducts

        ¡ ChangeÿtheÿDataField propertyÿtoÿCompanyName ¡ ChangeÿtheÿBackColor propertyÿtoÿGainsboro

        ¡ ChangeÿtheÿHeightÿpropertyÿtoÿ5.5 toÿaccommodateÿtheÿlabels 3. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Section OutputFormat Text Location

        CompanyNameÿ ghProductsÿ NAÿ CompanyÿNameÿ 0,ÿ0ÿ

        ProductName Detailÿ NAÿ ProductÿNameÿ 0,ÿ0

        Quantity Detailÿ NA Quantity 2.2,ÿ0

        UnitPrice Detailÿ Currency UnitÿPrice 3.5,ÿ0

        4. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ 5. AddÿtheÿfollowingÿcontrolsÿfromÿtheÿActiveReportsÿ3.0ÿtoolboxÿtoÿghProductsÿandÿmakeÿtheÿpropertyÿ changesÿasÿindicated:ÿ

        Control Name Location Text

        Label lblProductName 0,ÿ0.3 ProductÿName

        Label lblQuantityÿ 2.2,ÿ0.3 Quantity

        Label lblUnitPrice 3.5,ÿ0.3 UnitÿPriceÿ

        Label lblTotalPrice 5,ÿ0.3 TotalÿPrice

        6. InÿtheÿReportÿExplorer,ÿright-clickÿonÿtheÿCalculatedÿnodeÿandÿselectÿ"Add"ÿfromÿtheÿshortcutÿmenu.ÿThisÿ createsÿanÿunboundÿfieldÿnamedÿ"field1"ÿthatÿcanÿbeÿusedÿtoÿperformÿcustomÿcalculations.ÿ 7. Makeÿtheÿfollowingÿchangesÿtoÿfield1ÿinÿtheÿPropertiesÿwindow:ÿ

        ¡ ChangeÿtheÿNameÿpropertyÿtoÿTotalPriceÿ ¡ ChangeÿtheÿFormula propertyÿtoÿQuantityÿ*ÿUnitPrice toÿbindÿitÿtoÿtheÿproductÿofÿtheÿQuantityÿandÿ UnitPriceÿfields 8. DragÿTotalPriceÿfromÿtheÿUnboundÿnodeÿontoÿtheÿdetailÿsectionÿofÿtheÿreport.ÿThisÿcreatesÿanÿ ActiveReportsÿTextBoxÿobject,ÿtxtTotalPrice1,ÿandÿsetsÿitsÿDataFieldÿpropertyÿequalÿtoÿTotalPrice.ÿ 9. MakeÿtheÿfollowingÿchangesÿtoÿtxtTotalPrice1:ÿ

        ¡ ChangeÿtheÿLocation propertyÿtoÿ"5,ÿ0"ÿ ¡ ChangeÿtheÿOutPutFormat propertyÿtoÿ"Currency"

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ201

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ChartÿWalkthroughs

        Chartsÿaddÿquickÿvisualÿimpactÿtoÿyourÿreports,ÿandÿallowÿdataÿtoÿbeÿreadilyÿgraspedÿevenÿbyÿcasualÿ readers.ÿWithÿaÿbuilt-inÿchartÿcontrol,ÿActiveReportsÿmakesÿitÿeasyÿtoÿprovideÿpremiumÿreportingÿwithoutÿtheÿ needÿtoÿpurchaseÿextraÿtools. ÿ BarÿChart ÿ Describesÿhowÿtoÿcreateÿaÿbarÿchartÿwhichÿcomparesÿitemsÿacrossÿcategories.ÿ 3DÿPieÿChart Describesÿhowÿtoÿcreateÿaÿthreeÿdimensionalÿpieÿchartÿwhichÿshowsÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿ contributesÿtoÿaÿtotalÿpercentage.ÿÿ FinancialÿChart Describesÿhowÿtoÿcreateÿaÿfinancialÿchartÿwhichÿletsÿyouÿplotÿhigh,ÿlow,ÿopening,ÿandÿclosingÿprices.ÿ SimpleÿUnboundÿChart ÿ Describesÿhowÿtoÿcreateÿaÿsimpleÿunboundÿchart.ÿ

        2DÿBarÿChart

        Barÿchartsÿareÿusefulÿinÿcomparingÿitemsÿacrossÿcategories. Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿbarÿchart. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Addingÿaÿchartÿcontrolÿtoÿtheÿreportÿ l Settingÿaÿdataÿsourceÿforÿtheÿchartÿ l Settingÿtheÿchart'sÿpropertiesÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ202

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptBarChart.ÿ 4. ClickÿOpen.ÿ

        Addingÿaÿchartÿcontrolÿtoÿtheÿreport

        Toÿaddÿaÿchartÿcontrolÿtoÿtheÿreport 1. Resizeÿtheÿsectionÿinÿwhichÿyouÿwantÿtoÿplaceÿtheÿchart.ÿ 2. ClickÿtheÿChartControlÿiconÿinÿtheÿActiveReportsÿtoolboxÿandÿdrawÿitÿontoÿtheÿreport. Note: Ifÿtheÿchartÿwizardÿappears,ÿclickÿCancel.ÿIfÿyouÿdoÿnotÿwantÿitÿtoÿappearÿeachÿtimeÿyouÿaddÿaÿ chart,ÿdeselectÿtheÿAutoÿRunÿWizardÿcheckbox.

        Settingÿaÿdataÿsourceÿforÿtheÿchart

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿDataÿSourceÿverbÿbelowÿtheÿPropertiesÿWindowÿtoÿopenÿtheÿ ChartÿDataSourceÿdialogÿbox.ÿ(Ifÿtheÿverbÿisÿnotÿvisible,ÿright-clickÿanÿemptyÿspaceÿinÿtheÿPropertiesÿ WindowÿandÿclickÿCommandsÿtoÿcheckÿthatÿoption.)ÿÿ 2. ClickÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿtoÿbrowseÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿselectedÿtheÿfile.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ203

        5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"SELECTÿShipCountry,ÿSUM(Freight)ÿASÿExpr1ÿFROMÿOrdersÿGROUPÿBYÿ ShipCountry."ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Settingÿtheÿchart'sÿproperties

        Toÿsetÿtheÿchart'sÿproperties 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿCustomize verbÿbelowÿtheÿPropertiesÿWindowÿtoÿopenÿtheÿ ChartÿDesignerÿdialogÿbox.ÿ 2. InÿtheÿChartAreas sectionÿwhichÿdisplaysÿbyÿdefault,ÿclickÿtoÿexpandÿtheÿAxes.ÿ 3. ClickÿAxisÿX,ÿandÿonÿtheÿCommon tabÿinÿtheÿpaneÿtoÿtheÿright,ÿtypeÿCountry inÿtheÿTitle textboxÿandÿ increaseÿtheÿfontÿsizeÿtoÿ12.ÿ 4. ChooseÿtheÿLabels tabÿinÿtheÿpaneÿonÿtheÿright,ÿandÿselectÿtheÿStaggeredÿLabels optionÿtoÿavoidÿ overlappingÿlabels.ÿ 5. ClickÿAxisÿY onÿtheÿleft,ÿandÿonÿtheÿCommon tabÿinÿtheÿpaneÿtoÿtheÿright,ÿtypeÿFreight inÿtheÿTitle textboxÿandÿincreaseÿtheÿfontÿsizeÿtoÿ12.ÿ 6. ClickÿtheÿTitles buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner.ÿ 7. TypeÿSimpleÿBarÿChart inÿtheÿCaption textboxÿonÿtheÿheaderÿtitle,ÿandÿincreaseÿtheÿfontÿsizeÿtoÿ14.ÿ 8. Clickÿtheÿfooterÿtitle inÿtheÿupperÿleftÿcornerÿofÿtheÿdialog,ÿandÿdeleteÿit.ÿ 9. ClickÿtheÿSeries buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner,ÿandÿclickÿSeries1 toÿselectÿit.ÿ 10. InÿtheÿDataÿBinding box,ÿsetÿXÿ(Name) toÿShipCountry,ÿandÿsetÿY toÿExpr1.ÿ 11. DeleteÿSeries2 andÿSeries3.ÿ 12. ClickÿtheÿLegend buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner.ÿ 13. DeselectÿtheÿVisible checkboxÿatÿtheÿtopÿofÿtheÿCommon tabÿtoÿhideÿtheÿlegend.ÿ 14. ClickÿtheÿFinish buttonÿtoÿexitÿtheÿChartÿDesigner.

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        3DÿPieÿChart

        Pieÿchartsÿareÿusefulÿinÿshowingÿhowÿtheÿpercentageÿofÿeachÿdataÿitemÿcontributesÿtoÿtheÿtotal.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿthreeÿdimensionalÿpieÿchart. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Addingÿaÿchartÿcontrolÿtoÿtheÿreportÿ l Addingÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchartÿ

        l Settingÿtheÿchart'sÿpropertiesÿ

        l Viewingÿtheÿreportÿÿ Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿchartÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ204

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNewÿ>ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrpt3DPieChart.ÿ 4. ClickÿOpen.ÿ

        Addingÿaÿchartÿcontrolÿtoÿtheÿreport

        Toÿaddÿaÿchartÿcontrolÿtoÿtheÿreport 1. Resizeÿtheÿsectionÿinÿwhichÿyouÿwantÿtoÿplaceÿtheÿchart.ÿ 2. ClickÿtheÿChartControlÿiconÿinÿtheÿActiveReportsÿtoolboxÿandÿdrawÿitÿontoÿtheÿreport.

        Addingÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchart

        Toÿaddÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchart 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿSeriesÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿSeriesÿCollectionÿEditor.ÿ 2. ClickÿSeries1ÿtoÿselectÿit.ÿ 3. UnderÿSeriesÿProperties,ÿchangeÿtheÿColorPaletteÿpropertyÿofÿtheÿnewÿseriesÿtoÿConfetti.ÿ 4. ChangeÿtheÿTypeÿpropertyÿtoÿDoughnut3D.ÿ 5. ClickÿtheÿPointsÿ(Collection)ÿproperty,ÿthenÿclickÿtheÿellipsisÿbuttonÿthatÿappears.ÿÿ 6. ClickÿAddÿtoÿaddÿaÿdataÿpoint,ÿsetÿitsÿLegendTextÿpropertyÿtoÿFigs,ÿandÿsetÿitsÿYÿvalueÿtoÿ19.ÿExpandÿtheÿ PropertiesÿandÿsetÿtheÿExplodeFactorÿtoÿ.5ÿtoÿpullÿthisÿsliceÿoutÿfromÿtheÿpie.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ205

        7. ClickÿAddÿtoÿaddÿanotherÿdataÿpoint,ÿsetÿitsÿLegendTextÿpropertyÿtoÿRaspberries,ÿandÿsetÿitsÿYValuesÿ propertyÿtoÿ15.ÿ 8. ClickÿAddÿtoÿaddÿanotherÿdataÿpoint,ÿsetÿitsÿLegendTextÿpropertyÿtoÿBlueberries,ÿandÿsetÿitsÿYValuesÿ propertyÿtoÿ37.ÿ 9. ClickÿAddÿtoÿaddÿanotherÿdataÿpoint,ÿsetÿitsÿLegendTextÿpropertyÿtoÿBananas,ÿandÿsetÿitsÿYValuesÿ propertyÿtoÿ21.ÿ 10. ClickÿOKÿtoÿreturnÿtoÿtheÿSeriesÿCollectionÿEditor.ÿ 11. RemoveÿSeries2ÿandÿSeries3.ÿ 12. ClickÿOKÿtoÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Settingÿtheÿchart'sÿproperties

        Toÿsetÿtheÿchart'sÿproperties 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿChartAreasÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿ thenÿclickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿChartAreaÿCollectionÿEditor.ÿ 2. ExpandÿtheÿProjectionÿpropertyÿandÿchangeÿtheÿVerticalRotationÿpropertyÿtoÿ50.ÿThisÿallowsÿyouÿtoÿseeÿ moreÿofÿtheÿtopÿofÿtheÿpie.ÿÿ 3. ClickÿOKÿtoÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 4. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿTitlesÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿTitleÿCollectionÿEditor.ÿ 5. Inÿtheÿheaderÿproperties,ÿchangeÿtheÿTextÿpropertyÿtoÿ"3DÿPieÿChart."ÿ 6. ExpandÿtheÿFontÿpropertyÿandÿsetÿtheÿSizeÿtoÿ14ÿtoÿmakeÿyourÿtitleÿstandÿoutÿmore.ÿ 7. Removeÿtheÿfooterÿtitle.ÿ 8. ClickÿOKÿtoÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        FinancialÿChart

        FinancialÿchartsÿareÿusefulÿforÿdisplayingÿstockÿinformationÿusingÿHigh,ÿLow,ÿOpenÿandÿCloseÿvalues.ÿÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿCandleÿchart. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Addingÿaÿchartÿcontrolÿtoÿtheÿreportÿ l Addingÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchartÿ

        l Settingÿtheÿchart'sÿpropertiesÿ l Viewingÿtheÿreportÿÿ Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿchartÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ206

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCandleChart.ÿ 4. ClickÿOpen.ÿ

        Addingÿaÿchartÿcontrolÿtoÿtheÿreport

        Toÿaddÿaÿchartÿcontrolÿtoÿtheÿreport 1. Resizeÿtheÿsectionÿinÿwhichÿyouÿwantÿtoÿplaceÿtheÿchart.ÿ 2. ClickÿtheÿChartControlÿiconÿinÿtheÿActiveReportsÿtoolboxÿandÿdrawÿitÿontoÿtheÿreport.

        Addingÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchart

        Toÿaddÿaÿseriesÿandÿdataÿpointsÿtoÿtheÿchart 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿSeriesÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿSeriesÿCollectionÿEditor.ÿ 2. ClickÿSeries1ÿtoÿselectÿit.ÿ 3. UnderÿSeriesÿProperties,ÿchangeÿtheÿType propertyÿtoÿCandle.ÿ 4. ExpandÿtheÿPropertiesÿandÿsetÿtheÿBodyDownswingBackdrop propertyÿtoÿ(Default)ÿsoÿthatÿyouÿcanÿ expandÿitÿandÿchangeÿtheÿcolorÿtoÿFuchsia.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ207

        5. SetÿtheÿBodyUpswingBackdrop propertyÿtoÿ(Default)ÿsoÿthatÿyouÿcanÿexpandÿitÿandÿchangeÿtheÿcolorÿtoÿ DarkViolet.ÿ 6. SetÿtheÿBodyWidthÿpropertyÿtoÿ5 toÿmakeÿtheÿopeningÿtoÿclosingÿfigureÿbar,ÿtheÿcandle,ÿwiderÿthanÿtheÿ wick.ÿ 7. SetÿtheÿWickLine propertyÿtoÿ(Default) forÿaÿblackÿwick.ÿ 8. ClickÿtheÿPointsÿ(Collection)ÿproperty,ÿthenÿclickÿtheÿellipsisÿbuttonÿthatÿappears.ÿÿ 9. ClickÿAddÿtoÿaddÿaÿdataÿpoint,ÿandÿsetÿitsÿYValues propertyÿtoÿ99;ÿ37;ÿ53;ÿ88.ÿ Note: TheÿfirstÿYValueÿisÿtheÿhighÿfigureÿorÿtopÿofÿtheÿwick;ÿtheÿsecondÿisÿtheÿlowÿfigure,ÿorÿbottomÿ ofÿtheÿwick;ÿtheÿthirdÿisÿtheÿopeningÿfigure;ÿtheÿfourthÿisÿtheÿclosingÿfigure.ÿÿIfÿtheÿfourthÿfigureÿisÿ higherÿthanÿtheÿthird,ÿtheÿcandleÿisÿDarkViolet,ÿtheÿBodyUpswingBackdrop. 10. ClickÿAdd toÿaddÿanotherÿdataÿpoint,ÿandÿsetÿitsÿYValues propertyÿtoÿ115;ÿ22;ÿ101;ÿ35.ÿ 11. ClickÿAdd toÿaddÿanotherÿdataÿpoint,ÿandÿsetÿitsÿYValues propertyÿtoÿ87;ÿ1;ÿ7;ÿ80.ÿ 12. ClickÿAdd toÿaddÿanotherÿdataÿpoint,ÿandÿsetÿitsÿYValues propertyÿtoÿ63;ÿ14;ÿ57;ÿ25.ÿ 13. ClickÿAdd toÿaddÿanotherÿdataÿpoint,ÿandÿsetÿitsÿYValues propertyÿtoÿ130;ÿ25;ÿ25;ÿ120.ÿ 14. ClickÿOK toÿreturnÿtoÿtheÿSeriesÿCollectionÿEditor.ÿ 15. SetÿtheÿLegendÿpropertyÿtoÿ(none).ÿ 16. RemoveÿSeries2ÿandÿSeries3.ÿ 17. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Settingÿtheÿchart'sÿproperties

        Toÿsetÿtheÿchart'sÿproperties 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿChartAreasÿ(Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿ thenÿclickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿChartAreaÿCollectionÿEditor.ÿ 2. InÿtheÿdefaultAreaÿproperties,ÿclickÿtheÿAxesÿ(Collection)ÿproperty,ÿthenÿclickÿtheÿellipsisÿbuttonÿthatÿ appearsÿtoÿopenÿtheÿAxisBaseÿCollectionÿEditor.ÿ 3. ClickÿtheÿAxisXÿmember,ÿandÿclickÿtheÿLabelsÿ(Collection)ÿproperty,ÿthenÿclickÿtheÿellipsisÿbuttonÿthatÿ appearsÿtoÿopenÿtheÿArrayÿDataÿEditor.ÿÿTypeÿtheÿfollowingÿintoÿtheÿeditor,ÿeachÿitemÿonÿaÿseparateÿlineÿasÿ shown:ÿ

        ¡ Mondayÿ ¡ Tuesdayÿ ¡ Wednesdayÿ

        ¡ Thursdayÿ ¡ Friday 4. ClickÿtheÿOK buttonÿtoÿreturnÿtoÿtheÿAxisBaseÿCollectionÿEditor,ÿandÿdeleteÿtheÿtextÿfromÿtheÿTitleÿ property.ÿÿ 5. ClickÿtheÿAxisYÿmember,ÿexpandÿtheÿMajorTick propertyÿandÿsetÿtheÿStep propertyÿtoÿ10.ÿ 6. SetÿtheÿAxisY member'sÿLabelsVisible propertyÿtoÿTrue.ÿ 7. SetÿtheÿAxisY member'sÿTitleÿpropertyÿtoÿ$,000 andÿclickÿOK toÿreturnÿtoÿtheÿChartAreaÿCollectionÿ Editor.ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 9. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿTitles (Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿthatÿappearsÿtoÿopenÿtheÿTitleÿCollectionÿEditor.ÿ 10. Inÿtheÿheaderÿproperties,ÿchangeÿtheÿTextÿpropertyÿtoÿ"CandleÿChart."ÿ 11. ExpandÿtheÿFont propertyÿandÿsetÿtheÿSizeÿtoÿ14.ÿ 12. Removeÿtheÿfooterÿtitle,ÿandÿclickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 13. WithÿtheÿChartÿcontrolÿhighlighted,ÿclickÿtheÿLegends (Collection)ÿpropertyÿtoÿopenÿtheÿLegendÿCollectionÿ Editor.ÿ 14. SetÿtheÿVisible propertyÿtoÿFalse,ÿandÿclickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ208

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        SimpleÿUnboundÿChart

        TheÿChartÿcontrolÿallowsÿyouÿtoÿbindÿchartsÿtoÿanyÿtypeÿofÿdataÿsource,ÿincludingÿarrays.ÿYouÿcanÿcreateÿaÿ chartÿwithoutÿsettingÿitsÿdataÿsourceÿthenÿloadÿtheÿdataÿintoÿtheÿcontrolÿatÿrunÿtime.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿunboundÿchart. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿtheÿprojectÿ l Addingÿtheÿchartÿcontrolÿtoÿtheÿreportÿ

        l Addingÿcodeÿtoÿconnectÿtheÿchartÿtoÿaÿdataÿsourceÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthWindÿdatabase. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ209

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. ClickÿonÿProject >ÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptUnboundChart.ÿ 4. ClickÿOpen.ÿ

        Addingÿtheÿchartÿcontrolÿtoÿtheÿreport

        Toÿaddÿaÿchartÿcontrolÿtoÿtheÿreport 1. ClickÿtheÿChartControlÿinÿtheÿActiveReportsÿtoolbox,ÿandÿdrawÿitÿontoÿtheÿreportÿsurface.ÿ 2. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿCustomize verbÿbelowÿtheÿPropertiesÿWindowÿtoÿopenÿtheÿ ChartÿDesignerÿdialog.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ210

        3. ClickÿtheÿSeries buttonÿonÿtheÿleftÿside,ÿandÿdeleteÿSeries1,ÿSeries2,ÿandÿSeries3.ÿ 4. ClickÿtheÿTitles buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner.ÿ 5. TypeÿUnboundÿChart inÿtheÿheaderÿtitleÿCaption andÿincreaseÿtheÿfontÿsizeÿtoÿ14.ÿ 6. Deleteÿtheÿfooterÿtitle.ÿ 7. ClickÿtheÿChartAreas buttonÿonÿtheÿleftÿsideÿofÿtheÿwizard,ÿandÿexpandÿtheÿAxesÿbutton.ÿ 8. ClickÿAxisX toÿselectÿit,ÿandÿenterÿCompanyÿName inÿtheÿAxisXÿTitleÿandÿincreaseÿtheÿfontÿsizeÿtoÿ12.ÿ 9. ClickÿAxisY toÿselectÿit,ÿandÿenterÿFreightÿinÿUS$ inÿtheÿAxisYÿTitleÿandÿincreaseÿtheÿfontÿsizeÿtoÿ12.ÿ 10. ClickÿtheÿLegends buttonÿonÿtheÿleftÿsideÿofÿtheÿChartÿDesigner.ÿ 11. ClearÿtheÿVisible checkÿboxÿatÿtheÿtop.ÿ 12. ClickÿFinish.

        Addingÿcodeÿtoÿconnectÿtheÿchartÿtoÿaÿdataÿsource

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptUnbound.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptUnboundChart'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Createÿtheÿseriesÿ

        l Createÿtheÿdatasetÿ l SetÿtheÿDataSource,ÿValueMembersXÿandÿValueMembersYÿpropertiesÿ l Angleÿtheÿlabelsÿtoÿavoidÿoverlapÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptUnbound.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptUnboundChart'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Createÿtheÿseriesÿ

        l Createÿtheÿdatasetÿ l SetÿtheÿDataSource,ÿValueMembersXÿandÿValueMembersYÿpropertiesÿ

        l Angleÿtheÿlabelsÿtoÿavoidÿoverlapÿÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿrptUnboundChart_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystemÿ_ .EventArgs)ÿHandlesÿMyBase.ReportStart 'ÿcreateÿtheÿseries DimÿseriesÿAsÿNewÿDataDynamics.ActiveReports.Chart.Series series.Typeÿ=ÿChart.ChartType.Bar3D DimÿconnectionStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=ÿ_ ÿ C:/NWIND.mdb;PersistÿSecurityÿInfo=False" DimÿconnectionÿAsÿNewÿSystem.Data.OleDb.OleDbConnection(connectionString) DimÿadapterÿAsÿSystem.Data.OleDb.OleDbDataAdapter

        'ÿcreateÿtheÿdataset DimÿdsÿAsÿDataSet adapterÿ=ÿNewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿ*ÿfromÿOrdersÿWHEREÿ_ ÿ OrderDateÿ<ÿ#08/17/1994#",ÿconnectionString) dsÿ=ÿNewÿDataSet oDBAdapter.Fill(ds,ÿ"Orders")

        'ÿsetÿtheÿDataSource,ÿValueMembersY,ÿandÿValueMembersXÿproperties Me.ChartControl1.DataSourceÿ=ÿds Me.ChartControl1.Series.Add(series) Me.ChartControl1.Series(0).ValueMembersYÿ=ÿds.Tables("Orders").Columns(7).ColumnName Me.ChartControl1.Series(0).ValueMemberXÿ=ÿds.Tables("Orders").Columns(8).ColumnName

        'ÿangleÿtheÿlabelsÿtoÿavoidÿoverlapping Me.ChartControl1.ChartAreas(0).Axes(0).LabelFont.Angleÿ=ÿ90 EndÿSub ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ211

        ÿ //C# privateÿvoidÿrptUnboundChart_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { //ÿcreateÿtheÿseries DataDynamics.ActiveReports.Chart.Seriesÿseriesÿ=ÿnewÿDataDynamics.ActiveReports.Chart .Series(); series.Typeÿ=ÿChart.ChartType.Bar3D; stringÿconnectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/NWIND.mdb; PersistÿSecurityÿInfo=False";ÿÿÿ System.Data.OleDb.OleDbConnectionÿconnectionÿ=ÿnewÿSystem.Data.OleDb.OleDbConnection (connectionString);ÿÿÿÿÿÿÿ System.Data.OleDb.OleDbDataAdapterÿadapter;

        //ÿcreateÿtheÿdataset System.Data.DataSetÿdsÿ=ÿnewÿSystem.Data.DataSet(); adapterÿ=ÿnewÿSystem.Data.OleDb.OleDbDataAdapter("SELECTÿ*ÿfromÿOrdersÿWHEREÿ OrderDateÿ<ÿ#08/17/1994#",ÿconnectionString); oDBAdapter.Fill(da,ÿ"Orders");

        //ÿsetÿtheÿDataSource,ÿValueMembersY,ÿandÿValueMembersXÿproperties this.ChartControl1.DataSourceÿ=ÿds; this.ChartControl1.Series.Add(series); this.ChartControl1.Series[0].ValueMembersYÿ=ÿds.Tables["Orders"].Columns[7] .ColumnName; this.ChartControl1.Series[0].ValueMemberXÿ=ÿds.Tables["Orders"].Columns[8] .ColumnName;

        //ÿangleÿtheÿlabelsÿtoÿavoidÿoverlapping this.ChartControl1.ChartAreas[0].Axes[0].LabelFont.Angleÿ=ÿ90; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ColumnarÿReports

        ActiveReportsÿsupportsÿnewspaperÿcolumnÿlayoutsÿinÿbothÿtheÿDetailÿandÿGroupÿsections.ÿYouÿcanÿrenderÿtheÿ columnsÿeitherÿhorizontallyÿorÿverticallyÿinÿtheÿsectionÿwithÿoptionsÿtoÿbreakÿtheÿcolumnÿonÿtheÿGroupÿsectionÿ (i.e.ÿstartÿaÿnewÿcolumnÿonÿtheÿchangeÿofÿaÿgroup).ÿÿThereÿisÿalsoÿaÿ BooleanÿColumnGroupKeepTogetherÿpropertyÿonÿtheÿGroupHeader.ÿWhenÿsetÿtoÿTrue,ÿ ColumnGroupKeepTogetherÿattemptsÿtoÿpreventÿaÿgroupÿfromÿsplittingÿacrossÿcolumns.ÿÿIfÿaÿgroupÿcannotÿfitÿ inÿtheÿcurrentÿcolumn,ÿitÿtriesÿtheÿnext.ÿÿIfÿtheÿgroupÿisÿtooÿlargeÿforÿaÿsingleÿcolumn,ÿtheÿpropertyÿisÿignored. Note: TheÿColumnGroupKeepTogetherÿpropertyÿisÿonlyÿimplementedÿwhenÿtheÿGroupHeader'sÿ GroupKeepTogetherÿpropertyÿisÿsetÿtoÿAll.ÿThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿreportÿ usingÿcolumns. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ212

        Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. ClickÿonÿProject >ÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptColumnar.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"SelectÿCountry,ÿCompanyName,ÿContactName,ÿPhoneÿFROMÿCustomersÿORDERÿ BYÿCountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptColumnar.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghCountry

        ¡ ChangeÿtheÿBackColor propertyÿtoÿGold ¡ ChangeÿtheÿDataField propertyÿtoÿCountry

        ¡ ChangeÿtheÿColumnGroupKeepTogether propertyÿtoÿTrue

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAllÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ213

        3. ChangeÿtheÿBackColor propertyÿofÿtheÿgroupÿfooterÿtoÿGoldenrod.ÿ 4. DragÿtheÿCountryÿfieldÿfromÿtheÿReportÿExplorerÿintoÿtheÿGroupHeaderÿsection withÿtheÿindicatedÿ properties:ÿ

        DataField Font Name Text Location

        Countryÿ Arial,ÿ12pt,ÿstyle=Boldÿ txtCountry Countryÿ 0,ÿ0ÿ

        5. ChangeÿtheÿBackColor propertyÿofÿtheÿPageHeaderÿsection toÿLinen andÿaddÿaÿlabelÿcontrolÿtoÿitÿwithÿtheÿ indicatedÿproperties:ÿ

        DataField Font Name Text Location

        Arial,ÿ14ptÿ CustomerÿTelephoneÿListÿbyÿCountryÿ 0,ÿ0ÿ lblPhone

        6. MakeÿtheÿfollowingÿchangesÿtoÿtheÿDetailÿsection:ÿ ¡ ChangeÿtheÿColumnCount propertyÿtoÿ2

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 7. DragÿtheÿfollowingÿfieldsÿfromÿtheÿReportÿExplorerÿtoÿtheÿDetailÿsection:ÿ

        DataField Name Text Location

        CompanyNameÿ txtCompanyName CompanyÿNameÿ 0,ÿ0ÿ

        ContactNameÿ txtContactName ContactÿNameÿ 1.188,ÿ0ÿ

        Phoneÿ txtPhone TelephoneÿNumberÿ 2.25,ÿ0ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        CustomÿControlsÿandÿChartFX

        ActiveReportsÿforÿ.NETÿ3.0ÿallowsÿyouÿtoÿdropÿaÿthirdÿpartyÿcontrolÿasÿaÿcustomÿcontrolÿontoÿanÿActiveReport.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿuseÿChartFXÿasÿaÿcustomÿcontrolÿwithÿActiveReports. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l AddingÿtheÿChartFXÿcontrolÿtoÿtheÿActiveReportÿ

        l Addingÿaÿlabelÿtoÿtheÿpageÿheaderÿ

        l Addingÿcodeÿforÿtheÿchartÿcontrolÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿChartFXÿinstalled. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿwithÿaÿchartÿthatÿlooksÿsimilarÿtoÿtheÿ following. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ214

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptChart.ÿ 4. ClickÿOpen.ÿ

        AddingÿtheÿChartFXÿcontrolÿtoÿrptChart

        ToÿaddÿtheÿChartFXÿcontrolÿtoÿrptChart 1. ClickÿonÿtheÿChartFXÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ 1. ToÿaddÿtheÿChartFXÿchartÿcontrolÿtoÿVisualÿStudioÿ2003,ÿright-clickÿtheÿtoolboxÿandÿ selectÿAdd/Removeÿitems.ÿ 2. SelectÿChart (SoftwareFX.ChartFXÿnamespace,ÿChartFX(6.2.x)).ÿ 3. ClickÿtheÿOK button. 2. DragÿandÿdropÿtheÿChartÿcontrolÿontoÿtheÿDetailÿsection ofÿrptChart.ÿ 3. ResizeÿtheÿchartÿcontrolÿtoÿfillÿtheÿDetailÿsection.ÿ

        AddingÿaÿLabelÿtoÿtheÿPageHeader

        ToÿaddÿaÿlabelÿtoÿtheÿPageHeader 1. DragÿandÿdropÿtheÿLabelÿcontrolÿfromÿtheÿActiveReportsÿtoolboxÿtoÿtheÿPageHeaderÿsection.ÿ 2. ChangeÿtheÿAlignment propertyÿtoÿCenter.ÿ 3. ChangeÿtheÿFontÿSize propertyÿtoÿ14ÿpt.ÿ 4. ChangeÿtheÿText propertyÿtoÿ"ChartFXÿChartÿbasedÿonÿrandomÿvaluesÿwithÿActiveReportsÿforÿ.NETÿ 3.0".ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ215

        5. ResizeÿtheÿLabelÿtoÿshowÿtheÿtextÿonÿtwoÿlines.ÿÿÿ

        AddingÿcodeÿforÿtheÿChartFxÿcontrol Beforeÿyouÿcanÿuseÿtheÿfollowingÿcode,ÿyouÿneedÿtoÿaddÿreferencesÿtoÿChartFXÿforÿ.NETÿ(Windows.Forms) andÿChartFXÿBase toÿyourÿproject.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿtheÿDetailÿsectionÿforÿrptChart.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿDetail_Formatÿ event.ÿ l Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic

        PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿrÿAsÿNewÿSystem.Random() DimÿChartControl1ÿAsÿSoftwareFX.ChartFX.Chart 'CastÿcustomControlÿasÿChartFXÿchart ChartControl1ÿ=ÿCType(Me.CustomControl1.Control,ÿSoftwareFX.ChartFX.Chart) ÿ DimÿiÿAsÿInteger DimÿjÿAsÿInteger ÿ 'Openÿtheÿcommunicationÿchannel ChartControl1.OpenData(SoftwareFX.ChartFX.COD.Values,ÿ3,ÿ3) Forÿiÿ=ÿ0ÿToÿ2 Forÿjÿ=ÿ0ÿToÿ2 'Assignÿtheÿvaluesÿtoÿtheÿseriesÿselected ChartControl1.Value(i,ÿj)ÿ=ÿr.NextDouble()ÿ*ÿ100 Nextÿj Nextÿi 'Closeÿtheÿcommunicationÿchannel ChartControl1.CloseData(SoftwareFX.ChartFX.COD.Values) EndÿSub //C#

        privateÿvoidÿdetail1_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { System.Randomÿrÿ=ÿnewÿSystem.Random(); ChartÿChartControl1ÿ=ÿnewÿChart(); //CastÿcustomControlÿasÿChartFXÿchart ChartControl1ÿ=ÿ((SoftwareFX.ChartFX.Chart)this.customControl1.Control); //Openÿtheÿcommunicationÿchannel ChartControl1.OpenData(SoftwareFX.ChartFX.COD.Values,ÿ3,ÿ3);

        forÿ(intÿi=0;i<3;i++) { forÿ(intÿj=0;j<3;j++) { //Assignÿtheÿvaluesÿtoÿtheÿseriesÿselected ChartControl1.Value[i,ÿj]ÿ=ÿr.NextDouble()ÿ*ÿÿ100; } } //Closeÿtheÿcommunicationÿchannel ChartControl1.CloseData(SoftwareFX.ChartFX.COD.Values); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ216

        designer.

        Walkthrough:ÿCustomizingÿtheÿViewerÿControl

        ActiveReportsÿincludesÿaÿcontrolÿtoÿviewÿreportÿoutputÿinÿcustomÿpreviewÿforms.ÿTheÿviewerÿallowsÿdevelopersÿ toÿmodifyÿtheÿtoolbarsÿorÿaddÿcustomÿmenuÿcommandsÿtoÿtheÿpreviewÿform. ThisÿwalkthroughÿillustratesÿhowÿtoÿaddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿyourÿreportÿandÿcustomizeÿit. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l Creatingÿaÿbasicÿpreviewerÿ

        l Usingÿsplitÿwindowsÿonÿtheÿviewerÿcontrolÿ l Addingÿaÿcustomÿprintÿbuttonÿtoÿtheÿviewerÿcontrolÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿtheÿActiveReportsÿcontrolsÿaddedÿtoÿyourÿVisualÿStudioÿtoolbox.ÿ Forÿmoreÿinformation,ÿseeÿAddingÿActiveReportsÿControlsÿtoÿtheÿVisualÿStudioÿToolbox.

        Creatingÿaÿbasicÿpreviewer

        Toÿcreateÿaÿbasicÿpreviewer 1. OpenÿaÿnewÿWindowsÿFormsÿprojectÿinÿVisualÿStudioÿandÿsizeÿtheÿformÿaccordingÿtoÿyourÿneeds.ÿ 2. ClickÿtheÿViewerÿiconÿonÿtheÿActiveReportsÿtoolbox.ÿ

        ÿ 4. PlaceÿtheÿcontrolÿonÿyourÿformÿandÿsetÿtheÿDock propertyÿtoÿFill.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFileÿandÿclickÿtheÿAddÿbutton.ÿ 7. AddÿtheÿfollowingÿcodeÿtoÿtheÿForm1ÿLoadÿevent.ÿ 'ÿVisualÿBasic DimÿrptÿasÿnewÿNewActiveReport1 rpt.Run() Viewer1.Documentÿ=ÿrpt.Document //C# ActiveReport1ÿrptÿ=ÿnewÿActiveReport1(); rpt.Run(); viewer1.Documentÿ=ÿrpt.Document; 8. PressÿF5 toÿrunÿtheÿreport.ÿ

        Usingÿsplitÿwindowsÿonÿtheÿviewerÿcontrol

        Toÿuseÿsplitÿwindowsÿonÿtheÿviewerÿcontrol 1. RunÿyourÿreportÿwithÿtheÿviewerÿaddedÿbyÿpressingÿF5.ÿ 2. Dragÿtheÿsplitterÿcontrolÿdown.ÿ

        ÿ 3. Whenÿtheÿviewerÿisÿsplitÿintoÿtwoÿsections,ÿreportÿlayoutsÿcanÿbeÿexaminedÿandÿreportÿpagesÿcanÿbeÿ comparedÿeasily.ÿ

        Addingÿaÿcustomÿprintÿbuttonÿtoÿtheÿviewerÿcontrol

        Toÿaddÿaÿcustomÿprintÿbuttonÿtoÿtheÿviewerÿcontrol ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ217

        1. AddÿaÿsecondÿformÿtoÿtheÿprojectÿcreatedÿaboveÿandÿrenameÿitÿfrmPrintDlg.ÿ 2. AddÿaÿlabelÿtoÿfrmPrintDlg andÿchangeÿtheÿText propertyÿtoÿThisÿisÿtheÿcustomÿprintÿdialog.ÿ 3. AddÿaÿbuttonÿtoÿfrmPrintDlg andÿchangeÿtheÿText propertyÿtoÿOK . 4. AddÿtheÿfollowingÿcodeÿtoÿtheÿForm1 Loadÿeventÿtoÿremoveÿtheÿdefaultÿprintÿbuttonÿandÿaddÿyourÿown.ÿ 'ÿVisualÿBasic 'ÿRemoveÿtheÿdefaultÿprintÿbutton Me.Viewer1.Toolbar.Tools.RemoveAt(2) 'ÿCreateÿandÿaddÿtheÿcustomÿbutton DimÿbtnÿAsÿNewÿDataDynamics.ActiveReports.Toolbar.Button() btn.Captionÿ=ÿ"MyPrint" btn.ToolTipÿ=ÿ"CustomÿPrintÿButton" btn.ImageIndexÿ=ÿ1 btn.ButtonStyleÿ=ÿDataDynamics.ActiveReports.Toolbar.ButtonStyle.TextAndIcon btn.Idÿ=ÿ333Me.Viewer1.Toolbar.Tools.Insert(2,ÿbtn) //C# //ÿRemoveÿtheÿdefaultÿprinterÿbutton this.viewer1.Toolbar.Tools.RemoveAt(2); //ÿCreateÿandÿaddÿtheÿcustomÿbutton DataDynamics.ActiveReports.Toolbar.Buttonÿbtnÿ=ÿnewÿDataDynamics.ActiveReports.Toolbar .Button(); btn.Captionÿ=ÿ"MyPrint"; btn.ToolTipÿ=ÿ"CustomÿPrintÿButton"; btn.ImageIndexÿ=ÿ1; btn.ButtonStyleÿ=ÿDataDynamics.ActiveReports.Toolbar.ButtonStyle.TextAndIcon; btn.Idÿ=ÿ333; this.viewer1.Toolbar.Tools.Insert(2,btn); 5. AddÿtheÿfollowingÿcodeÿtoÿtheÿViewer1ÿToolClickÿeventÿtoÿdisplayÿfrmPrintDlg whenÿtheÿcustomÿprintÿ buttonÿisÿclicked.ÿ 'ÿVisualÿBasic 'ÿCaptureÿtheÿnewÿtool'sÿclickÿtoÿshowÿtheÿdialog Ifÿe.Tool.Idÿ=ÿ333ÿThen DimÿdlgÿAsÿNewÿfrmPrintDlg() dlg.ShowDialog(Me) EndÿIf //C# //ÿCaptureÿtheÿnewÿtool'sÿclickÿtoÿshowÿtheÿdialog if(e.Tool.Idÿ==ÿ333) { frmPrintDlgÿdlgÿ=ÿnewÿfrmPrintDlg(); dlg.ShowDialog(this);

        ÿ } 6. PressÿF5ÿtoÿrunÿtheÿprojectÿandÿseeÿtheÿcustomÿMyPrint buttonÿonÿtheÿviewer.

        Walkthrough:ÿDataÿBoundÿReports

        InÿActiveReports,ÿtheÿsimplestÿreportingÿstyleÿisÿaÿtabularÿlistingÿofÿfieldsÿfromÿaÿrecordÿsource.ÿ Thisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿboundÿreportsÿbyÿintroducingÿtheÿideasÿofÿusingÿtheÿ DataSourceÿicon andÿconnectingÿtextboxÿcontrolsÿtoÿtheÿdataÿsourceÿthroughÿtheÿDataFieldÿproperty. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ

        l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ218

        Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. Fromÿthe File menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptBound.ÿ 3. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDatasourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ219

        4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproducts."ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿcontainÿdata 1. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location Size

        ProductNameÿ ProductÿNameÿ 0,ÿ0ÿ 2.3,ÿ0.19

        QuantityPerUnit Quantityÿ 2.38,ÿ0ÿ 1.55,ÿ0.19

        UnitsInStock Stockÿ 4,ÿ0ÿ 1,ÿ0.19

        2. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue toÿeliminateÿwhiteÿspaceÿinÿtheÿrenderedÿreport.ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ Note: Toÿenableÿtheÿviewer'sÿcopyÿbutton,ÿaddÿreferencesÿtoÿtheÿRtfExport andÿTextExport dlls.ÿ

        ÿ Noteÿ2: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿ theÿdesigner.

        Walkthrough:ÿUsingÿDataSetsÿContainingÿRelationshipsÿwithÿ Subreports

        InÿActiveReportsÿforÿ.NETÿ3.0,ÿdatasetsÿwithÿrelationshipsÿcanÿbeÿusedÿtoÿpopulateÿfieldsÿinÿsubreports.ÿ Note: SubreportsÿdoÿnotÿrenderÿPageHeader/Footerÿsections.ÿToÿsaveÿonÿprocessingÿtime,ÿalwaysÿ deleteÿPageHeader/Footerÿsectionsÿfromÿsubreports. Thisÿwalkthroughÿillustratesÿhowÿtoÿuseÿdatasetsÿwithÿrelationshipsÿinÿnestedÿsubreports. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ l Settingÿtheÿdataÿconnectionÿforÿtheÿreports,ÿcreatingÿandÿfillingÿdataÿadaptersÿandÿaddingÿdatasetÿ relationsÿ l Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreportÿcontrol'sÿdataÿsourceÿequalÿtoÿtheÿreturnedÿrowÿcollectionÿofÿ theÿdatasetÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Note: WeÿwillÿbeÿestablishingÿaÿrelationshipÿbetweenÿtheÿCategories,ÿProducts,ÿandÿOrderÿDetails tablesÿatÿrunÿtime. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ220

        Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCategories.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptProductsSub.ÿ 7. ClickÿOpen.ÿ 8. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 9. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptOrderDetailsSub.ÿ 10. ClickÿOpen.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCategories.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ221

        ¡ ChangeÿtheÿName propertyÿtoÿghCategories ¡ ChangeÿtheÿUnderlayNext propertyÿtoÿTrue ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryName ¡ ChangeÿtheÿBackColorÿpropertyÿtoÿGainsboro 3. ChangeÿtheÿBackColor propertyÿofÿtheÿpageÿheaderÿtoÿSilver.ÿ 4. AddÿtheÿfollowingÿcontrolsÿtoÿrptCategories,ÿsettingÿtheÿpropertiesÿasÿindicatedÿandÿresizingÿasÿnecessary:ÿ

        Fontÿ Control DataField Name Text Section Location Size

        Label lblCategoryName Categoryÿ PageHeaderÿ 0,ÿ0ÿ 12 Nameÿ

        Label lblProduct Productÿ PageHeaderÿ 1.5,ÿ0ÿ 12

        Label lblOrderDetails Orderÿ PageHeaderÿ 2.75,ÿ0ÿ 12 Detailsÿ

        TextBox CategoryNameÿ txtCategoryName Categoryÿ GroupHeaderÿ 0,ÿ0ÿ Nameÿ

        Subreport SubReport1 Detailÿ 1.5,ÿ0ÿ

        5. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptProductsSub.ÿ 6. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghProducts

        ¡ ChangeÿtheÿUnderlayNext propertyÿtoÿTrue ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ SetÿtheÿDataField propertyÿtoÿProductName

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightSteelBlue 7. AddÿtheÿfollowingÿcontrolsÿtoÿrptProductsSub,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿ

        Control Miscellaneous Name Text Section Location

        TextBox DataFieldÿ=ÿ txtProductName Productÿ GroupHeaderÿ 0,ÿ0ÿ ProductNameÿ Nameÿ

        Label Underlined lblUnitPrice UnitÿPriceÿ Detailÿ 1,ÿ0ÿ

        Label Underlined lblQuantity Quantityÿ Detailÿ 1.75,ÿ0ÿ

        Label Underlined lblDiscount Discount Detailÿ 2.44,ÿ0ÿ

        Subreportÿ NA SubReport1 NA Detailÿ 1,ÿ0.25ÿ

        8. AddÿtheÿfollowingÿcontrolsÿtoÿrptOrderDetailsSub,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿ

        Control DataField Name Text OutputFormat Alignment Location

        TextBox UnitPrice txtUnitPrice Unitÿ Currency Right 0,ÿ0 Price

        TextBox Quantity txtQuantity Quantity NA Right 0.75,ÿ0

        TextBox Discount txtDiscount Discount 0% Right 1.44,ÿ0

        9. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.

        Settingÿtheÿdataÿconnections,ÿdataÿadaptersÿandÿdatasetÿrelations

        Toÿsetÿtheÿdataÿconnections ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ222

        1. AddÿaÿWindowsÿFormÿtoÿyourÿproject.ÿ 2. AddÿanÿActiveReportsÿviewerÿcontrolÿtoÿForm1ÿandÿsetÿtheÿDock propertyÿtoÿFill.ÿ

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿVisualÿBasicÿorÿC# l Double-clickÿonÿtheÿtitleÿbarÿofÿtheÿWindowsÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ Form_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Setÿtheÿdataÿconnectionsÿ l Createÿandÿfillÿtheÿdataÿadaptersÿ

        l Createÿdatasetÿrelationshipsÿ l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrunÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic 'Createÿtheÿdataset DimÿmyJoinedDataSetÿAsÿNewÿDataSet() PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load 'CreateÿaÿnewÿinstanceÿofÿrptCategoriesÿandÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreport'sÿdocumentÿ DimÿrptÿAsÿNewÿrptCategories() Me.Viewer1.Documentÿ=ÿrpt.Document

        'Createÿtheÿdataÿconnection DimÿconnStringÿAsÿString DimÿconnÿAsÿNewÿOleDb.OleDbConnection() 'Changeÿtheÿpathÿtoÿyourÿdataÿsourceÿasÿnecessary connStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=c:\Northwind.mdb" connÿ=ÿNewÿOleDb.OleDbConnection(connString) conn.Open()

        'CreateÿtheÿdataÿadaptersÿwithÿtheÿSQLÿSelectCommandÿtoÿretrieveÿdataÿfromÿtheÿNorthwindÿdatabase DimÿadapterCategoriesÿAsÿNewÿOleDb.OleDbDataAdapter("Selectÿ*ÿfromÿcategoriesÿorderÿbyÿ_ categoryname",ÿconn) DimÿadapterProductsÿAsÿNewÿOleDb.OleDbDataAdapter("Selectÿ*ÿfromÿproductsÿorderÿbyÿ_ productname",ÿconn) DimÿadapterOrderDetailsÿAsÿNewÿOleDb.OleDbDataAdapter("Selectÿ*ÿfromÿ[orderÿdetails]",ÿconn)

        'Fillÿtheÿdatasetÿwithÿtheÿretrievedÿdata adapterCategories.Fill(myJoinedDataSet,ÿ"Categories") adapterProducts.Fill(myJoinedDataSet,ÿ"Products") adapterOrderDetails.Fill(myJoinedDataSet,ÿ"OrderDetails")

        'Createÿtheÿrelationshipsÿbetweenÿtheÿdataset'sÿtables Me.myJoinedDataSet.Relations.Add("CategoriesProducts",ÿmyJoinedDataSet.Tables("Categories")ÿ_ .Columns("CategoryID"),ÿmyJoinedDataSet.Tables("Products").Columns("CategoryID")) Me.myJoinedDataSet.Relations.Add("ProductsOrderDetails",ÿmyJoinedDataSet.Tables("Products")ÿ_ .Columns("ProductID"),ÿmyJoinedDataSet.Tables("OrderDetails").Columns("ProductID"))

        'SetÿtheÿdataÿsourceÿforÿrptCategories rpt.DataSourceÿ=ÿ(myJoinedDataSet) rpt.DataMemberÿ=ÿ"Categories"

        'Runÿtheÿreport rpt.Run() EndÿSubÿ //Createÿtheÿdataset publicÿDataSetÿmyJoinedDataSetÿ=ÿnewÿDataSet(); privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { //CreateÿaÿnewÿinstanceÿofÿrptCategoriesÿandÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreport'sÿdocument rptCategoriesÿrptÿ=ÿnewÿrptCategories(); this.viewer1.Documentÿ=ÿrpt.Document;

        //Createÿtheÿdataÿconnection //Changeÿtheÿpathÿtoÿyourÿdataÿsourceÿasÿnecessary ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ223

        stringÿconnStringÿ=ÿ@"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=c:\NWIND.MDB"; OleDbConnectionÿconnÿ=ÿnewÿOleDbConnection(connString); conn.Open();

        //CreateÿtheÿdataÿadaptersÿwithÿtheÿSQLÿSelectCommandÿtoÿretrieveÿdataÿfromÿtheÿNorthwindÿdatabase OleDbDataAdapterÿadapterCategoriesÿÿ=ÿnewÿOleDbDataAdapter("Selectÿ*ÿfromÿcategoriesÿorderÿ byÿcategoryname",conn); OleDbDataAdapterÿadapterProductsÿÿ=ÿnewÿOleDbDataAdapter("Selectÿ*ÿfromÿproductsÿorderÿbyÿ productname",conn); OleDbDataAdapterÿadapterOrderDetailsÿÿ=ÿnewÿOleDbDataAdapter("Selectÿ*ÿfromÿ[orderÿdetails]", conn);

        //Fillÿtheÿdatasetÿwithÿtheÿretrievedÿdata adapterCategories.Fill(myJoinedDataSet,ÿ"Categories"); adapterProducts.Fill(myJoinedDataSet,ÿ"Products"); adapterOrderDetails.Fill(myJoinedDataSet,ÿ"OrderDetails");

        //Createÿtheÿrelationshipsÿbetweenÿtheÿdataset'sÿtables this.myJoinedDS.Relations.Add("CategoriesProducts",ÿmyJoinedDataSet.Tables ["Categories"].Columns["CategoryID"],ÿmyJoinedDataSet.Tables["Products"].Columns ["CategoryID"]); this.myJoinedDS.Relations.Add("ProductsOrderDetails",ÿmyJoinedDataSet.Tables ["Products"].Columns["ProductID"],ÿmyJoinedDataSet.Tables["OrderDetails"].Columns ["ProductID"]);

        //SetÿtheÿdataÿsourceÿforÿrptCategories rpt.DataSourceÿ=ÿ(myJoinedDataSet); rpt.DataMemberÿ=ÿ"Categories";

        //Runÿtheÿreport rpt.Run(); }

        Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreport'sÿdataÿsourceÿcontrolÿequalÿtoÿ theÿdataset'sÿreturnedÿrowÿcollectionÿforÿrptCategories

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿonÿtheÿdetailÿsectionÿofÿrptCategories.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptCategories'ÿDetail_Formatÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic DimÿcounterÿAsÿInteger PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail1.Format DimÿdrcÿAsÿDataRow IfÿCType(Me.DataSource,ÿDataSet).Tables("Categories").Rows.Countÿ>ÿcounterÿThen ÿ drcÿ=ÿCType(Me.DataSource,ÿDataSet).Tables("Categories")ÿ_ ÿ .Rows(counter) ÿ counterÿ=ÿcounterÿ+ÿ1 EndÿIf DimÿrptÿAsÿNewÿrptProductsSub() rpt.DataSourceÿ=ÿdrc.GetChildRows(CType(Me.DataSource,ÿDataSet)ÿ_ ÿ .Relations("CategoriesProducts")) Me.SubReport1.Reportÿ=ÿrpt EndÿSub ÿ //C# intÿcounter; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { DataRowÿdrcÿ=ÿnull; if(((DataSet)this.DataSource).Tables["Categories"].Rows.Count>counter) { drcÿ=ÿ((DataSet)this.DataSource).Tables["Categories"] .Rows[counter]; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ224

        counter++; } rptProductsSubÿrptÿ=ÿnewÿrptProductsSub(); rpt.DataSourceÿ=ÿdrc.GetChildRows(((DataSet)this.DataSource) .Relations["CategoriesProducts"]); this.SubReport1.Reportÿ=ÿrpt; }

        Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreport'sÿdataÿsourceÿcontrolÿequalÿtoÿ theÿdataset'sÿreturnedÿrowÿcollectionÿforÿrptProductsSub

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC#

        l Double-clickÿonÿtheÿdetailÿsectionÿofÿrptProductsSub.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptProductsSub'sÿDetail_Formatÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic DimÿcounterÿAsÿInteger PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail1.Format DimÿrptÿAsÿNewÿrptOrderDetailsSub() Dimÿdrc()ÿAsÿDataRow drcÿ=ÿCType(Me.DataSource,ÿDataRow()) rpt.DataSourceÿ=ÿdrc(counter).GetChildRows("ProductsOrderDetails") Me.SubReport1.Reportÿ=ÿrpt counterÿ=ÿcounterÿ+ÿ1 EndÿSub ÿ //C# intÿcounter; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptOrderDetailsSubÿrptÿ=ÿnewÿrptOrderDetailsSub(); DataRow[]ÿdrcÿ=ÿ((DataRow[])this.DataSource); rpt.DataSourceÿ=ÿdrc[counter].GetChildRows("ProductsOrderDetails"); this.SubReport1.Reportÿ=ÿrpt; counter++; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿDeployingÿCompiledÿReports

        WithÿActiveReports,ÿcompiledÿreportsÿcanÿbeÿsetÿupÿforÿdeploymentÿbyÿincludingÿtheÿActiveReportsÿ deploymentÿ.msmÿfileÿinÿyourÿVisualÿStudioÿdeploymentÿproject.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿdeploymentÿprojectÿinÿActiveReportsÿforÿaÿcompiledÿreport.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿinstallerÿprojectÿtoÿanÿexistingÿActiveReportsÿprojectÿ l AddingÿtheÿActiveReportsÿ.msmÿfileÿ l AddingÿtheÿActiveReportsÿapplicationÿtoÿtheÿinstallerÿ

        l Deployingÿtheÿinstallerÿapplicationÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ225

        AddingÿanÿinstallerÿprojectÿtoÿanÿexistingÿActiveReportsÿproject

        Toÿaddÿtheÿinstallerÿproject 1. OpenÿanÿexistingÿActiveReportsÿprojectÿorÿcreateÿaÿnewÿreport.ÿ 2. OnÿtheÿBuild menu,ÿclickÿ"Buildÿ[yourÿActiveReportsÿprojectÿname]"ÿtoÿbuildÿyourÿreportÿproject.ÿ 3. Onÿthe File menu,ÿselectÿAddÿProject andÿclickÿonÿNewÿProject. 4. UnderÿProjectÿTypes inÿtheÿAddÿNewÿProject dialog,ÿselectÿSetupÿandÿDeploymentÿProjects.ÿ 5. InÿtheÿTemplatesÿwindow,ÿselectÿSetupÿProject,ÿrenameÿtheÿfileÿandÿclickÿOK .ÿ 6. SelectÿtheÿInstallerÿprojectÿinÿtheÿSolutionÿExplorer.ÿInÿtheÿPropertiesÿwindow,ÿselectÿtheÿProductName propertyÿandÿtypeÿinÿtheÿnameÿofÿyourÿfile. Note: TheÿProductName propertyÿdeterminesÿtheÿnameÿthatÿwillÿbeÿdisplayedÿforÿtheÿapplicationÿinÿ folderÿnamesÿandÿinÿtheÿAdd/RemoveÿPrograms dialogÿbox.

        AddingÿtheÿActiveReportsÿ.msmÿfile

        ToÿaddÿtheÿActiveReportsÿ.msmÿfile 1. InÿtheÿSolutionÿExplorer,ÿright-clickÿtheÿInstallerÿproject.ÿ 2. PointÿtoÿAdd andÿclickÿMergeÿModule toÿopenÿtheÿAddÿModules dialog.ÿÿ 3. OpenÿtheÿDeploymentÿfolderÿwhereÿActiveReportsÿisÿinstalledÿ(e.g.ÿc:\\programÿfiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Deployment).ÿ 4. Selectÿ"ActiveReportsDistrib.msm"ÿandÿclickÿOpen.ÿThisÿaddsÿallÿofÿtheÿActiveReportsÿdistributedÿ assembliesÿtoÿyourÿproject. Note: SinceÿtheÿSetupÿandÿDeploymentÿprojectÿwillÿautomaticallyÿdetectÿandÿaddÿanyÿexistingÿassemblyÿ dependenciesÿtoÿyourÿprojectÿandÿtheÿ.msmÿfileÿaddsÿallÿActiveReportsÿassemblies,ÿyouÿwillÿneedÿtoÿ excludeÿanyÿduplicateÿActiveReportsÿDLLsÿfromÿtheÿ"DetectedÿDependencies"ÿfolderÿinÿtheÿSolutionÿ Explorerÿwindow.

        AddingÿtheÿActiveReportsÿapplicationÿtoÿtheÿinstaller

        ToÿaddÿtheÿActiveReportsÿapplication 1. SelectÿtheÿInstallerÿprojectÿinÿtheÿSolutionÿExplorer.ÿ 2. InÿtheÿFileÿSystemÿEditor,ÿchooseÿtheÿApplicationÿfolder.ÿ 3. OnÿtheÿAction menu,ÿselectÿAdd>ÿProjectÿOutput. 4. InÿtheÿAddÿProjectÿOutputÿGroup dialog,ÿchooseÿyourÿActiveReportsÿprojectÿnameÿfromÿtheÿdrop-downÿ list.ÿ 5. Selectÿ"PrimaryÿOutput"ÿfromÿtheÿlistÿandÿclickÿOK.ÿ 6. OnÿtheÿBuild menu,ÿclickÿ"Buildÿ[yourÿInstallerÿprojectÿname]"ÿtoÿbuildÿyourÿInstallerÿproject.ÿ

        Deployingÿtheÿinstallerÿapplication

        Toÿdeployÿtheÿinstallerÿapplication 1. SelectÿtheÿInstallerÿprojectÿinÿtheÿSolutionÿExplorer.ÿ

        2.ÿ OnÿtheÿProject menu,ÿclickÿInstall.ÿ 3. TheÿInstallerÿapplicationÿwillÿrunÿandÿinstallÿtheÿprojectÿonÿyourÿcomputer.ÿ

        Walkthrough:ÿExportingÿOutput

        IncludedÿwithÿActiveReportsÿareÿseveralÿspecializedÿexportÿfiltersÿ(HTML,ÿPDF,ÿRTF,ÿExcel,ÿTIFFÿandÿText).ÿ Withÿtheseÿexportÿfilters,ÿreportsÿcanÿbeÿeasilyÿmadeÿavailableÿtoÿothersÿinÿvariousÿfileÿformats.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿexportÿaÿreportÿtoÿPDF,ÿHTML,ÿRTF,ÿText,ÿTIFFÿandÿExcelÿfiles. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ226

        Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Addingÿtheÿappropriateÿexportÿfiltersÿtoÿyourÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿdisplayÿtheÿdataÿ

        l Usingÿtheÿexportÿmethodsÿtoÿexportÿdataÿtoÿallÿavailableÿfileÿformatsÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿcreatedÿPDF,ÿHTML,ÿRTF,ÿText,ÿTIFFÿandÿExcelÿfilesÿ whichÿcanÿbeÿfoundÿinÿtheÿBin/Debugÿ(C#)ÿorÿBinÿ(VB.NET)ÿsubfolderÿofÿyourÿproject'sÿfolder.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptExports.ÿ 4. ClickÿOpen.ÿ

        Addingÿtheÿexportÿfiltersÿtoÿyourÿproject

        Toÿaddÿtheÿexportÿfiltersÿtoÿyourÿproject 1. Clickÿonÿtheÿfollowingÿexportÿcontrolsÿoneÿatÿaÿtimeÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿthem.ÿ

        ¡ HtmlExportÿ ¡ PdfExportÿ ¡ RtfExportÿ

        ¡ TextExportÿ ¡ TiffExportÿ

        ¡ XlsExportÿ 2. DragÿeachÿcontrolÿontoÿtheÿWindowsÿForm.ÿ 3. TheÿcontrolsÿwillÿappearÿinÿtheÿcomponentÿtrayÿunderneathÿtheÿWindowsÿForm.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ReturnÿtoÿtheÿreportÿandÿclickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿReportÿ Datasourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿÿ 3. ClickÿBuild.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"SelectÿLastName,ÿFirstNameÿfromÿEmployees."ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ227

        l InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        LastName LastÿName 0.06,ÿ0.06

        FirstName FirstÿName 1.188,ÿ0.063

        Usingÿtheÿexportÿmethodsÿtoÿexportÿfilesÿtoÿallÿavailableÿfileÿformats

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l InÿtheÿDesignerÿviewÿofÿtheÿWindowsÿForm,ÿdouble-clickÿtheÿformÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿ theÿForm_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Exportÿtheÿreportÿtoÿallÿavailableÿfileÿformats

        ToÿwriteÿtheÿcodeÿinÿC#

        l InÿtheÿDesignerÿviewÿofÿtheÿWindowsÿForm,ÿdouble-clickÿtheÿformÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿ theÿForm_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Exportÿtheÿreportÿtoÿallÿavailableÿfileÿformats Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿrptÿAsÿNewÿrptExports() rpt.Run() ÿ Me.HtmlExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\HTMLExpt.html") Me.PdfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\PDFExpt.") Me.RtfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\RTFExpt.rtf") Me.TextExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TextExpt.txt") Me.TiffExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TIFFExpt.") Me.XlsExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\XLSExpt.xls") EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptExportsÿrptÿ=ÿnewÿrptExports(); rpt.Run(); ÿ this.htmlExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\HTMLExpt.html"); this.pdfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\PDFExpt.pdf"); this.rtfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\RTFExpt.rtf"); this.textExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TextExpt.txt"); this.tiffExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TIFFExpt.tiff"); this.xlsExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\XLSExpt.xls");

        ÿ } Buildÿtheÿprojectÿthenÿnavigateÿtoÿtheÿappropriateÿfolderÿtoÿseeÿeachÿexport.

        GreenÿBarÿReports

        Greenÿbarÿprintoutsÿcanÿbeÿcreatedÿbyÿalternatingÿtheÿshadingÿorÿbackgroundÿcolorÿofÿtheÿreport'sÿDetailÿ sectionÿinÿtheÿFormatÿevent. Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿgreenÿbarÿreport. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ228

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿcodeÿtoÿtheÿDetail_Formatÿeventÿtoÿalternateÿcolorsÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptGreenBar.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ229

        4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿReportÿDataÿSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿProducts".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ 2. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        ProductIDÿ ProductÿIDÿ 0,ÿ0ÿ

        ProductNameÿ ProductÿNameÿ 0.9,ÿ0ÿ

        UnitsInStockÿ UnitsÿinÿStockÿ 3.5,ÿ0ÿ

        UnitsOnOrderÿ UnitsÿonÿOrderÿ 4.5,ÿ0ÿ

        ReorderLevelÿ ReorderÿLevelÿ 5.6,ÿ0ÿ

        3. SetÿtheÿCanShrink propertyÿofÿtheÿPageHeaderÿsectionÿtoÿTrue.ÿ 4. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageHeaderÿsection:ÿ

        Control Name Text Formatting Location

        Label lblTitle ReorderÿSheet Fontÿ14pt;ÿBold;ÿCenter 0,ÿ0ÿ

        Label lblProductID ProductÿID Underline 0,ÿ0.37

        Label lblProductName ProductÿName Underline 0.9,ÿ0.37

        Label lblUnitsInStock UnitsÿinÿStock Underline 3.5,ÿ0.37

        Label lblUnitsOnOrder UnitsÿonÿOrder Underline 4.5,ÿ0.37

        Label lblReorderLevel ReorderÿLevel Underline 5.6,ÿ0.37

        AddingÿcodeÿtoÿtheÿDetail_Formatÿeventÿtoÿalternateÿcolors

        ToÿaddÿcodeÿtoÿtheÿtheÿDetail_Formatÿevent 1. Double-clickÿinÿtheÿDetailÿsectionÿtoÿcreateÿaÿDetailÿFormatÿevent.ÿ 2. Addÿtheÿfollowingÿcodeÿtoÿtheÿeventÿtoÿalternateÿbackgroundÿcolors.ÿ 'VisualÿBasic DimÿIÿAsÿInteger PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Ifÿ(IÿModÿ2)ÿ=ÿ0ÿThen ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ230

        Detail1.BackColorÿ=ÿSystem.Drawing.Color.DarkSeaGreen Else Detail1.BackColorÿ=ÿSystem.Drawing.Color.Transparent EndÿIf Iÿ=ÿIÿ+ÿ1 EndÿSub //C# boolÿcolor; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { if(color) { colorÿ=false; this.detail.BackColorÿ=ÿSystem.Drawing.Color.DarkSeaGreen; } else { this.detail.BackColorÿ=ÿSystem.Drawing.Color.Transparent; colorÿ=ÿtrue; } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        GroupingÿDataÿWalkthroughs

        WithÿActiveReports,ÿgroupingÿcanÿbeÿeasilyÿaddedÿtoÿyourÿreports.ÿTheÿfollowingÿwalkthroughsÿdescribeÿ exactlyÿhowÿtoÿincludeÿvariousÿgroupingÿoptionsÿinÿyourÿreport. ÿ ConditionalÿShow/HideÿDetail Describesÿhowÿreportsÿcanÿbeÿgroupedÿtoÿshowÿorÿhideÿinformationÿbasedÿonÿsetÿconditions.ÿ GroupÿonÿaÿFieldÿExpression DescribesÿhowÿreportsÿcanÿbeÿgroupedÿbyÿusingÿaÿgroupÿheaderÿwithÿtheÿDataFieldÿpropertyÿsetÿtoÿaÿfieldÿ expression.ÿ GroupÿonÿSimpleÿFields DescribesÿhowÿreportsÿcanÿbeÿgroupedÿbyÿusingÿsimpleÿfieldsÿandÿsettingÿtheÿDataFieldÿpropertyÿtoÿtheÿ databaseÿfieldÿonÿwhichÿtheyÿareÿbeingÿgrouped.ÿ GroupÿonÿUnboundÿFields Describesÿhowÿreportsÿcanÿbeÿgroupedÿonÿunboundÿfields.ÿ KeeptogetherÿOptions ÿ DescribesÿhowÿtoÿuseÿKeeptogetherÿoptionsÿwithÿgroupingÿinÿaÿreport.ÿ

        Walkthrough:ÿConditionalÿShow-HideÿDetail

        ActiveReportsÿallowsÿyouÿtoÿhideÿorÿshowÿinformationÿfromÿtheÿdataÿsourceÿinÿtheÿDetailÿsection ofÿyourÿreportÿ basedÿonÿconditionsÿinÿyourÿdata.ÿThisÿcanÿbeÿachievedÿbyÿsettingÿsectionÿpropertiesÿinÿtheÿFormatÿevent.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿreportÿbasedÿonÿconditionsÿthatÿwillÿshowÿspecificÿdataÿfromÿyourÿ dataÿsourceÿatÿrunÿtime.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ231

        Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Addingÿcodeÿtoÿretrieveÿdataÿfromÿtheÿdataÿsourceÿ

        l AddingÿconditionsÿinÿcodeÿtoÿtheÿFormatÿeventÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCondSH.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ232

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿProductsÿORDERÿBYÿProductName".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿsetÿtoÿtheÿPageHeaderÿsection:ÿ

        Miscellaneous Name Text Location

        Bold lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Boldÿ lblProductName ProductÿNameÿ 1.063,ÿ0ÿ

        Boldÿ lblReorderLevel ReorderÿLevelÿ 3.813,ÿ0ÿ

        Boldÿ lblInStock UnitsÿInÿStockÿ 2.5,ÿ0ÿ

        2. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ 3. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        ProductID ProductÿID 0,ÿ0

        ProductName ProductÿName 1.063,ÿ0

        UnitsInStock UnitsÿInÿStock 2.510,ÿ0

        ReorderLevel ReorderÿLevel 3.833,ÿ0

        Discontinued Discontinued 5.291,ÿ0

        Addingÿconditionsÿinÿcodeÿtoÿtheÿformatÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿinÿtheÿDetailÿsectionÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptCondSH'sÿDetail_Formatÿ event.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l SetÿconditionsÿinÿtheÿFormatÿeventÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format IfÿÿMe.txtReorderLevel.Value=0ÿAndÿMe.txtDiscontinued.Valueÿ=ÿFalseÿThen Me.Detail1.Visibleÿ=ÿTrue Me.txtDiscontinued.Textÿ=ÿ"" Me.txtReorderLevel.Textÿ=ÿ"NeedÿtoÿReorder" Me.txtReorderLevel.ForeColorÿ=ÿSystem.Drawing.Color.DarkRed Else Me.Detail.Visibleÿ=ÿFalse EndÿIf ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ233

        EndÿSub

        //C# intÿm_dis; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { m_disÿ=ÿbool.Parse(txtDiscontinued.Text)?ÿ1ÿ:ÿ0; ÿ if((short)txtReorderLevel.Valueÿ==ÿ0ÿ&&ÿm_disÿ==ÿ0) { this.detail.Visibleÿ=ÿtrue; this.txtDiscontinued.Textÿ=ÿ""; this.txtReorderLevel.Textÿ=ÿ"NeedÿtoÿReorder"; this.txtReorderLevel.ForeColorÿ=ÿSystem.Drawing.Color.DarkRed; } else { this.detail.Visibleÿ=ÿfalse; } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿGroupÿonÿSimpleÿFields

        InÿActiveReports,ÿreportsÿcanÿbeÿgroupedÿbyÿusingÿaÿgroupÿheaderÿwithÿtheÿDataFieldÿpropertyÿsetÿtoÿtheÿ databaseÿfieldÿonÿwhichÿitÿisÿbeingÿgrouped.ÿActiveReportsÿallowsÿupÿtoÿ32ÿnestedÿgroupsÿinÿaÿsingleÿreport.ÿ Whenÿusingÿgrouping,ÿmakeÿsureÿtheÿreturnedÿdatasetÿisÿorderedÿbyÿtheÿfieldsÿonÿwhichÿitÿisÿbeingÿgrouped. Thisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿgroupingÿonÿsimpleÿfieldsÿinÿaÿreport. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿyourÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ234

        AddingÿanÿActiveReportÿtoÿyourÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. ClickÿProject >ÿAddÿNewÿItem. 2. ClickÿActiveReportsÿ3.0ÿFile.ÿ 3. ChangeÿtheÿnameÿofÿtheÿreportÿtoÿrptSimpleGroupÿandÿclickÿOpen.ÿ 4. TheÿActiveReportsÿdesignÿsurfaceÿisÿdisplayed.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿÿ 3. ClickÿtheÿBuild button.ÿ 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿORDERÿBYÿcountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ235

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/Footerÿsectionÿtoÿyourÿreportÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghOrderGroup ¡ ChangeÿtheÿDataField propertyÿtoÿCountry 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiessÿtoÿghOrderGroup:ÿ

        Miscellaneous Name Text Location

        Bold;ÿUnderlined lblCustomerID CustomerÿIDÿ 0,ÿ0.31ÿ

        Bold;ÿUnderlined lblCompanyName CompanyÿNameÿ 1.06,ÿ0.31ÿ

        Bold;ÿUnderlined lblContactName ContactÿNameÿ 3.25,ÿ0.31ÿ

        Bold;ÿUnderlined lblContactTitle ContactÿTitleÿ 5,ÿ0.31ÿ

        4. AddÿaÿfieldÿwithÿtheÿfollowingÿpropertiesÿsetÿtoÿghOrderGroup:ÿ

        Miscellaneous DataField Name Text Location

        Fontÿsizeÿ=ÿ14;ÿForeColorÿ=ÿ Countryÿ txtCountry Countryÿ 0.313,ÿ DarkRed;ÿBoldÿ 0.063ÿ

        5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location Size

        CustomerID CustomerÿID 0,ÿ0 1,ÿ0.2

        CompanyName CompanyÿName 1.06,ÿ0 2.06,ÿ0.2

        ContactName ContactÿName 3.25,ÿ0 1.63,ÿ0.2

        ContactTitle ContactÿTitle 5,ÿ0 1.5,ÿ0.2

        6. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        GroupÿonÿaÿFieldÿExpression

        InÿActiveReports,ÿreportsÿcanÿbeÿgroupedÿbyÿusingÿaÿgroupÿheaderÿwithÿtheÿDataFieldÿpropertyÿsetÿtoÿaÿfieldÿ expression.ÿActiveReportsÿallowsÿupÿtoÿ32ÿnestedÿgroupsÿinÿaÿsingleÿreport.ÿWhenÿusingÿgrouping,ÿmakeÿsureÿ theÿreturnedÿdatasetÿisÿorderedÿbyÿtheÿfieldsÿonÿwhichÿitÿisÿbeingÿgrouped. Thisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿgroupingÿonÿsimpleÿfieldsÿinÿaÿreport. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿyourÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ236

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿyourÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 2. ClickÿActiveReportsÿ3.0ÿFile.ÿ 3. ChangeÿtheÿnameÿofÿtheÿreportÿtoÿrptGroupÿandÿclickÿOpen.ÿ 4. TheÿActiveReportsÿdesignÿsurfaceÿisÿdisplayed.

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ237

        5. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿORDERÿBYÿ(cityÿ+ÿcountry)".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/Footerÿsectionÿtoÿyourÿreportÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCityCountryGroupÿ

        ¡ ChangeÿtheÿDataField propertyÿtoÿ=Cityÿ+ÿCountry ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ ChangeÿtheÿBackColor propertyÿtoÿGainsboro 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageHeaderÿsection:ÿ ÿ

        Control Name Text Location

        Label;ÿFontÿsizeÿ lblCustomers CustomersÿbyÿCityÿandÿ 2.219,ÿ0ÿ(centeredÿacrossÿ =ÿ12 Country entireÿreport)

        4. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ ÿ

        Control DataField Name Text Location

        TextBox =Cityÿ+ÿ",ÿ"ÿ+ÿCountry txtCityCountry CityCountry 1.125,ÿ0

        5. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsection:ÿ ÿ

        Control DataField Name Text Location

        TextBox CompanyName txtCompanyName CompanyÿName 0,ÿ0

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        GroupÿonÿUnboundÿFields

        ActiveReportsÿallowsÿyouÿtoÿsetÿupÿgroupingÿinÿunboundÿreports.ÿWhenÿsettingÿupÿgrouping,ÿtheÿgroupÿ header'sÿDataFieldÿpropertyÿisÿusedÿtoÿretrieveÿtheÿgroupingÿdataÿfromÿtheÿdatabaseÿinÿtheÿsameÿmannerÿasÿaÿ textbox'sÿDataFieldÿproperty. Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿgroupingÿinÿanÿunboundÿreport. Thisÿwalkthroughÿisÿsplitÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ238

        l Addingÿcodeÿtoÿconnectÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ

        l UsingÿtheÿDataInitializeÿeventÿtoÿaddÿfieldsÿtoÿtheÿreport'sÿfieldsÿcollectionÿ l UsingÿtheÿFetchDataÿeventÿtoÿpopulateÿtheÿreportÿfieldsÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptUnboundGrp.ÿ 4. ClickÿOpen.ÿ

        Addingÿcodeÿtoÿconnectÿtheÿreportÿtoÿaÿdataÿsource

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿtheÿgrayÿareaÿbelowÿrptUnboundGrp.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptUnboundGrp'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ239

        l Setÿtheÿdataÿsourceÿconnectionÿstringÿ l SetÿtheÿdataÿsourceÿSQLÿqueryÿ l OpenÿtheÿconnectionÿtoÿcreateÿtheÿDataReaderÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike.ÿBeÿsureÿtoÿchangeÿtheÿDataÿSourceÿ pathÿtoÿreflectÿtheÿlocationÿofÿtheÿNorthwindÿdatabaseÿonÿyourÿsystem. 'VisualÿBasic ImportsÿSystem.Data.OleDb DimÿconnectionÿAsÿSystem.Data.OleDb.OleDbConnection DimÿreaderÿAsÿSystem.Data.OleDb.OleDbDataReader PrivateÿSubÿrptUnboundGrp_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMyBase.ReportStart 'Createÿtheÿdataÿconnectionÿandÿchangeÿtheÿdataÿsourceÿpathÿasÿnecessary DimÿconnectionStringÿAsÿString connectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=c:\Northwind.mdb" connectionÿ=ÿNewÿOleDb.OleDbConnection(connectionString) cnn.Open()

        DimÿsqlStringÿAsÿString sqlStringÿ=ÿ"SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿcategories.categoryid"ÿ_ &ÿ"=ÿproducts.categoryidÿWHEREÿcategories.categoryidÿ=ÿ1" DimÿcommandÿAsÿSystem.Data.OleDb.OleDbCommand command.CommandTextÿ=ÿsqlString command.Connectionÿ=ÿconnection 'Retrieveÿdata readerÿ=ÿcommand.ExecuteReader() EndÿSub

        //C# usingÿSystem.Data.OleDb; privateÿstringÿconnectionString; privateÿSystem.Data.OleDb.OleDbConnectionÿconnection; privateÿSystem.Data.OleDb.OleDbDataReaderÿreader; privateÿvoidÿrptUnboundGrp_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { //Createÿtheÿdataÿconnectionÿandÿchangeÿtheÿdataÿsourceÿpathÿasÿnecessary connectionStringÿ=ÿ@"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=c:\Northwind.mdb"; connection=newÿOleDbConnection(connectionString); connection.Open();

        stringÿsqlStringÿ=ÿ"SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿcategories.categoryid"ÿ+ÿ "=ÿproducts.categoryidÿWHEREÿcategories.categoryidÿ=ÿ1"; System.Data.OleDb.OleDbCommandÿcommandÿ=ÿnewÿSystem.Data.OleDb.OleDbCommand(sqlString,ÿconnection);ÿÿÿ //Retrieveÿdata readerÿ=ÿcommand.ExecuteReader(); }

        Addingÿcodeÿtoÿcloseÿtheÿconnectionÿtoÿtheÿdataÿsource

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l AtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnboundGrp,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ(rptUnboundGrpÿ Events).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿReportEnd.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿrptUnboundGrp'sÿReportEndÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Closeÿtheÿconnectionÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundGrpÿtoÿselectÿtheÿreport.ÿClick onÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿReportEnd.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿrptUnboundGrp'sÿReportEndÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Closeÿtheÿconnectionÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptGrp_ReportEnd(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿSystem.EventArgs)ÿ reader.Close()ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ240

        connection.Close()ÿ EndÿSub

        //C# privateÿvoidÿrptGrp_ReportEnd(objectÿsender,ÿSystem.EventArgsÿeArgs) { reader.Close(); connection.Close(); }

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/Footerÿsectionÿtoÿyourÿreportÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        l ChangeÿtheÿName propertyÿtoÿghCategories

        l ChangeÿtheÿBackColor propertyÿtoÿSilver l ChangeÿtheÿDataField propertyÿtoÿCategoryID

        l SetÿtheÿGroupKeepTogether propertyÿtoÿAll l SetÿtheÿKeepTogether propertyÿtoÿTrue 3. Makeÿtheÿfollowingÿchangeÿtoÿtheÿgroupÿfooter:ÿ

        l ChangeÿtheÿnameÿtoÿgfCategoriesÿ 4. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        TextBoxÿ CategoryNameÿ txtCategoryName Categoryÿ ForeColorÿ=ÿ 0.063,ÿ Name Blue;ÿFontÿsizeÿ 0.063 =ÿ12

        TextBox Descriptionÿ txtDescription Descriptionÿ Sizeÿ=ÿ6,ÿ0.2 0.063,ÿ 0.375ÿ

        Label NA lblProductName Productÿ Bold 0.063,ÿ Nameÿ 0.688

        Label NA lblUnitsInStock UnitsÿInÿ Bold 4.38,ÿ Stockÿ 0.688ÿ

        5. ChangeÿtheÿFontSize propertyÿofÿtxtCategoryName toÿ12,ÿtheÿBackColor propertyÿtoÿLightGray,ÿandÿ theÿForeColor propertyÿtoÿBlue.ÿ 6. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsection:ÿ

        Control DataField Name Text Location

        TextBox ProductNameÿ txtProductName ProductÿNameÿ 0.063,ÿ0.063ÿ

        TextBox UnitsInStockÿ txtUnitsInStock UnitsÿInÿStockÿ 4.75,ÿ0.064ÿ

        7. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupFooterÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        Label TotalLabel lblTotalLabel Totalÿ NA 2.6,ÿ0 Numberÿofÿ Beverages

        TextBox ProductName txtTotalItems TotalÿItems SummaryType =ÿ 4.75,ÿ0 SubTotalÿ SummaryFuncÿ=ÿ Countÿ SummaryRunning =ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ241

        Groupÿ SummaryGroup =ÿ ghCategories

        Line NA Line1 LineWeightÿ=ÿ3 X1ÿ=ÿ 1.875ÿ Y1ÿ=ÿ0ÿ X2ÿ=ÿ 6.438ÿ Y2ÿ=ÿ0ÿ

        UsingÿtheÿDataInitializeÿeventÿtoÿaddÿfields Note: TheÿFieldsÿcollectionÿshouldÿneverÿbeÿaccessedÿoutsideÿtheÿDataInitializeÿandÿFetchDataÿevents.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnboundGrp,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnboundGrp,ÿclickÿtheÿdrop-downÿarrowÿ andÿselectÿ(rptUnboundGrpÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿDataInitialize.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnboundGrp'sÿDataInitializeÿevent.ÿ Addÿcodeÿtoÿtheÿhandlerÿto:ÿ l Addÿfieldsÿtoÿtheÿreport'sÿFieldsÿcollection.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundGrpÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿDataInitialize.ÿThisÿcreatesÿ anÿevent-handlingÿmethodÿforÿrptUnboundGrp'sÿDataInitializeÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Addÿfieldsÿtoÿtheÿreport'sÿFieldsÿcollection.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptUnboundGrp_DataInitialize(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿ_ System.EventArgs)ÿHandlesÿMyBase.DataInitialize Fields.Add("CategoryID") Fields.Add("CategoryName") Fields.Add("ProductName") Fields.Add("UnitsInStock") Fields.Add("Description") Fields.Add("TotalLabel") EndÿSub

        //C# privateÿvoidÿUnboundGrp_DataInitialize(objectÿsender,ÿSystem.EventArgsÿeArgs) { Fields.Add("CategoryID"); Fields.Add("CategoryName"); Fields.Add("ProductName"); Fields.Add("UnitsInStock"); Fields.Add("Description"); Fields.Add("TotalLabel"); }

        UsingÿtheÿFetchDataÿeventÿtoÿpopulateÿtheÿreportÿfields

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnboundGrp,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnboundGrp,ÿclickÿtheÿdrop-downÿarrowÿ andÿselectÿ(rptUnboundGrpÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnboundGrp'sÿFetchDataÿevent.ÿAddÿcodeÿ toÿtheÿhandlerÿto:ÿ

        l Retrieveÿinformationÿtoÿpopulateÿtheÿreportÿfields.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ242

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundGrpÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿrptUnboundGrp'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Retrieveÿinformationÿtoÿpopulateÿtheÿreportÿfields.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptUnboundGrp_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamics.ActiveReports.ActiveReport3.FetchEventArgs)ÿHandlesÿMyBase.FetchData Try reader.Read() Me.Fields("CategoryID").Valueÿ=ÿreader("categories.CategoryID") Me.Fields("CategoryName").Valueÿ=ÿreader("CategoryName") Me.Fields("ProductName").Valueÿ=ÿreader("ProductName") Me.Fields("UnitsInStock").Valueÿ=ÿreader("UnitsInStock") Me.Fields("Description").Valueÿ=ÿreader("Description") Me.Fields("TotalLabel").Valueÿ=ÿ"TotalÿNumberÿofÿ"ÿ+ÿreader("CategoryName")ÿ+ÿ":" eArgs.EOFÿ=ÿFalse CatchÿexÿAsÿException System.Windows.Forms.MessageBox.Show(ex.ToString()) eArgs.EOFÿ=ÿTrue EndÿTry EndÿSub

        //C# privateÿvoidÿUnboundGrp_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3.FetchEventArgsÿeArgs) { try { reader.Read(); Fields["CategoryID"].Valueÿ=ÿreader["categories.CategoryID"].ToString(); Fields["CategoryName"].Valueÿ=ÿreader["CategoryName"].ToString(); Fields["ProductName"].Valueÿ=ÿreader["ProductName"].ToString(); Fields["UnitsInStock"].Valueÿ=ÿreader["UnitsInStock"].ToString(); Fields["Description"].Valueÿ=ÿreader["Description"].ToString(); Fields["TotalLabel"].Valueÿ=ÿ"TotalÿNumberÿofÿ"ÿ+ÿreader["CategoryName"].ToString()ÿ+ÿ":"; eArgs.EOFÿ=ÿfalse; } catch { eArgs.EOFÿ=ÿtrue; } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.ÿWhenÿpreviewingÿreportsÿthatÿhaveÿSQLÿstatementsÿgeneratedÿatÿrunÿtime,ÿaÿSaveÿFileÿAsÿdialogÿ willÿpromptÿyouÿtoÿsaveÿyourÿqueriesÿinÿtheÿprojectÿfolder. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ243

        ÿ

        Walkthrough:ÿKeepTogetherÿOptions

        ActiveReportsÿallowsÿyouÿtoÿsetÿKeepTogetherÿoptionsÿforÿyourÿreportsÿsoÿthatÿtheÿgroupÿdetailÿisÿkeptÿ togetherÿonÿoneÿpageÿwhenÿprinted.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿtheÿKeepTogetherÿandÿGroupKeepTogetherÿoptionsÿtoÿallowÿallÿgroupÿ detailÿtoÿprintÿtogetherÿonÿoneÿpage. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ244

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptKeepTG.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿDISTINCTROWÿOrders.*,ÿ[OrderÿDetails].*,ÿProducts.*ÿFROMÿProductsÿ INNERÿJOINÿ(OrdersÿINNERÿJOINÿ[OrderÿDetails]ÿONÿOrders.OrderIDÿ=ÿ[OrderÿDetails].OrderID)ÿONÿ Products.ProductIDÿ=ÿ[OrderÿDetails].ProductIDÿorderÿbyÿorderdate".ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ245

        8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptKeepTGÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghOrdersÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿRosyBrown ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿOrderDate

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Miscellaneous Name Text Location

        Bold lblOrderDate OrderÿDateÿ 0,ÿ0ÿ

        Bold lblOrderID OrderÿIDÿ 1.13,ÿ0ÿ

        Bold lblProductName ProductÿNameÿ 2.24,ÿ0ÿ

        Bold lblQuantity Quantityÿ 4.63,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ 5.5,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location OutputÿFormat

        orders.OrderID OrderÿID 1.13,ÿ0 NA

        ProductName ProductÿName 2.24,ÿ0 NA

        products.UnitPrice UnitÿPrice 5.5,ÿ0 Currency ÿ

        OrderDate OrderÿDate 0,ÿ0 MM/dd/yy

        Quantity Quantity 4.63,ÿ0 NA

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        HyperlinksÿWalkthroughs

        ActiveReportsÿallowsÿhyperlinksÿtoÿbeÿaddedÿtoÿreports.ÿTheseÿreportsÿcanÿthenÿbeÿpreviewed,ÿdisplayedÿinÿ theÿviewerÿcontrolÿorÿexported.ÿTheÿhyperlinkÿpropertyÿcanÿbeÿsetÿtoÿanyÿHTML-styleÿlink,ÿusedÿtoÿsimulateÿ drill-downÿreportingÿorÿsetÿtoÿitemsÿinÿtheÿTableÿofÿContents.ÿByÿusingÿtheÿhyperlinkÿproperty,ÿreportsÿcanÿ haveÿ"clickable"ÿcontrolsÿthatÿcanÿbeÿusedÿforÿaÿvarietyÿofÿdifferentÿtasks,ÿincludingÿrunningÿandÿdisplayingÿ otherÿreports,ÿexecutingÿmailÿlinks,ÿandÿopeningÿtabbedÿviewsÿthatÿdisplayÿWebÿlinksÿorÿlinksÿtoÿ.ÿ ActiveReportsÿnowÿusesÿtheÿHyperLinkÿpropertyÿofÿcontrolsÿtoÿprovideÿtabbedÿviewingÿforÿTOCÿcontentsÿandÿ Webÿlinks.ÿReportÿnavigationÿbecomesÿmuchÿeasierÿandÿappealingÿtoÿendÿusers,ÿwhoÿcanÿnowÿquicklyÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ246 moveÿfromÿoneÿviewÿtoÿanotherÿthroughÿbyÿclickingÿtheÿtabsÿatÿtheÿtopÿofÿtheÿreport.ÿAdditionally,ÿtheÿviewerÿ nowÿshellsÿoutÿandÿexecutesÿe-mailÿlinksÿasÿdeterminedÿbyÿtheÿoperatingÿsystem.Theÿfollowingÿwalkthroughsÿ demonstrateÿtheÿdifferentÿwaysÿhyperlinkingÿcanÿbeÿusedÿinÿreports. ÿ Hyperlinks DescribesÿhowÿtoÿuseÿHTML-styleÿhyperlinksÿinÿaÿreport.ÿ HyperlinksÿandÿBookmarks Describesÿhowÿtoÿuseÿhyperlinksÿinÿaÿreportÿtoÿgenerateÿanÿindexÿtiedÿtoÿtheÿbookmarksÿcollection.ÿ HyperlinksÿandÿSimulatedÿDrill-DownÿReporting ÿ Describesÿhowÿtoÿuseÿhyperlinksÿinÿaÿreportÿtoÿsimulateÿdrill-downÿreporting.ÿ

        Walkthrough:ÿHyperlinks

        ActiveReportsÿallowsÿyouÿtoÿaddÿhyperlinksÿtoÿreports.ÿTheÿhyperlinkÿpropertyÿcanÿbeÿsetÿtoÿanyÿHTML-styleÿ linkÿsuchÿasÿhttp:// orÿmailto://. Thisÿwalkthroughÿillustratesÿhowÿtoÿaddÿtoÿaddÿhyperlinksÿtoÿaÿreportÿinÿtheÿ PageFooterÿsection. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿdisplayÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ247

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptHyper.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿicon inÿtheÿDetailÿsection toÿopenÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿsuppliersÿorderÿbyÿCompanyName".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ248

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptHyperÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghSuppliersÿ ¡ ChangeÿtheÿDataField propertyÿtoÿCompanyName

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Location

        Labelÿ lblCompanyNameÿ CompanyÿNameÿ 0,ÿ0ÿ

        Labelÿ lblContactNameÿ ContactÿNameÿ 1.562,ÿ0ÿ

        Labelÿ lblPhoneÿ Phoneÿ#ÿ 2.687,ÿ0ÿ

        Labelÿ lblFaxÿ Faxÿ#ÿ 3.812,ÿ0ÿ

        Labelÿ lblHomePage1ÿ HomeÿPageÿ 4.875,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextbox.ÿ

        Field Text Location

        CompanyNameÿ CompanyÿNameÿ 0,ÿ0ÿ

        ContactNameÿ ContactÿNameÿ 1.562,ÿ0ÿ

        Phoneÿ Phoneÿ 2.687,ÿ0ÿ

        Faxÿ Faxÿ 3.812,ÿ0ÿ

        HomePageÿ HomeÿPageÿ 4.854,ÿ0ÿ

        5. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageFooterÿsection:ÿ

        Control Name Text Miscellaneous Location

        Label lblEmail NeedÿAssistance?ÿE- HyperLinkÿ=ÿ 0,ÿ0.125 mailÿSupport:ÿ mailto:[email protected] [email protected]

        Label lblHomePage Visitÿourÿhomeÿpage:ÿ HyperLinkÿ=ÿ 0,ÿ0.375 www.datadynamics.com www.datadynamics.com

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿHyperlinksÿandÿBookmarks ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ249

        ActiveReportsÿallowsÿyouÿtoÿuseÿtheÿhyperlinkÿpropertyÿtoÿreferenceÿbackÿtoÿtheÿbookmarksÿcollection.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿaddÿhyperlinksÿtoÿaÿreportÿthatÿreferencesÿitemsÿinÿtheÿbookmarksÿ collectionÿandÿcreateÿaÿdirectoryÿtoÿmatchÿtheÿitemsÿinÿtheÿbookmarksÿcollection. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿmainÿreportÿtoÿaÿdataÿsourceÿ l AddingÿcontrolsÿtoÿrptMainÿtoÿdisplayÿdataÿ

        l AddingÿcontrolsÿtoÿrptBookmarksÿtoÿdisplayÿdataÿ l Addingÿcodeÿtoÿtheÿmainÿreport'sÿDetail_Formatÿeventÿ l Addingÿcodeÿtoÿtheÿmainÿreport'sÿReportEndÿeventÿ

        l Addingÿcodeÿtoÿtheÿsecondÿreport'sÿDetail_Formatÿeventÿ l Addingÿcodeÿtoÿtheÿsecondÿreport'sÿFetchDataÿeventÿ l Viewingÿtheÿreportÿÿ

        l ViewingÿtheÿBookmarksÿcollectionÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ250

        2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMain.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptBookmarks.ÿ 7. ClickÿOpen.ÿ

        ConnectingÿrptMainÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿsuppliersÿorderÿbyÿCompanyName".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        AddingÿcontrolsÿtoÿrptMainÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptMainÿ(seeÿGroupingÿData forÿhelp).ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghSuppliersÿ ¡ ChangeÿtheÿDataField propertyÿtoÿCompanyName ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue ¡ AddÿtheÿfollowingÿcontrolsÿtoÿghSuppliers:ÿ

        Control Name Text Location

        Labelÿ lblCompanyNameÿ CompanyÿNameÿ 0,ÿ0ÿ

        Labelÿ lblContactNameÿ ContactÿNameÿ 1.562,ÿ0ÿ

        Labelÿ lblPhoneÿ Phoneÿ#ÿ 2.687,ÿ0ÿ

        Labelÿ lblFaxÿ Faxÿ#ÿ 3.812,ÿ0ÿ

        Labelÿ lblHomePage1ÿ HomeÿPageÿ 4.875,ÿ0ÿ

        ¡ InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿ ontoÿtheÿdetailÿsectionÿofÿrptMainÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextbox.ÿ

        Field Text Location

        CompanyNameÿ CompanyÿNameÿ 0,ÿ0ÿ

        ContactNameÿ ContactÿNameÿ 1.562,ÿ0ÿ

        Phoneÿ Phoneÿ 2.687,ÿ0ÿ

        Faxÿ Faxÿ 3.812,ÿ0ÿ

        HomePageÿ HomeÿPageÿ 4.875,ÿ0ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ251

        ¡ SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.ÿ ¡ AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageFooterÿsection:ÿ

        Control Name Text Miscellaneous Location

        Labelÿ lblEmailÿ NeedÿAssistance?ÿE- HyperLinkÿ=ÿ 0,ÿ0.125ÿ mailÿSupport:ÿ mailto:[email protected]ÿ [email protected]ÿ

        Labelÿ lblHomePageÿ Visitÿourÿhomeÿpage:ÿ HyperLinkÿ=ÿ 0,ÿ0.375ÿ www.datadynamics.comÿ www.datadynamics.comÿ

        AddingÿcontrolsÿtoÿrptBookmarksÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.ÿ 2. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageHeaderÿsection:ÿ

        Control Name Text Location

        Labelÿ lblDirectoryÿ Directoryÿ 0.5,ÿ0ÿ

        Labelÿ lblCompanyNameÿ CompanyÿNameÿ 1.125,ÿ0.437ÿ

        Labelÿ lblPageÿ Pageÿ 3.312,ÿ0.437ÿ

        Lineÿ Line1ÿ X1ÿ=ÿ0 X2ÿ=ÿ6.5 Y1ÿ=ÿ0.697 Y2ÿ=ÿ0.697

        3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsection:ÿ

        Control Name Text Location

        TextBox txtEntry CompanyÿName 1.125,ÿ0

        TextBox txtPage Page 3.312,ÿ0

        AddingÿtheÿcodeÿtoÿrptMain'sÿDetail_Formatÿevent AddÿcodeÿtoÿtheÿFormatÿeventÿtoÿparseÿtheÿURLÿoutÿofÿtheÿHomePageÿfieldÿandÿassignÿitÿtoÿtheÿHyperLinkÿ propertyÿofÿtxtHomePage,ÿandÿtoÿremoveÿtheÿURLÿmarkersÿfromÿtheÿtextÿdisplayedÿinÿtxtHomePage.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿtheÿDetailÿsectionÿofÿrptMain.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptMain'sÿ Detail_Formatÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.Detail1.AddBookmark(Me.txtCompanyName.Text) DimÿiStartÿAsÿInteger DimÿsHTMLÿAsÿString IfÿtxtHomePage.Textÿ<>ÿ""ÿThen iStartÿ=ÿInStr(1,ÿtxtHomePage.Text,ÿ"#",ÿCompareMethod.Text) sHTMLÿ=ÿRight(txtHomePage.Text,ÿ(Len(txtHomePage.Text)ÿ - iStart)) sHTMLÿ=ÿReplace(sHTML,ÿ"#",ÿ"",ÿ1,ÿ -1,ÿCompareMethod.Text) txtHomePage.HyperLinkÿ=ÿsHTML txtHomePage.Textÿ=ÿReplace(txtHomePage.Text,ÿ"#",ÿ"",ÿ1,ÿ-1,ÿCompareMethodÿ_ .Text) EndÿIf EndÿSub //C# ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ252

        privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.detail.AddBookmark(this.txtCompanyName.Text); intÿiStart; stringÿsHTML; ifÿ(txtHomePage.Textÿ!=ÿ"") { iStartÿ=ÿtxtHomePage.Text.IndexOf("#",0); sHTMLÿ=ÿtxtHomePage.Text.Substring(iStart,ÿtxtHomePage.Text.Lengthÿ- iStart); sHTMLÿ=ÿsHTML.Replace("#",ÿ""); txtHomePage.HyperLinkÿ=ÿsHTML; txtHomePage.Textÿ=ÿtxtHomePage.Text.Replace("#",ÿ""); } }

        AddingÿtheÿcodeÿtoÿrptMain'sÿReportEndÿevent AddÿcodeÿtoÿtheÿReportEndÿeventÿtoÿrunÿrptBookmarksÿandÿinsertÿitsÿpagesÿcollectionÿatÿtheÿbeginningÿofÿ rptMain.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿsurfaceÿofÿrptMain,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptMain,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ (rptMainÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿReportEnd.ÿ Thisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿReportEndÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptMainÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿReportEnd.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿtheÿReportEndÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿrptMain_ReportEnd(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportEnd DimÿrptÿAsÿNewÿrptBookmarks() rpt.pBMÿ=ÿMe.Document.Bookmarks rpt.Run() Me.Document.Pages.InsertRange(0,ÿrpt.Document.Pages) EndÿSub //C# privateÿvoidÿrptMain_ReportEnd(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptBookmarksÿrptÿ=ÿnewÿrptBookmarks(); rpt.pBMÿ=ÿthis.Document.Bookmarks; rpt.Run(); this.Document.Pages.InsertRange(0,ÿrpt.Document.Pages); }

        AddingÿtheÿcodeÿtoÿrptBookmarks'ÿDetail_Formatÿevent AddÿcodeÿtoÿtheÿFormatÿeventÿtoÿcreateÿaÿhyperlinkÿwhichÿnavigatesÿtoÿaÿbookmarkÿandÿtoÿdisplayÿtheÿpageÿ numberÿofÿtheÿbookmark.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Double-clickÿtheÿDetailÿsectionÿofÿrptBookmarks.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptBookmarks'ÿDetail_Formatÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PublicÿpBMÿAsÿNewÿBookmarksCollection() DimÿiEntryÿAsÿInteger PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format Me.txtEntry.HyperLinkÿ=ÿ"toc://"ÿ+ÿpBM(iEntryÿ- 1).Label ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ253

        Me.txtEntry.Textÿ=ÿpBM(iEntryÿ- 1).Label Me.txtPage.Textÿ=ÿpBM(iEntryÿ- 1).PageNumber EndÿSub //C# publicÿBookmarksCollectionÿpBMÿ=ÿnewÿBookmarksCollection(); intÿiEntry; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.txtEntry.HyperLinkÿ=ÿ"toc://"ÿ+ÿpBM[iEntryÿ- 1].Label; this.txtEntry.Textÿ=ÿpBM[iEntryÿ- 1].Label; this.txtPage.Textÿ=ÿpBM[iEntryÿ- 1].PageNumber.ToString(); }

        AddingÿcodeÿtoÿrptBookmarks'ÿFetchDataÿevent AddÿcodeÿtoÿtheÿFetchDataÿeventÿtoÿgetÿtheÿpageÿnumberÿofÿtheÿbookmark.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptBookmarks,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptBookmarks,ÿclickÿtheÿdrop-downÿarrowÿ andÿselectÿ(rptBookmarksÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptBookmarks'ÿFetchDataÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptBookmarksÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptBookmarks'ÿFetchDataÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿrptBookmarks_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamicsÿ_ .ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData IfÿiEntryÿ>ÿpBM.Countÿ- 1ÿThen eArgs.EOFÿ=ÿTrue Else eArgs.EOFÿ=ÿFalse ÿ iEntryÿ+=ÿ1 EndÿIf EndÿSub //C# privateÿvoidÿrptBookmarks_FetchData(objectÿsender,ÿDataDynamics.ActiveReports .ActiveReport.FetchEventArgsÿeArgs) { ifÿ(iEntryÿ>ÿpBM.Countÿ - 1) { eArgs.EOFÿ=ÿtrue; } else { eArgs.EOFÿ=ÿfalse; iEntryÿ+=ÿ1; } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ254

        ViewingÿtheÿBookmarksÿCollectionÿ

        ToÿviewÿtheÿBookmarksÿcollectionÿ 1. PressÿF5 toÿrunÿtheÿreport.ÿ 2. Clickÿonÿtheÿ"TableÿofÿContents"ÿiconÿtoÿviewÿtheÿBookmarksÿcollection.ÿ

        ÿ

        Walkthrough:ÿHyperlinksÿandÿSimulatedÿDrill-DownÿReporting

        HyperlinksÿcanÿbeÿusedÿinÿActiveReportsÿtoÿsimulateÿdrill-downÿreporting.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿhyperlinksÿinÿaÿreportÿtoÿsimulateÿdrill-downÿreporting.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿeachÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ l AddingÿthreeÿWindowsÿFormsÿwithÿviewerÿcontrolsÿtoÿtheÿprojectÿ

        l AddingÿcodeÿtoÿfrmViewMainÿandÿfrmViewDrillDown1ÿ l AddingÿcodeÿtoÿfrmViewMainÿandÿfrmViewDrillDown2ÿ l Addingÿtheÿcodeÿneededÿtoÿsetÿhyperlinkÿpropertiesÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation: C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿmainÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ255

        AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMain.ÿ 3. ClickÿOpen.ÿ 4. ClickÿtheÿdetailÿsectionÿofÿtheÿreportÿtoÿselectÿitÿandÿchangeÿtheÿBackColor propertyÿtoÿThistle.ÿÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptDrillDown1.ÿ 7. ClickÿOpen.ÿ 8. ClickÿtheÿdetailÿsectionÿofÿtheÿreportÿtoÿselectÿitÿandÿchangeÿtheÿBackColor propertyÿtoÿRosyBrown.ÿ 9. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 10. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptDrillDown2.ÿ 11. ClickÿtheÿdetailÿsectionÿofÿtheÿreportÿtoÿselectÿitÿandÿchangeÿtheÿBackColor propertyÿtoÿLightSteelBlue.ÿ 12. ClickÿOpen.ÿ

        ConnectingÿrptMainÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ256

        2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿorderÿbyÿcustomerID".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ConnectingÿrptDrillDown1ÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿordersÿwhereÿcustomerIDÿ=ÿ<%customerID%>ÿorderÿbyÿ orderdate".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 9. Setÿtheÿreport'sÿShowParameterUI propertyÿtoÿFalse toÿavoidÿdisplayingÿaÿUIÿrequestingÿparameters.

        ConnectingÿrptDrillDown2ÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿBuild.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿwhereÿorderIDÿ=ÿ<%orderID||10248%>ÿorderÿbyÿ productid".ÿ Note: SettingÿaÿdefaultÿvalueÿforÿtheÿparameterÿinÿthisÿqueryÿallowsÿyouÿtoÿseeÿfieldsÿinÿtheÿReportÿ Explorerÿinsteadÿofÿanÿerrorÿmessage. 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 9. Setÿtheÿreport'sÿShowParameterUI propertyÿtoÿFalse toÿavoidÿdisplayingÿaÿUIÿrequestingÿparameters.

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿtheÿfollowingÿcontrolsÿtoÿrptMain,ÿsettingÿtheirÿpropertiesÿasÿindicated:ÿ

        Control Section Location Name DataField Text Miscellaneous

        Label PageHeaderÿ 0,ÿ0ÿ lblCustomer NAÿ Customerÿ ForeColorÿ=ÿ Purple;ÿFontÿ=ÿ 12pt ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ257

        Label PageHeader 1.188,ÿ0ÿ lblCompanyName NAÿ Companyÿ ForeColorÿ=ÿ Nameÿ Purple;ÿFontÿ=ÿ 12ptÿ

        Label PageHeader 3.563,ÿ0ÿ lblContactName ÿ NAÿ Contactÿ ForeColorÿ=ÿ Nameÿ Purple;ÿFontÿ=ÿ 12pt

        TextBox Detailÿ 0,ÿ0ÿ txtCustomerID CustomerIDÿ Customerÿ ForeColorÿ=ÿ IDÿ Blue;ÿUnderlineÿ =ÿTrueÿ

        TextBox Detailÿ 1.183,ÿ0ÿ txtCompanyName ÿ CompanyNameÿ Companyÿ ForeColorÿ=ÿ Nameÿ Black

        TextBox Detailÿ 3.563,ÿ0ÿ txtContactName ContactName Contactÿ ForeColorÿ=ÿ Name Black

        2. AddÿtheÿfollowingÿcontrolsÿtoÿrptDrillDown1,ÿsettingÿtheirÿpropertiesÿasÿindicated:ÿ

        Control Section Location Name DataField Text Miscellaneous

        Label PageHeaderÿ 0,0 lblCustomerID NA Customerÿ ForeColorÿ=ÿ IDÿ Maroon;ÿFontÿ =ÿ12pt

        Label PageHeaderÿ 1.188,ÿ0ÿ lblOrderID NA OrderÿIDÿÿ ForeColorÿ=ÿ Maroon;ÿFontÿ =ÿ12pt

        Label PageHeaderÿ 2.438,ÿ0ÿ lblEmployeeID ÿ NA Employeeÿ ForeColorÿ=ÿ IDÿ Maroon;ÿFontÿ =ÿ12pt

        Label PageHeaderÿ 3.625,ÿ0ÿ lblOrderDate ÿ NA Orderÿ ForeColorÿ=ÿ Dateÿ Maroon;ÿFontÿ =ÿ12pt

        Label PageHeaderÿÿ 4.813,ÿ0ÿ lblShippedDate NA Shippedÿ ForeColorÿ=ÿ Dateÿÿ Maroon;ÿFontÿ =ÿ12pt

        TextBox Detail 0,ÿ0 txtCustomerID CustomerID Customerÿ ForeColorÿ=ÿ ID Black

        TextBox Detailÿ 1.188,ÿ0ÿ txtOrderID OrderID OrderÿID ForeColorÿ=ÿ Blue;ÿUnderlineÿ =ÿTrueÿ

        TextBox Detailÿ 2.438,ÿ0ÿ txtEmployeeID EmployeeIDÿ Employeeÿ ForeColorÿ=ÿ IDÿ Black

        TextBox Detailÿ 3.625,ÿ0ÿ txtOrderDate OrderDateÿ Orderÿ ForeColorÿ=ÿ Dateÿ Black

        TextBox Detailÿ 4.813,ÿ0ÿ txtShippedDate ShippedDateÿ Shippedÿ ForeColorÿ=ÿ Dateÿ Black

        3. AddÿtheÿfollowingÿcontrolsÿtoÿrptDrillDown2,ÿsettingÿtheirÿpropertiesÿasÿindicated:ÿ

        Control Section Location Name DataField Text Miscellaneous

        Label PageHeader 0,ÿ0 lblOrderID NA Orderÿ ForeColorÿ=ÿ ID Navy;ÿFontÿ=ÿ 12pt

        Label PageHeader 1.188,ÿ0 lblProductID NA Productÿ ForeColorÿ=ÿ ID Navy;ÿFontÿ=ÿ 12pt ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ258

        Label PageHeader 2.375,ÿ0 lblUnitPrice NA Unitÿ ForeColorÿ=ÿ Price Navy;ÿFontÿ=ÿ 12pt

        Label PageHeader 3.563,ÿ0 lblQuantity NA Quantity ForeColorÿ=ÿ Navy;ÿFontÿ=ÿ 12pt

        Label PageHeader 4.75,ÿ0 lblDiscount NA Discount ForeColorÿ=ÿ Navy;ÿFontÿ=ÿ 12pt

        TextBox Detail 0,ÿ0 txtOrderID OrderID Orderÿ ForeColorÿ=ÿ ID Black

        TextBox Detail 1.188,ÿ0 txtProductID ProductID Productÿ ForeColorÿ=ÿ ID Black

        TextBox Detail 2.375,ÿ0 txtUnitPrice UnitPrice Unitÿ OutputFormatÿ Price =ÿCurrency

        TextBox Detail 3.563,ÿ0 txtQuantity Quantity Quantity ForeColorÿ=ÿ Black

        TextBox Detail 4.75,ÿ0 txtDiscount Discount Discount OutputFormatÿ =ÿCurrency

        AddingÿthreeÿWindowsÿFormsÿwithÿviewerÿcontrolsÿtoÿyourÿproject

        ToÿaddÿthreeÿWindowsÿFormsÿwithÿviewerÿcontrolsÿtoÿyourÿproject 1. ChangeÿtheÿnameÿofÿtheÿdefaultÿWindowsÿFormÿtoÿfrmViewMain.ÿ 2. PlaceÿanÿActiveReportsÿviewerÿcontrolÿonÿfrmViewMainÿandÿsetÿitsÿDock propertyÿtoÿFill.ÿ 3. ClickÿonÿProject >ÿAddÿWindowsÿForm.ÿ 4. SelectÿWindowsÿFormÿandÿrenameÿitÿfrmViewDrillDown1.ÿ 5. ClickÿOpen.ÿ 6. PlaceÿanÿActiveReportsÿviewerÿcontrolÿonÿfrmViewDrillDown1ÿandÿsetÿitsÿDock propertyÿtoÿFill.ÿ 7. ClickÿonÿProject >ÿAddÿWindowsÿForm.ÿ 8. SelectÿWindowsÿForm andÿrenameÿitÿfrmViewDrillDown2.ÿ 9. ClickÿOpen.ÿ 10. PlaceÿanÿActiveReportsÿviewerÿcontrolÿonÿfrmViewDrillDown2ÿandÿsetÿitsÿDock propertyÿtoÿFill.ÿÿ

        AddingÿcodeÿtoÿfrmViewMain

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿatÿtheÿtopÿofÿfrmViewMainÿtoÿdisplayÿtheÿcodeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿ viewÿforÿfrmViewMain,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿViewer1.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿ clickÿtheÿdrop-downÿarrowÿandÿselectÿHyperlink.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿfrmViewMain'sÿ Viewer1_Hyperlinkÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿViewerÿsectionÿofÿfrmViewMainÿtoÿselectÿtheÿviewer.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿviewer.ÿDouble-clickÿHyperlink.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿfrmViewMain'sÿViewer1_Hyperlinkÿevent. Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿViewer1_HyperLink(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿDataDynamics.ActiveReportsÿ_ÿ.Viewer.HyperLinkEventArgs)ÿHandlesÿViewer1.HyperLinkÿ Dimÿrpt2ÿAsÿNewÿrptDrillDown1()ÿ Dimÿfrm2ÿAsÿNewÿfrmViewDrillDown1()ÿ rpt2.Parameters("customerID").Valueÿ=ÿe.HyperLink.ToStringÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ259

        rpt2.Run()ÿ frm2.My_Viewer.Documentÿ=ÿrpt2.Documentÿ frm2.ShowDialog(Me)ÿÿ EndÿSubÿ

        //C#ÿ privateÿvoidÿviewer1_HyperLink(objectÿsender,ÿDataDynamics.ActiveReports.Viewerÿ.HyperLinkEventArgsÿe)ÿ {ÿ rptDrillDown1ÿrpt2ÿ=ÿnewÿrptDrillDown1();ÿ frmViewDrillDown1ÿfrm2ÿ=ÿnewÿfrmViewDrillDown1();ÿ rpt2.Parameters["customerID"].Valueÿ=ÿe.HyperLink.ToString(); rpt2.Run();ÿ frm2.viewer1.Documentÿ=ÿrpt2.Document;ÿ frm2.ShowDialog(this);ÿ }

        AddingÿcodeÿtoÿfrmViewDrillDown1

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿatÿtheÿtopÿofÿfrmViewDrillDown1ÿtoÿdisplayÿtheÿcodeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿ codeÿviewÿforÿfrmViewDrillDown1,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿViewer1.ÿAtÿtheÿtopÿrightÿofÿtheÿ codeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿHyperlink.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ frmViewDrillDown1'sÿViewer1_Hyperlinkÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿViewerÿsectionÿofÿfrmViewDrillDown1ÿtoÿselectÿtheÿviewer.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿviewer.ÿDouble-clickÿHyperlink.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿfrmViewDrillDown'sÿViewer1_Hyperlinkÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿViewer1_HyperLink(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿDataDynamicsÿ_ .ActiveReports.Viewer.HyperLinkEventArgs)ÿHandlesÿViewer1.HyperLink Dimÿrpt3ÿAsÿNewÿrptDrillDown2() Dimÿfrm3ÿAsÿNewÿfrmViewDrillDown2() rpt3.Parameters("orderID").Valueÿ=ÿe.HyperLink.ToString rpt3.Run() frm3.My_Viewer.Documentÿ=ÿrpt3.Document frm3.ShowDialog(Me) EndÿSub

        //C# privateÿvoidÿviewer1_HyperLink(objectÿsender,ÿDataDynamics.ActiveReports.Viewer .HyperLinkEventArgsÿe) { rptDrillDown2ÿrpt3ÿ=ÿnewÿrptDrillDown2(); frmViewDrillDown2ÿfrm3ÿ=ÿnewÿfrmViewDrillDown2(); rpt3.Parameters["orderID"].Valueÿ=ÿe.HyperLink.ToString(); rpt3.Run(); frm3.My_Viewer.Documentÿ=ÿrpt3.Document; frm3.ShowDialog(this); }

        AddingÿcodeÿtoÿfrmViewDrillDown

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿatÿtheÿtopÿofÿfrmViewDrillDown1ÿtoÿdisplayÿtheÿcodeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿ codeÿviewÿforÿfrmViewDrillDown1,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿViewer1.ÿAtÿtheÿtopÿrightÿofÿtheÿ codeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿHyperlink.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ frmViewDrillDown1'sÿViewer1_Hyperlinkÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿViewerÿsectionÿofÿfrmViewDrillDown1ÿtoÿselectÿtheÿviewer.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿviewer.ÿDouble-clickÿHyperlink.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿfrmViewDrillDown'sÿViewer1_Hyperlinkÿevent.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ260

        Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic 'CreateÿaÿpropertyÿtoÿreturnÿtheÿActiveReportsÿviewer FriendÿReadOnlyÿPropertyÿMy_Viewer()ÿAsÿDataDynamics.ActiveReports.Viewer.Viewer Get ReturnÿMe.Viewer1 EndÿGet EndÿProperty

        //C# //CreateÿaÿpropertyÿtoÿreturnÿtheÿActiveReportsÿviewer. internalÿDataDynamics.ActiveReports.Viewer.ViewerÿMy_Viewer { get { returnÿthis.viewer1; } }

        AddingÿtheÿcodeÿneededÿtoÿsetÿtheÿhyperlinkÿpropertyÿforÿrptMain

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptMain,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptMain,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ Detail.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿBeforePrint.ÿThisÿcreatesÿ anÿevent-handlingÿmethodÿforÿrptMain'sÿDetail_BeforePrintÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿDetailÿsectionÿofÿrptMainÿtoÿselectÿtheÿsection.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿBeforePrint.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿrptMain'sÿDetail_BeforePrintÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail_BeforePrint(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail.BeforePrint Me.txtCustomerID.HyperLinkÿ=ÿMe.txtCustomerID.Text EndÿSub

        //C# privateÿvoidÿDetail_BeforePrint(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.txtCustomerID.HyperLinkÿ=ÿthis.txtCustomerID.Text; }

        AddingÿtheÿcodeÿneededÿtoÿsetÿtheÿhyperlinkÿpropertyÿforÿrptDrillDown1

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptDrillDown1,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptDrillDown1,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿDetail.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿBeforePrint.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿrptDrillDown1'sÿDetail_BeforePrintÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿDetailÿsectionÿofÿrptDrillDown1ÿtoÿselectÿtheÿsection.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿBeforePrint.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿrptDrillDown1'sÿDetail_BeforePrintÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail_BeforePrint(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail.BeforePrint Me.txtOrderID.HyperLinkÿ=ÿMe.txtOrderID.Text EndÿSub ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ261

        //C# privateÿvoidÿDetail_BeforePrint(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.txtOrderID.HyperLinkÿ=ÿtxtOrderID.Text; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿofÿfrmViewMainÿequalÿtoÿtheÿdocumentÿforÿrptMain.ÿSeeÿ UsingÿtheÿActiveReportsÿWinFormÿViewer forÿhelp.ÿ 2. ClickÿtheÿhyperlinkÿinÿfrmViewMainÿtoÿdrill-downÿtoÿtheÿnextÿreportÿlevel.

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        LocalizationÿWalkthroughs

        ActiveReportsÿprovidesÿsupportÿforÿtheÿActiveReportsÿrunÿtimeÿdialogsÿtoÿbeÿlocalized.ÿTheÿfollowingÿ walkthroughsÿexplainÿhowÿtoÿlocalizeÿtheÿActiveReportsÿviewerÿcontrol,ÿdesignerÿcontrol,ÿandÿreportÿengine. ÿ LocalizingÿtheÿViewerÿControl DescribesÿhowÿtoÿsetÿupÿlocalizationÿforÿtheÿActiveReportsÿViewerÿcontrol.ÿ LocalizingÿtheÿReportÿEngine ÿ DescribesÿhowÿtoÿsetÿupÿlocalizationÿforÿtheÿActiveReportsÿReportÿEngine.

        LocalizingÿtheÿActiveReportsÿViewerÿControl

        InÿActiveReports,ÿtheÿviewerÿcontrolÿandÿassociatedÿdialogsÿcanÿbeÿlocalized.ÿ ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿlocalizedÿstringsÿforÿtheÿActiveReportsÿviewerÿcontrol. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l Creatingÿaÿdirectoryÿ

        l UsingÿtheÿWindowsÿResourceÿLocalizationÿEditorÿforÿtheÿresourceÿfilesÿÿ l RunningÿtheÿSatelliteÿAssemblyÿUtilityÿtoÿcreateÿaÿsatelliteÿassemblyÿ

        l AddingÿtheÿActiveReportsÿViewerÿcontrolÿtoÿtheÿprojectÿÿ l AddingÿCodeÿtoÿChangeÿtheÿCultureÿInformationÿ(Optionalÿstep)ÿ l Runningÿtheÿprojectÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿtheÿfollowingÿfiles:ÿ ¡ Strings.txtÿ ¡ Descriptions.txtÿ

        ¡ FindDialog.resxÿ ¡ PrintingStatus.resxÿ

        ¡ TableOfContents.resxÿ

        ¡ PublicKey.snkÿ ¡ SatelliteAssembly.exe YouÿcanÿfindÿtheseÿfilesÿinÿyourÿProgramÿFiles/DataÿDynamics/ActiveReportsÿforÿ.NETÿ 3.0/Localization folder.ÿYouÿwillÿalsoÿneedÿaccessÿtoÿtheÿcurrentÿActiveReports.Viewer.dllÿinstalledÿonÿyourÿ machine,ÿwhichÿyouÿcanÿfindÿinÿtheÿProgramÿFiles/CommonÿFiles/DataÿDynamics/ActiveReportsÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ262

        forÿ.NETÿ3.0 folder. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿlocalizedÿActiveReportsÿviewerÿcontrolÿthatÿlooksÿ similarÿtoÿtheÿfollowing.ÿForÿpurposesÿofÿthisÿwalkthrough,ÿJapaneseÿwasÿusedÿtoÿlocalizeÿtheÿviewerÿcontrol.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject.ÿ 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        CreatingÿaÿDirectory

        Toÿcreateÿaÿdirectory 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿproject'sÿEXEÿfileÿwillÿbeÿcontainedÿwhenÿ theÿreportÿisÿrun.ÿForÿVisualÿBasicÿ.NET,ÿthisÿwillÿbeÿtheÿbin folder.ÿForÿC#,ÿthisÿwillÿbeÿtheÿbin/Debug folder.ÿ 2. OnÿtheÿFile menu,ÿclickÿNewÿ>ÿFolder.ÿ 3. NameÿtheÿfolderÿaccordingÿtoÿtheÿCultureInfoÿthatÿyouÿwillÿuseÿtoÿlocalizeÿyourÿproject.ÿForÿexample,ÿyouÿ wouldÿuseÿ"ja"ÿforÿJapanese.ÿ 4. Copyÿtheÿrequiredÿfilesÿ(Strings.txt,ÿDescriptions.txt,ÿPrintingStatus.resx,ÿFindDialog.resx,ÿ TableOfContents.resx,ÿSatelliteAssembly.exe,ÿActiveReports.Viewer.dll,ÿandÿPublicKey.snk)ÿtoÿthisÿnewÿ folder.ÿ

        UsingÿtheÿWindowsÿResourceÿLocalizationÿEditor

        ToÿuseÿtheÿWindowsÿResourceÿLocalizationÿEditorÿ 1. OpenÿaÿVisualÿStudioÿ.NETÿ2003ÿorÿ2005ÿcommandÿprompt.ÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ263

        2. RunÿtheÿWindowsÿResourceÿLocalizationÿEditorÿbyÿtypingÿ"winres"ÿandÿhittingÿEnter.ÿThisÿeditorÿallowsÿ youÿtoÿeditÿdialogÿ.resxÿfilesÿforÿaÿcertainÿlocale.ÿTheÿutilityÿisÿincludedÿasÿpartÿofÿtheÿ.NETÿframework.ÿ 3. ClickÿonÿFileÿ>ÿOpen onÿtheÿLocalizationÿEditor'sÿmenuÿbar.ÿ 4. Changeÿtheÿfileÿtypeÿtoÿ"ResXÿFile(*.resx)".ÿ 5. Navigateÿtoÿtheÿdirectoryÿthatÿyouÿcreatedÿandÿcopiedÿtheÿrequiredÿfilesÿinto,ÿchooseÿtheÿFindDialog.resxÿ file,ÿandÿclickÿOpenÿtoÿopenÿtheÿfileÿinÿtheÿEditor.ÿ 6. Onÿtheÿmenuÿbar,ÿclickÿFileÿ>ÿSave,ÿselectÿyourÿlocalizationÿcultureÿfromÿtheÿlist,ÿandÿthenÿpressÿOK.ÿ 7. RepeatÿStepsÿ3-6ÿforÿtheÿPrintingStatus.resxÿfile.ÿ 8. RepeatÿStepsÿ3-6ÿforÿtheÿTableOfContents.resxÿfile.ÿ 9. CloseÿtheÿWindowsÿResourceÿLocalizationÿEditor.ÿ 10. CloseÿtheÿVisualÿStudioÿ.NETÿ2003ÿorÿ2005ÿcommandÿpromptÿwindow.ÿ 11. InÿWindowsÿExplorer,ÿbrowseÿtheÿtheÿfolderÿcontainingÿtheÿrequiredÿfilesÿandÿrenameÿtheÿ.txtÿfilesÿ (Strings.txtÿandÿDescriptions.txt)ÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿForÿexample,ÿyouÿ wouldÿchangeÿ"Strings.txt"ÿtoÿ"Strings.ja.txt"ÿforÿJapanese.ÿ Note: Ifÿanyÿ.resxÿfilesÿcontainÿcomboÿboxÿitemsÿthenÿtheÿ.resxÿfilesÿneedÿtoÿbeÿmodifiedÿafterÿtheyÿareÿ saved.ÿ

        RunningÿtheÿSatelliteÿAssemblyÿUtility

        ToÿrunÿtheÿSatelliteÿAssemblyÿUtility 1. Double-clickÿtheÿSatelliteAssembly.exeÿfileÿtoÿrunÿtheÿutility.ÿ 2. Onÿtheÿmenuÿbar,ÿselectÿFileÿ>ÿNew.ÿThisÿcreatesÿaÿprojectÿwindowÿforÿtheÿSatelliteÿassembly.ÿ 3. Onÿtheÿmenuÿbar,ÿselectÿEditÿ>ÿProperties.ÿ 4. OnÿtheÿBuildÿtabÿofÿtheÿPropertiesÿdialog:ÿ

        ¡ Selectÿtheÿcorrectÿlocalizationÿculture.ÿ ¡ Setÿtheÿinputÿandÿoutputÿdirectoriesÿtoÿtheÿdirectoryÿyouÿcreatedÿthatÿcontainsÿtheÿ.resxÿandÿ.txtÿfiles.ÿ

        ¡ Setÿtheÿoutputÿfileÿnameÿtoÿ"ActiveReports.Viewer.resources.dll".ÿ

        ¡ SelectÿorÿtypeÿinÿtheÿFrameworkÿversionÿtoÿmatchÿtheÿnumberÿfoundÿinÿtheÿVisualÿStudioÿHelpÿmenuÿ>ÿ Aboutÿdialog. 5. OnÿtheÿAssemblyÿtabÿofÿtheÿPropertiesÿdialog:ÿ ¡ InÿtheÿAssemblyÿAttributesÿsection,ÿsetÿtheÿVersionÿnumberÿtoÿmatchÿtheÿversionÿofÿtheÿ ActiveReports.Viewer.dllÿfile locatedÿinÿtheÿdirectoryÿyouÿcreated.ÿ ¡ InÿtheÿDelayedÿSigningÿsection,ÿsetÿtheÿStrongÿNameÿKeyFileÿtoÿtheÿpublickey.snkÿkeyÿfileÿinÿtheÿ directoryÿyouÿcreated.ÿ

        ¡ InÿtheÿUseÿTemplateÿFileÿsection,ÿbrowseÿtoÿtheÿActiveReports.Viewer.dllÿfileÿlocatedÿinÿtheÿdirectoryÿ youÿcreated.ÿClickÿOKÿtoÿcontinue.ÿ 6. Right-clickÿonÿtheÿResourceÿfileÿlistÿviewÿandÿselectÿAdd.ÿ 7. WithÿtheÿFileÿTypeÿsetÿtoÿ"Resx",ÿaddÿtheÿFindDialog,ÿPrintingStatus,ÿandÿTableOfContentsÿ.resxÿfilesÿthatÿ haveÿtheÿcultureÿinformationÿaddedÿtoÿtheÿfileÿnames.ÿForÿexample,ÿforÿJapanese,ÿyouÿwouldÿchooseÿ "FindDialog.ja.resx"ÿandÿ"PrintingStatus.ja.resx"ÿandÿ"TableOfContents.ja.resx".ÿClickÿOKÿtoÿaddÿtheÿfilesÿ toÿtheÿlist.ÿ 8. Right-clickÿonÿtheÿlistÿviewÿandÿselectÿAdd again.ÿChangeÿtheÿFileÿTypeÿtoÿ"StringsÿFile"ÿandÿselectÿtheÿ twoÿ.txtÿfilesÿthatÿyouÿrenamedÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿClickÿOK toÿaddÿtheÿfilesÿtoÿtheÿ list.ÿ 9. Selectÿallÿofÿtheÿfilesÿinÿtheÿlistÿview,ÿthenÿright-clickÿandÿselectÿEdit toÿopenÿtheÿEditÿdialogÿforÿeachÿfile.ÿ 10. Changeÿtheÿnamespaceÿforÿeachÿculture-localizedÿfileÿaccordingÿtoÿtheÿlistÿbelow.ÿClickÿOK afterÿeachÿ changeÿtoÿsaveÿtheÿnamespaceÿchanges.ÿÿ

        File Namespace

        FindDialog DataDynamics.ActiveReports.Viewer ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ264

        PrintingStatus DataDynamics.ActiveReports.Document

        TableOfContents DataDynamics.ActiveReports.Viewer

        Strings DataDynamics.ActiveReports.Viewer.Resources

        Descriptions DataDynamics.ActiveReports.Viewer.Resources

        11. SelectÿSaveÿAs. fromÿtheÿFileÿmenu.ÿClickÿtheÿOK button.ÿThisÿwillÿcreateÿaÿ.locÿfileÿforÿtheÿcultureÿyouÿ haveÿchosenÿwhichÿcontainsÿallÿofÿtheÿproject-relatedÿinformation.ÿ 12. Double-clickÿonÿeachÿitemÿinÿtheÿlistÿview,ÿselectÿEditor,ÿandÿeditÿeachÿfileÿforÿtheÿlanguageÿyouÿhaveÿ chosenÿtoÿlocalize.ÿBelowÿisÿanÿimageÿofÿpartÿofÿtheÿ"Strings.ja.txt"ÿfileÿusedÿforÿthisÿproject.ÿ

        Note: YouÿneedÿtoÿincludeÿreferencesÿtoÿtheÿRtfExportÿandÿTextExportÿdllsÿinÿorderÿtoÿenableÿtheÿ viewer'sÿcopyÿbutton.ÿ 13. Whenÿallÿofÿtheÿresourcesÿhaveÿbeenÿlocalized,ÿyouÿcanÿbuildÿtheÿSatelliteÿassemblyÿ (ActiveReports.Viewer.resources.dll)ÿbyÿselectingÿBuildÿAssemblyÿfromÿtheÿBuildÿmenu.ÿ Note: Ifÿyouÿareÿunableÿtoÿeditÿtheÿ.txtÿfilesÿusingÿtheÿSatelliteÿAssemblyÿutility,ÿyouÿcanÿopenÿtheÿfilesÿ usingÿNotepadÿandÿsaveÿthemÿwithÿUnicodeÿencodingÿinsteadÿofÿANSI.ÿ

        AddingÿtheÿActiveReportsÿViewerÿcontrol

        Toÿaddÿtheÿviewerÿcontrol 1. DragÿandÿdropÿtheÿActiveReportsÿViewerÿcontrolÿfromÿtheÿappropriateÿtoolboxÿtoÿForm1.ÿ 2. SetÿtheÿDock propertyÿforÿtheÿviewerÿtoÿFill.ÿ

        AddingÿCodeÿtoÿChangeÿtheÿCultureÿInformationÿ(OptionalÿStep) Note: Thisÿstepÿisÿonlyÿnecessaryÿifÿyouÿareÿdevelopingÿonÿaÿmachineÿwithÿcultureÿinformationÿdifferentÿ fromÿthatÿinÿtheÿprojectÿyouÿareÿlocalizing.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ265

        Toÿaddÿcodeÿtoÿchangeÿtheÿcultureÿinformationÿÿ l Addÿtheÿfollowingÿcodeÿinÿtheÿform'sÿconstructorÿjustÿbeforeÿtheÿInitializeComponentÿmethodÿisÿcalled.ÿ Makeÿsureÿyouÿreplaceÿtheÿ"ja"ÿshownÿinÿtheÿexampleÿcodeÿwithÿtheÿappropriateÿcultureÿinformationÿforÿ yourÿproject.ÿÿ l 'ÿVisualÿBasic System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿNewÿSystem.Globalizationÿ_ .CultureInfo("ja") //C# System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿnewÿSystem.Globalization .CultureInfo("ja");

        RunningÿtheÿProject

        Toÿrunÿtheÿproject 1. PressÿF5 toÿrunÿtheÿapplication.ÿ 2. IfÿtheÿsatelliteÿassemblyÿinÿtheÿdirectoryÿyouÿcreatedÿhasÿonlyÿbeenÿsignedÿwithÿtheÿDataÿDynamicsÿpublicÿ key,ÿyouÿwillÿneedÿtoÿturnÿoffÿsnÿsecurityÿforÿtheÿassembly.ÿYouÿcanÿdoÿthisÿbyÿgoingÿtoÿtheÿVisualÿ Studioÿ.NETÿcommandÿprompt,ÿbrowsingÿtoÿtheÿdirectoryÿinÿwhichÿtheÿfileÿisÿlocatedÿandÿtypingÿinÿtheÿ followingÿline:ÿ"snÿ-VrÿActiveReports.Viewer.resources.dll".ÿ Note: Priorÿtoÿdeployingÿtheÿproject,ÿyouÿcanÿsendÿtheÿActiveReports.Design2.resources.dllÿfileÿtoÿ [email protected]ÿ toÿhaveÿitÿsigned.ÿWhenÿyouÿdeployÿtheÿproject,ÿifÿyourÿotherÿ DLLsÿareÿbeingÿsentÿtoÿtheÿGlobalÿAssemblyÿCache,ÿthisÿfileÿwillÿalsoÿneedÿtoÿbeÿsentÿthere.

        LocalizingÿtheÿActiveReportsÿEngine

        InÿActiveReports,ÿtheÿreportÿengineÿandÿassociatedÿdialogsÿcanÿbeÿlocalized.ÿ ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿlocalizedÿstringsÿforÿtheÿActiveReportsÿreportÿengine. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l Creatingÿaÿdirectoryÿ

        l UsingÿtheÿWindowsÿResourceÿLocalizationÿEditorÿforÿtheÿresourceÿfilesÿÿ

        l RunningÿtheÿSatelliteÿAssemblyÿUtilityÿtoÿcreateÿaÿsatelliteÿassemblyÿ l AddingÿanÿActiveReportÿwithÿparametersÿtoÿtheÿprojectÿÿ

        l Addingÿcodeÿtoÿchangeÿtheÿcultureÿinformationÿforÿtheÿprojectÿ(optionalÿstep)ÿ l Runningÿtheÿprojectÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿtheÿfollowingÿfiles:ÿ

        ¡ Strings.txtÿ ¡ Descriptions.txtÿ ¡ ParamPromptDialog.resxÿ

        ¡ PublicKey.snkÿ ¡ SatelliteAssembly.exe YouÿcanÿfindÿtheseÿfilesÿinÿyourÿProgramÿFiles/DataÿDynamics/ActiveReportsÿforÿ.NETÿ 3.0/Localization folder.ÿYouÿwillÿalsoÿneedÿaccessÿtoÿtheÿcurrentÿActiveReports.dllÿinstalledÿonÿyourÿmachineÿ whichÿyouÿcanÿfindÿinÿtheÿProgramÿFiles/CommonÿFiles/DataÿDynamics/ActiveReportsÿforÿ.NETÿ3.0 folder. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿlocalizedÿActiveReportsÿparametersÿdialogÿthatÿ looksÿsimilarÿtoÿtheÿfollowing.ÿForÿpurposesÿofÿthisÿscreenÿshot,ÿJapaneseÿwasÿusedÿtoÿlocalizeÿtheÿreportÿ engine. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ266

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject.ÿ 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        CreatingÿaÿDirectory

        Toÿcreateÿaÿdirectory 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿproject'sÿEXEÿfileÿwillÿbeÿcontainedÿwhenÿ theÿreportÿisÿrun.ÿForÿVisualÿBasicÿ.NET,ÿthisÿwillÿbeÿtheÿ"bin"ÿfolder.ÿForÿC#,ÿthisÿwillÿbeÿtheÿ"bin/Debug"ÿ folder.ÿ 2. OnÿtheÿFile menu,ÿclickÿNewÿ>ÿFolder.ÿ 3. NameÿtheÿfolderÿaccordingÿtoÿtheÿCultureInfoÿthatÿyouÿwillÿuseÿtoÿlocalizeÿyourÿproject.ÿForÿexample,ÿyouÿ wouldÿuseÿ"ja"ÿforÿJapanese.ÿ 4. Copyÿtheÿrequiredÿfilesÿ(Strings.txt,ÿDescriptions.txt,ÿParamPromptDialog.resx,ÿActiveReports.dll,ÿ PublicKey.snk,ÿandÿSatelliteAssembly.exe)ÿtoÿthisÿnewÿfolder.ÿ

        UsingÿtheÿWindowsÿResourceÿLocalizationÿEditor

        ToÿuseÿtheÿWindowsÿResourceÿLocalizationÿEditorÿ 1. OpenÿaÿVisualÿStudioÿ.NETÿ2003ÿorÿ2005ÿcommandÿpromptÿfromÿtheÿStartÿmenuÿ>ÿAllÿProgramsÿ>ÿVisualÿ Studioÿ.NETÿ>ÿVisualÿStudioÿ.NETÿTools.ÿÿ 2. RunÿtheÿWindowsÿResourceÿLocalizationÿEditorÿbyÿtypingÿ"winres"ÿandÿhittingÿEnter.ÿThisÿeditorÿallowsÿ youÿtoÿeditÿdialogÿ.resxÿfilesÿforÿaÿcertainÿlocale.ÿTheÿutilityÿisÿincludedÿasÿpartÿofÿtheÿ.NETÿframework.ÿ 3. Clickÿon Fileÿ>ÿOpen onÿtheÿLocalizationÿEditor'sÿmenuÿbar.ÿ 4. Changeÿtheÿfileÿtypeÿtoÿ"ResXÿFile(*.resx)".ÿ 5. Navigateÿtoÿtheÿdirectoryÿthatÿyouÿcreatedÿandÿcopiedÿtheÿrequiredÿfilesÿinto,ÿchooseÿtheÿ ParamPromptDialog.resxÿfile,ÿandÿclickÿOpenÿtoÿopenÿtheÿfileÿinÿtheÿEditor.ÿ 6. Onÿtheÿmenuÿbar,ÿclickÿFileÿ>ÿSave,ÿselectÿyourÿlocalizationÿcultureÿfromÿtheÿlist,ÿandÿthenÿpressÿOK .ÿ 7. CloseÿtheÿWindowsÿResourceÿLocalizationÿEditor.ÿ 8. CloseÿtheÿVisualÿStudioÿ.NETÿ2003ÿorÿ2005ÿcommandÿpromptÿwindow.ÿ 9. InÿWindowsÿExplorer,ÿbrowseÿtoÿtheÿfolderÿcontainingÿtheÿrequiredÿfilesÿandÿrenameÿtheÿ.txtÿfilesÿ (Strings.txtÿandÿDescriptions.txt)ÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿForÿexample,ÿyouÿ wouldÿchangeÿ"Strings.txt"ÿtoÿ"Strings.ja.txt"ÿforÿJapanese.ÿ Note Ifÿanyÿ.resxÿfilesÿcontainÿcomboÿboxÿitemsÿthenÿtheÿ.resxÿfilesÿneedÿtoÿbeÿmodifiedÿafterÿtheyÿareÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ267

        saved.ÿ

        RunningÿtheÿSatelliteÿAssemblyÿUtility

        ToÿrunÿtheÿSatelliteÿAssemblyÿUtility 1. Double-clickÿtheÿSatelliteAssembly.exeÿfileÿtoÿrunÿtheÿutility.ÿ 2. Onÿtheÿmenuÿbar,ÿselect Fileÿ>ÿNew.ÿThisÿcreatesÿaÿprojectÿwindowÿforÿtheÿSatelliteÿassembly.ÿ 3. Onÿtheÿmenuÿbar,ÿselectÿEditÿ>ÿProperties. 4. OnÿtheÿBuildÿtabÿofÿtheÿPropertiesÿdialog:ÿ ¡ Selectÿtheÿcorrectÿlocalizationÿculture.ÿ

        ¡ Setÿtheÿinputÿandÿoutputÿdirectoriesÿtoÿtheÿdirectoryÿyouÿcreatedÿthatÿcontainsÿtheÿ.resxÿandÿ.txtÿfiles.ÿ ¡ Setÿtheÿoutputÿfileÿnameÿtoÿ"ActiveReports.resources.dll".ÿ

        ¡ Selectÿorÿtypeÿtheÿcorrectÿ.NETÿFrameworkÿversion. 5. OnÿtheÿAssemblyÿtabÿofÿtheÿPropertiesÿdialog:ÿ ¡ InÿtheÿAssemblyÿAttributesÿsection,ÿsetÿtheÿVersionÿnumberÿtoÿmatchÿtheÿversionÿofÿtheÿ ActiveReports.dllÿfile locatedÿinÿtheÿdirectoryÿyouÿcreated.ÿ ¡ InÿtheÿDelayedÿSigningÿsection,ÿsetÿtheÿStrongÿNameÿKeyFileÿtoÿtheÿpublickey.snkÿkeyÿfileÿinÿtheÿ directoryÿyouÿcreated.ÿ ¡ InÿtheÿUseÿTemplateÿFileÿsection,ÿbrowseÿtoÿtheÿActiveReports.dllÿfileÿlocatedÿinÿtheÿdirectoryÿyouÿ created.ÿClickÿOK toÿcontinue.ÿ 6. Right-clickÿonÿtheÿResourceÿfileÿlistÿviewÿandÿselectÿAdd.ÿ 7. WithÿtheÿFileÿType setÿtoÿ"Resx",ÿaddÿtheÿParamPromptDialog.resxÿfileÿthatÿhasÿtheÿcultureÿinformationÿ addedÿtoÿtheÿfileÿname.ÿForÿexample,ÿforÿJapanese,ÿyouÿwouldÿchooseÿ"ParamPromptDialog.ja.resxÿ".ÿClickÿ Open toÿaddÿtheÿfileÿtoÿtheÿlist.ÿ 8. Right-clickÿonÿtheÿlistÿviewÿandÿselectÿAdd. again.ÿChangeÿtheÿFileÿType toÿ"StringsÿFile"ÿandÿselectÿtheÿ twoÿ.txtÿfilesÿthatÿyouÿrenamedÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿClickÿOpen toÿaddÿtheÿfilesÿtoÿ theÿlist.ÿ 9. Selectÿallÿofÿtheÿfilesÿinÿtheÿlistÿview,ÿthenÿright-clickÿandÿselectÿEdit toÿopenÿtheÿEditÿdialogÿforÿeachÿfile.ÿ 10. Changeÿtheÿnamespaceÿforÿeachÿculture-localizedÿfileÿaccordingÿtoÿtheÿlistÿbelow.ÿClickÿOK afterÿeachÿ changeÿtoÿsaveÿtheÿnamespaceÿchanges.ÿÿ

        File Namespace

        ParamPromptDialog DataDynamics.ActiveReports

        Strings DataDynamics.ActiveReports.Viewer.Resources

        Descriptions DataDynamics.ActiveReports.Viewer.Resources

        11. SelectÿSaveÿAs. fromÿtheÿFileÿmenu.ÿClickÿtheÿSave button.ÿThisÿwillÿcreateÿaÿ.locÿfileÿforÿtheÿcultureÿyouÿ haveÿchosenÿwhichÿcontainsÿallÿofÿtheÿproject-relatedÿinformation.ÿ 12. Double-clickÿonÿeachÿitemÿinÿtheÿlistÿview,ÿselectÿEditor.,ÿandÿeditÿeachÿfileÿforÿtheÿlanguageÿyouÿhaveÿ chosenÿtoÿlocalize.ÿBelowÿisÿanÿimageÿofÿpartÿofÿtheÿ"Strings.ja.txt"ÿfileÿusedÿforÿthisÿproject.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ268

        13. Whenÿallÿofÿtheÿresourcesÿhaveÿbeenÿlocalized,ÿyouÿcanÿbuildÿtheÿSatelliteÿassemblyÿ (ActiveReports.resources.dll)ÿbyÿselectingÿBuildÿAssemblyÿfromÿtheÿBuildÿmenu.ÿ Note Ifÿyouÿareÿunableÿtoÿeditÿtheÿ.txtÿfilesÿusingÿtheÿSatelliteÿAssemblyÿutility,ÿyouÿcanÿopenÿtheÿfilesÿ usingÿNotepadÿandÿsaveÿthemÿwithÿUnicodeÿencodingÿinsteadÿofÿANSI.ÿ

        AddingÿanÿActiveReportÿwithÿParameters

        ToÿaddÿtheÿActiveReportÿwithÿParameters 1. Inÿyourÿproject,ÿfromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptParams.ÿ 3. FollowÿtheÿinstructionsÿinÿtheÿParametersÿwithÿSimpleÿReports walkthroughÿtoÿcreateÿyourÿreportÿwithÿ parameters.ÿ

        AddingÿCodeÿtoÿChangeÿtheÿCultureÿInformationÿ(OptionalÿStep) Note: Thisÿstepÿisÿonlyÿnecessaryÿifÿyouÿareÿdevelopingÿonÿaÿmachineÿwithÿcultureÿinformationÿdifferentÿ fromÿthatÿinÿtheÿprojectÿyouÿareÿlocalizing.ÿ

        Toÿaddÿcodeÿtoÿchangeÿtheÿcultureÿinformation l Addÿtheÿfollowingÿcodeÿinÿtheÿform'sÿconstructorÿjustÿbeforeÿtheÿInitializeComponentÿmethodÿisÿcalled.ÿ Makeÿsureÿyouÿreplaceÿtheÿ"ja"ÿshownÿinÿtheÿexampleÿcodeÿwithÿtheÿappropriateÿcultureÿinformationÿforÿ yourÿproject.ÿÿ 'ÿVisualÿBasic System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿNewÿSystem.Globalizationÿ_ .CultureInfo("ja") //C# System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿnewÿSystem.Globalization .CultureInfo("ja"); ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ269

        RunningÿtheÿProject

        Toÿrunÿtheÿproject 1. PressÿF5 toÿrunÿtheÿapplication.ÿ 2. IfÿtheÿsatelliteÿassemblyÿinÿtheÿdirectoryÿyouÿcreatedÿhasÿonlyÿbeenÿsignedÿwithÿtheÿDataÿDynamicsÿpublicÿ key,ÿyouÿwillÿneedÿtoÿturnÿoffÿsnÿsecurityÿforÿtheÿassembly.ÿYouÿcanÿdoÿthisÿbyÿgoingÿtoÿtheÿVisualÿ Studioÿ.NETÿ2003ÿorÿ2005ÿcommandÿprompt,ÿbrowsingÿtoÿtheÿdirectoryÿinÿwhichÿtheÿfileÿisÿlocatedÿandÿ typingÿinÿtheÿfollowingÿline:ÿ"snÿ-VrÿActiveReports.resources.dll".ÿ Note: Priorÿtoÿdeployingÿtheÿproject,ÿyouÿcanÿsendÿtheÿActiveReports.Design2.resources.dllÿfileÿtoÿ [email protected]ÿ toÿhaveÿitÿsigned.ÿWhenÿyouÿdeployÿtheÿproject,ÿifÿyourÿotherÿ DLLsÿareÿbeingÿsentÿtoÿtheÿGlobalÿAssemblyÿCache,ÿthisÿfileÿwillÿalsoÿneedÿtoÿbeÿsentÿthere.

        MasterÿDetailÿReportsÿWalkthroughs

        WithÿActiveReports,ÿMasterÿDetailÿreportsÿcanÿbeÿcreatedÿquicklyÿandÿeasily.ÿTheÿfollowingÿwalkthroughsÿ describeÿhowÿtoÿcreateÿdifferentÿtypesÿofÿMasterÿDetailÿreports. ÿ MasterÿDetailÿReportsÿwithÿGrouping DescribesÿhowÿMasterÿDetailÿreportsÿcanÿbeÿcreatedÿusingÿgrouping.ÿ MasterÿDetailÿReportsÿwithÿSubreports DescribesÿhowÿMasterÿDetailÿreportsÿcanÿbeÿcreatedÿwithÿsubreports.ÿ MasterÿDetailÿReportsÿwithÿXMLÿData ÿ DescribesÿhowÿMasterÿDetailÿreportsÿcanÿbeÿcreatedÿusingÿXMLÿdata.ÿ

        Walkthrough:ÿMasterÿDetailÿReportsÿwithÿGrouping

        ActiveReportsÿallowsÿyouÿtoÿcreateÿMasterÿDetailÿreportsÿwithÿgroupingÿbyÿusingÿtheÿGroupHeaderÿandÿDetailÿ sectionsÿtoÿcontainÿdataÿfromÿmasterÿfilesÿandÿdetailÿfiles.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿMasterÿDetailÿreportÿusingÿgroupingÿtoÿorganizeÿtheÿreport.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ270

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMD.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialogÿbox.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿorders,ÿ[orderÿdetails],ÿproductsÿwhereÿorders.OrderIDÿ=ÿ[orderÿ details].OrderIDÿandÿproducts.productIDÿ=ÿ[orderÿdetails].productIDÿorderÿbyÿOrderDate".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ271

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. ChangeÿtheÿBackColor propertyÿofÿtheÿpageÿheaderÿtoÿSilver. 2. Addÿlabelsÿtoÿtheÿpageÿheaderÿwithÿtheÿfollowingÿpropertiesÿset:ÿ

        Name Text FontÿStyle Location

        lblOrderDate OrderÿDateÿ Bold 0,ÿ0ÿ

        lblShipName ShipÿNameÿ Bold 3,ÿ0ÿ

        lblShippedDateÿ ShippedÿDateÿ Bold 1,ÿ0ÿ

        lblShipAddressÿ ShipÿAddressÿ Bold 4,ÿ0ÿ

        lblShipCountryÿ ShipÿCountryÿ Bold 5.5,ÿ0ÿ

        3. AddÿaÿGroupHeader/Footerÿsectionÿtoÿyourÿreport.ÿ 4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghOrdersÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightGray

        ¡ ChangeÿtheÿDataField propertyÿtoÿorders.OrderIDÿ 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ ghOrdersÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿ

        Control DataField Name Text OutputFormat Location

        Textbox OrderDateÿ txtOrderDate1 OrderÿDateÿ MM/dd/yy 0,ÿ0

        Textbox ShippedDateÿ txtShippedDate1 ShippedÿDateÿ MM/dd/yy 3,ÿ0

        Textboxÿ ShipNameÿ txtShipName1 ShipÿNameÿ Sizeÿ=ÿ2,ÿ0.19 1,ÿ0

        Textbox ShipAddressÿ txtShipAddress1 ShipÿAddressÿ 4,ÿ0ÿ

        Textbox ShipCountryÿ txtShipCountry1 ShipÿCountryÿ 5.5,ÿ0ÿ

        6. AddÿanotherÿGroupHeader/Footerÿsectionÿtoÿyourÿreport.ÿ 7. ChangeÿtheÿBackColor propertyÿofÿtheÿgroupÿheaderÿtoÿLightSteelBlue.ÿ 8. Addÿlabelsÿtoÿtheÿgroupÿheaderÿwithÿtheÿfollowingÿpropertiesÿset:ÿ

        Name Text FontÿStyle Location

        lblUnitPrice UnitÿPrice Bold 1,ÿ0

        lblQuantity Quantity Bold 5.75,ÿ0

        lblOrderID OrderÿID Bold 0,ÿ0

        lblProductName ProductÿName Bold 3,ÿ0

        lblProductID ProductÿID Bold 2,ÿ0

        9. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿAliceBlue ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 10. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿ ontoÿtheÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿÿ

        Control DataField Name Text Miscellaneous Location

        Textbox ProductName txtProductName Productÿ 3,ÿ0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ272

        Name

        Textbox Quantity txtQuantity Quantity 5.75,ÿ0

        Textbox orders.OrderID txtOrderID OrderÿID 0,ÿ0

        Textbox products.UnitPrice txtUnitPrice Unitÿ OutputFormatÿ=ÿ 1,ÿ0 Price Currency

        Textbox products.ProductID txtProductID Productÿ 2,ÿ0 ID

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿMasterÿDetailÿReportsÿwithÿSubreports

        ActiveReportsÿallowsÿyouÿtoÿcreateÿMasterÿDetailÿreportsÿbyÿusingÿsubreportsÿtoÿretrieveÿandÿgroupÿdata.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿMasterÿDetailÿreportÿwithÿsubreports.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l ConnectingÿtheÿMasterÿreportÿtoÿaÿdataÿsourceÿ l ConnectingÿtheÿDetailÿreportÿtoÿaÿdataÿsourceÿ

        l AddingÿcontrolsÿtoÿrptMasterÿtoÿcontainÿdataÿ

        l AddingÿcontrolsÿtoÿrptDetailÿtoÿcontainÿdataÿ l AddingÿcodeÿtoÿpassÿtheÿOrderIDÿfieldÿofÿrptMasterÿtoÿtheÿparameterÿinÿrptDetailÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ273

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMaster.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptDetail.ÿ 7. ClickÿOpen.ÿ

        ConnectingÿtheÿMasterÿreportÿtoÿaÿdataÿsource

        ToÿconnectÿtheÿMasterÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿorders".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ConnectingÿtheÿDetailÿreportÿtoÿaÿdataÿsource

        ToÿconnectÿtheÿDetailÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialogÿbox.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ274

        3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿ products.productIDÿwhereÿ[orderÿdetails].orderIDÿ=ÿ<%OrderID%>".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        AddingÿcontrolsÿtoÿrptMasterÿtoÿcontainÿdata

        ToÿaddÿcontrolsÿtoÿrptMaster 1. Addÿaÿshapeÿcontrolÿtoÿtheÿdetailÿsectionÿandÿmakeÿtheÿfollowingÿchangesÿtoÿit:ÿ

        ¡ SetÿtheÿBackColor propertyÿtoÿIndigo ¡ SetÿtheÿLineColor propertyÿtoÿTransparent ¡ SetÿtheÿLocation propertyÿtoÿ0,ÿ0

        ¡ SetÿtheÿSize propertyÿtoÿ6.5,ÿ0.2 2. Addÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿtheÿshapeÿcontrol:ÿ

        FontÿStyle ForeColor Name Text Location

        Bold White lblOrderDate OrderÿDateÿ 0,ÿ0

        Bold White lblShipName ShipÿNameÿ 0.85,ÿ0

        Bold White lblShipDate ShipÿDateÿ 2.25,ÿ0

        Bold White lblShipAddress ShipÿAddressÿ 2.98,ÿ0

        Bold White lblShipCountry ShipÿCountryÿ 5,ÿ0

        Bold White lblFreight Freightÿ 5.97,ÿ0

        3. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ SetÿtheÿBackColor propertyÿtoÿMediumPurple ¡ SetÿtheÿCanShrink propertyÿtoÿTrue 4. Addÿtheÿfollowingÿcontrolsÿtoÿtheÿdetailÿsectionÿbelowÿtheÿshapeÿcontrol:ÿ

        Control DataField Name Text Miscellaneous Location Size

        Textbox OrderDateÿ txtOrderDate Orderÿ OutputFormatÿ 0,ÿ0.25ÿ 0.75,ÿ Dateÿ =ÿMM/dd/yy 0.19

        Textbox ShipNameÿ txtShipName Shipÿ 0.85,ÿ 1.34,ÿ Nameÿ 0.25ÿ 0.19

        Textbox ShippedDateÿ txtShippedDate Shippedÿ OutputFormatÿ 2.25,ÿ 0.65,ÿ Dateÿ =ÿMM/dd/yy 0.25ÿ 0.19

        Textboxÿ ShipAddressÿ txtShipAddress Shipÿ 2.98,ÿ 2,ÿ Addressÿ 0.25ÿ 0.19

        Textbox ShipCountryÿ txtShipCountry Shipÿ 5,ÿ0.25ÿ 0.9,ÿ Countryÿ 0.19

        Textbox Freightÿ txtFreight Freightÿ OutputFormatÿ 5.97,ÿ 0.5,ÿ =ÿCurrency 0.25ÿ 0.19

        Subreport ctlSubReport 0.06,ÿ 6.38,ÿ 0.53ÿ 1

        Labelÿ lblWhiteLine BackColorÿ=ÿ 0,ÿ1.66 6.5,ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ275

        Whiteÿ 0.19

        AddingÿcontrolsÿtoÿrptDetailÿtoÿcontainÿdata

        ToÿaddÿcontrolsÿtoÿrptDetail 1. Deleteÿtheÿpageÿheaderÿsection.ÿ(Pageÿheadersÿareÿnotÿdisplayedÿinÿsubreports,ÿsoÿdeletingÿthemÿsavesÿ onÿprocessing.)ÿ 2. SetÿtheÿShowParameterUI propertyÿofÿtheÿreportÿtoÿFalse toÿavoidÿaskingÿusersÿforÿparameters.ÿ 3. Addÿaÿgroupÿheader/footerÿtoÿtheÿreport.ÿ 4. SetÿtheÿBackColor propertyÿofÿtheÿgroupÿheaderÿtoÿLightBlue 5. Addÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿtheÿgroupÿheaderÿsection:ÿ

        FontÿStyle Name Text Location

        Bold lblOrderID OrderÿID 0,ÿ0

        Bold lblProductID ProductÿID 0.81,ÿ0

        Bold lblProductName ProductÿName 2.25,ÿ0

        Bold lblQuantity Quantity 4.8,ÿ0

        Bold lblDiscount Discount 5.5,ÿ0

        6. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ SetÿtheÿBackColor propertyÿtoÿLightBlue ¡ SetÿtheÿCanShrink propertyÿtoÿTrue 7. Addÿtheÿfollowingÿcontrolsÿtoÿtheÿdetailÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        Textbox OrderID txtOrderID OrderÿID 0,ÿ0

        Textbox ProductName txtProductName Productÿ 2.25,ÿ0 Name

        Textbox products.ProductID txtProductID Productÿ 0.81,ÿ0 ID

        Textbox Quantity txtQuantity Quantity 4.8,ÿ0

        Textbox Discount txtDiscount Discount OutputFormatÿ=ÿ 5.5,ÿ0 Currency;ÿ Alignmentÿ=ÿ Right

        Addingÿtheÿcodeÿtoÿcreateÿaÿnewÿdataÿsourceÿforÿtheÿsubreport

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿtheÿDetailÿsectionÿofÿrptMasterÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿDetail_Formatÿ event.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿÿ l CreateÿaÿnewÿDataDynamicsÿOleDBDataSourceÿ l Setÿtheÿconnectionÿstringÿofÿtheÿnewÿdataÿsourceÿ

        l Setÿtheÿnewÿdataÿsource'sÿSQLÿqueryÿ l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ l SetÿtheÿReport propertyÿofÿctlSubReportÿtoÿrptDetail

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿtheÿDetailÿsectionÿofÿrptMasterÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿDetail_Formatÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ276

        event.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l CreateÿaÿnewÿDataDynamicsÿOleDBDataSourceÿ

        l Setÿtheÿconnectionÿstringÿofÿtheÿnewÿdataÿsourceÿ l Setÿtheÿnewÿdataÿsource'sÿSQLÿqueryÿ

        l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ

        l SetÿtheÿReport propertyÿofÿctlSubReportÿtoÿrptDetail Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿdetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿEventArgs)ÿ DimÿrptÿAsÿrptDetailÿ=ÿNewÿrptDetailÿ 'getÿnewÿdatasourceÿobject DimÿsubDSÿAsÿDataDynamics.ActiveReports.DataSources.OleDBDataSourceÿ=ÿNewÿDataDynamics.ActiveReports.DataSources.OleDBDataSourceÿ 'castÿthisÿreport'sÿdatasourceÿtoÿanÿOleDBDataSourceÿtoÿgetÿConnectionString subDS.ConnectionStringÿ=ÿCType(Me.DataSource,ÿDataDynamics.ActiveReports.DataSources.OleDBDataSource).ConnectionStringÿ 'buildÿnewÿSQLÿstatement subDS.SQLÿ=ÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿproducts.productIDÿwhereÿ[orderÿdetails].orderIDÿ=ÿ"ÿ+ÿm_OrderIDÿ rpt.DataSourceÿ=ÿsubDSÿ'setÿreferenceÿtoÿnewÿdatasourceÿobject Me.ctlSubreport.Reportÿ=ÿrptÿ'setÿreferenceÿtoÿreportÿforÿsubreportÿcontrol EndÿSubÿ

        'addÿthisÿcodeÿtoÿgetÿtheÿOrderIDÿforÿeachÿrecordÿinÿmaster Privateÿm_OrderIDÿAsÿStringÿ PrivateÿSubÿrptMaster_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿFetchEventArgs)ÿ m_OrderIDÿ=ÿMe.Fields("OrderID").Value.ToStringÿ EndÿSub

        //C# //changeÿtheÿdetail_FormatÿcodeÿtoÿsetÿSQLÿforÿsubreport'sÿdatasource privateÿvoidÿdetail_Format(objectÿsender,ÿEventArgsÿe) { rptDetailÿrptÿ=ÿnewÿrptDetail();ÿ//getÿnewÿinstanceÿofÿsubreport

        //getÿnewÿdatasourceÿobject DataDynamics.ActiveReports.DataSources.OleDBDataSourceÿsubDSÿ=ÿnewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource(); //castÿthisÿreport'sÿdatasourceÿtoÿanÿOleDBDataSourceÿtoÿgetÿConnectionString subDS.ConnectionStringÿ=ÿ((DataDynamics.ActiveReports.DataSources.OleDBDataSource)this.DataSource).ConnectionString; //buildÿnewÿSQLÿstatement subDS.SQLÿ=ÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿproducts.productIDÿwhereÿ[orderÿdetails].orderIDÿ=ÿ"ÿ+ÿm_OrderID;

        rpt.DataSourceÿ=ÿsubDS;ÿ//setÿreferenceÿtoÿnewÿdatasourceÿobject this.ctlSubreport.Reportÿ=ÿrpt;ÿ//setÿreferenceÿtoÿreportÿforÿsubreportÿcontrol }

        //addÿthisÿcodeÿtoÿgetÿtheÿOrderIDÿforÿeachÿrecordÿinÿmaster stringÿm_OrderID; privateÿvoidÿrptMaster_FetchData(objectÿsender,ÿFetchEventArgsÿeArgs) { m_OrderIDÿ=ÿthis.Fields["OrderID"].Value.ToString(); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿMasterÿDetailÿReportsÿwithÿXMLÿData ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ277

        ActiveReportsÿallowsÿyouÿtoÿcreateÿMasterÿDetailÿreportsÿwithÿdataÿfromÿanÿXMLÿdatabase.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿMasterÿDetailÿreportÿusingÿXMLÿdataÿandÿgrouping.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l ConnectingÿtheÿreportÿtoÿaÿXMLÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿXMLÿCustomerÿdatabaseÿ(customer.xml). Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMD.ÿ 4. ClickÿOpen.ÿ

        ConnectingÿtheÿreportÿtoÿaÿXMLÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿtheÿDataÿSourceÿdrop-downÿarrowÿandÿselectÿXML.ÿ 3. ClickÿtheÿellipsisÿbuttonÿbesideÿFileÿURL toÿbrowseÿforÿtheÿaccessÿpathÿtoÿCCustomer.xml.ÿ(Typicallyÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ278

        C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Samples\CSharp\XMLSample\customer.xmlÿ orÿC:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Samples\VB\XMLSample\customer.xml.)ÿ 4. ClickÿOpen.ÿ 5. InÿtheÿRecordsetÿPatternÿfield,ÿtypeÿ"//ITEM".ÿ 6. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿtwoÿGroupHeader/Footerÿsectionsÿtoÿyourÿreport.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheaderÿjustÿbelowÿtheÿpageÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCustomerÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightBlue ¡ ChangeÿtheÿDataField propertyÿtoÿ../../@id 3. AddÿtheÿfollowingÿcontrolsÿtoÿghCustomer:ÿ

        Control DataField Name Text Location FontÿStyle

        Label lblID IDÿ 0,ÿ0ÿ Bold

        Label lblEmailAddress E-mailÿAddressÿ 2,ÿ0ÿ Bold

        Label lblName Nameÿ 4,ÿ0ÿ Bold

        TextBox ../../@idÿ txtID IDÿ 0,ÿ0.25ÿ

        TextBox ../../@emailÿ txtEmail E-mailÿ 2,ÿ0.25ÿ

        TextBox ../../NAMEÿ txtName Nameÿ 4,ÿ0.25ÿ

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheaderÿjustÿaboveÿtheÿdetailÿsection:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghOrders

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightCyan ¡ ChangeÿtheÿDataField propertyÿtoÿ../Number

        ¡ AddÿtheÿfollowingÿcontrolsÿtoÿghOrders:ÿ

        Control DataField Name Text Location

        Label lblNumber OrderÿNumber: 0.38,ÿ0

        TextBox ../NUMBERÿ txtNumber Numberÿ 1.5,ÿ0ÿ

        TextBoxÿ ../DATEÿ txtDate Dateÿ 4.5,ÿ0ÿ

        Label lblISBN ISBNÿ 0,ÿ0.31

        Labelÿ lblBookTitle BookÿTitleÿ 1.13,ÿ0.31ÿ

        Label lblPrice Priceÿ 5.69,ÿ0.31ÿ

        Label lblAuthor Authorÿ 3.5,ÿ0.31ÿ

        Label lblPublisher Publisherÿ 4.56,ÿ0.31ÿ

        ¡ AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        TextBox @isbnÿ txtISBN ISBNÿ 0,ÿ0

        TextBox TITLEÿ txtTitle Titleÿ 1.13,ÿ0

        TextBox AUTHORÿ txtAuthor Authorÿ 3.5,ÿ0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ279

        TextBox PUBLISHERÿ txtPublisher Publisherÿ 4.56,ÿ0

        TextBox PRICEÿ txtPrice Priceÿ OutputFormatÿ=ÿCurrencyÿ 5.69,ÿ0

        ¡ AddÿtheÿfollowingÿcontrolsÿtoÿGroupFooter2:ÿ

        Control DataField Name Text Miscellaneous Location

        Label lblSubtotal Subtotal FontÿStyleÿ=ÿBold 4.5,ÿ0

        TextBox PRICE txtSubtotal Subtotal OutputFormatÿ=ÿCurrencyÿ 5.69,ÿ0 SummaryType =ÿSubTotal SummaryGroup =ÿghOrders

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ModifyingÿReportÿDocumentsÿWalkthroughs

        ActiveReportsÿallowsÿreportÿdocumentsÿtoÿbeÿmodifiedÿeasily.ÿTheÿfollowingÿwalkthroughsÿillustrateÿhowÿreportÿ documentsÿcanÿbeÿchangedÿbasedÿonÿuserÿneeds. ÿ AddingÿPages Demonstratesÿhowÿtoÿaddÿpagesÿtoÿaÿreport.ÿ ApplyingÿPageÿTemplates Demonstratesÿhowÿtoÿsetÿupÿandÿapplyÿpageÿtemplatesÿtoÿaÿreport.ÿ MergingÿReports ÿ Demonstratesÿhowÿreportÿdocumentsÿcanÿbeÿmerged.ÿ

        Walkthrough:ÿAddingÿPages

        ActiveReportsÿallowsÿyouÿtoÿaddÿpagesÿtoÿyourÿreportÿinÿVisualÿStudioÿforÿpreviewingÿinÿtheÿviewerÿcontrolÿorÿ printing.ÿTheÿdocumentÿcontainingÿtheÿinsertedÿpagesÿcanÿalsoÿbeÿsavedÿtoÿanÿRDFÿfileÿorÿexported.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿtwoÿreportsÿandÿinsertÿtheÿsecondÿreportÿasÿaÿcoverÿpageÿforÿtheÿ firstÿone. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿbothÿreportsÿ

        l AddingÿcodeÿtoÿtheÿForm_Loadÿeventÿtoÿinsertÿtheÿsecondÿreportÿasÿaÿcoverÿpageÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ280

        Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptInsertPage.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCoverPage.ÿ 7. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        ToÿconnectÿrptInsertPageÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿproductname".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ281

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        ToÿaddÿcontrolsÿtoÿrptInsertPage 1. AddÿaÿGroupHeader/Footerÿsection.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿLightSteelBlue

        ¡ ChangeÿtheÿDataField propertyÿtoÿProductName ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿFirstDetail ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrueÿ 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiessÿtoÿtheÿGroupHeaderÿsectionÿofÿrptInsertPage:ÿ

        FontÿStyle Name Text Location

        Bold lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Bold lblProductName ProductÿNameÿ 1.3,ÿ0ÿ

        Bold lblUnitsInStock UnitsÿInÿStockÿ 2.65,ÿ0ÿ

        Bold lblUnitsOnOrder UnitsÿOnÿOrderÿ 3.9,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ 5.25,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Miscellaneous Location

        ProductIDÿ ProductÿIDÿ 0,ÿ0ÿ

        ProductNameÿ ProductÿNameÿ 1.3,ÿ0ÿ

        UnitsInStockÿ UnitsÿinÿStockÿ 2.65,ÿ0ÿ

        UnitPriceÿ UnitÿPriceÿ OutputFormatÿ=ÿCurrencyÿ 5.25,ÿ0ÿ

        UnitsOnOrderÿ UnitsÿonÿOrderÿ 3.9,ÿ0ÿ

        ToÿaddÿcontrolsÿtoÿrptCoverPage 1. MakeÿtheÿfollowingÿchangesÿtoÿtheÿPageHeaderÿsection:ÿ ¡ ChangeÿtheÿHeightÿpropertyÿtoÿ0.8

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightSlateGray 2. Addÿtheÿfollowingÿcontrolsÿtoÿtheÿpageÿheader:ÿ

        Control Name Text Miscellaneous Location

        Label lblCompanyInfo CompanyÿStreetÿNameÿ 0.2,ÿ0.13ÿ Text-Alignÿ=ÿ CompanyÿCity,ÿCompanyÿ Centerÿ StateÿCompanyÿZipÿCodeÿ Sizeÿ=ÿ2,ÿ0.56

        Label lblCompanyName CompanyÿNameÿ FontÿSizeÿ=ÿ16,ÿ 3.5,ÿ0.25 Styleÿ=ÿBold

        Line Line1 Y1ÿ=ÿ0.06ÿ X1ÿ=ÿ2.3ÿ Y2ÿ=ÿ0.06 X2ÿ=ÿ6.4

        Line Line2 Y1ÿ=ÿ0.72ÿ X1ÿ=ÿ2.3ÿ Y2ÿ=ÿ0.72 X2ÿ=ÿ6.4

        Line Line3 Y1ÿ=ÿ0.07ÿ X1ÿ=ÿ2.3ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ282

        Y2ÿ=ÿ0.72 X2ÿ=ÿ2.3

        Line Line4 Y1ÿ=ÿ0.06ÿ X1ÿ=ÿ6.4ÿ Y2ÿ=ÿ0.72 X2ÿ=ÿ6.4 ÿ

        3. SetÿtheÿHeight propertyÿofÿtheÿDetailÿsection toÿ2.8.ÿ 4. Addÿtheÿfollowingÿcontrolsÿtoÿtheÿdetailÿsection:ÿ

        Control Name Text Miscellaneous Location

        Label lblFax Fax FontÿSizeÿ=ÿ24,ÿStyleÿ=ÿ 0.25,ÿ0 Bold

        Label lblTo To: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 1,ÿ0.75 Bold

        Label lblFax2 Faxÿ#: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 1,ÿ1 Bold

        Label lblPhone Phoneÿ#: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 1,ÿ1.25 Bold

        Label lblRe Re: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 1,ÿ1.5 Bold

        Label lblCC CC: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 3,ÿ1.5 Bold

        Label lblDate Date: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 3,ÿ1.25 Bold

        Label lblPages Pages: FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 3,ÿ1 Bold

        Label lblFrom From FontÿSizeÿ=ÿ12,ÿStyleÿ=ÿ 3,ÿ0.75 Bold

        CheckBox chkUrgent Urgent 0.5,ÿ2

        CheckBox chkForReview ForÿReview 1.5,ÿ2

        CheckBox chkPleaseComment Pleaseÿ 2.75,ÿ2 Comment

        CheckBox chkPleaseReply PleaseÿReply 4.5,ÿ2

        Line Line5 Y1ÿ=ÿ2.38ÿ X1ÿ=ÿ 0.06ÿ Y2ÿ=ÿ2.38 X2ÿ=ÿ 6.44

        Label lblComments Comments: 1,ÿ2.5

        AddingÿcodeÿtoÿtheÿForm_Loadÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿatÿtheÿtopÿofÿForm1,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿform.ÿAtÿtheÿtopÿ leftÿofÿtheÿcodeÿviewÿforÿForm1,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ(BaseÿClassÿEvents) .ÿAtÿtheÿtopÿ rightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿLoad.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿtheÿForm1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l InsertÿrptCoverPageÿatÿtheÿbeginningÿofÿrptInsertPageÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿatÿtheÿtopÿofÿForm1ÿtoÿselectÿtheÿform.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ283

        availableÿeventsÿforÿtheÿform.ÿDouble-clickÿLoad.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ Form1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l InsertÿrptCoverPageÿatÿtheÿbeginningÿofÿrptInsertPageÿ TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿInsertÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿrptÿAsÿNewÿrptInsertPage() Viewer1.Documentÿ=ÿrpt.Document rpt.Run() Dimÿrpt2ÿAsÿNewÿrptCoverPage() rpt2.Run() rpt.Document.Pages.Insert(0,ÿrpt2.Document.Pages(0)) EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptInsertPageÿrptÿ=ÿnewÿrptInsertPage(); rptCoverPageÿrpt2ÿ=ÿnewÿrptCoverPage(); viewer1.Documentÿ=ÿrpt.Document; rpt.Run(); rpt2.Run(); rpt.Document.Pages.Insert(0,ÿrpt2.Document.Pages[0]); } TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿInsertNewÿmethodÿlooksÿlike.ÿThisÿmethodÿallowsÿyouÿ toÿinsertÿaÿnewÿpageÿatÿtheÿlocationÿyouÿspecify. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿrptÿAsÿNewÿrptInsertPage() rpt.Run() rpt.Document.Pages.InsertNew(3) Viewer1.Documentÿ=ÿrpt.Document EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptInsertPageÿrptÿ=ÿnewÿrptInsertPage(); rpt.Run(); rpt.Document.Pages.InsertNew(3); viewer1.Documentÿ=ÿrpt.Document; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿApplyingÿPageÿTemplates

        ActiveReportsÿallowsÿyouÿtoÿapplyÿaÿpageÿtemplateÿtoÿanÿexistingÿreportÿbyÿusingÿtheÿOverlayÿmethod.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿoverlayÿanÿActiveReportÿwithÿaÿ"letterhead"ÿpageÿtemplate. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ284

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿbothÿreportsÿ

        l AddingÿcodeÿtoÿtheÿForm_Loadÿeventÿtoÿoverlayÿtheÿreportÿpagesÿwithÿtheÿ"letterhead"ÿtemplateÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptReport.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptTemplate.ÿ 7. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        ToÿconnectÿrptReportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ285

        6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿorderÿbyÿcountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        ToÿaddÿcontrolsÿtoÿrptReport 1. Selectÿtheÿpageÿheaderÿsection,ÿandÿsetÿtheÿHeight propertyÿtoÿ0.4.ÿ(Thisÿwillÿmatchÿtheÿheightÿofÿtheÿ pageÿheaderÿinÿtheÿtemplate.)ÿ 2. AddÿaÿGroupHeader/Footerÿsection.ÿ 3. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCustomers

        ¡ ChangeÿtheÿBackColor propertyÿtoÿMediumSlateBlue ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue

        ¡ ChangeÿtheÿDataField propertyÿtoÿCountry 4. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghCustomers:ÿ

        FontÿStyle Name Text Section Location

        Bold lblCustomerID CustomerÿIDÿ GroupHeaderÿ 0,ÿ0ÿ

        Bold lblCompanyName CompanyÿNameÿ GroupHeaderÿ 0.94,ÿ0ÿ

        Bold lblAddress Addressÿ GroupHeaderÿ 2.44,ÿ0ÿ

        Bold lblCity Cityÿ GroupHeaderÿ 4.63,ÿ0ÿ

        Bold lblCountry Countryÿ GroupHeaderÿ 5.69,ÿ0ÿ

        5. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿLightGray

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 6. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowingÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Control DataField Name Text Size Location

        TextBox CustomerIDÿ txtCustomerID CustomerÿIDÿ 0.88,ÿ0.19 0,ÿ0ÿ

        TextBox CompanyNameÿ txtCompanyName CompanyNameÿ 1.44,ÿ0.19 0.94,ÿ0ÿ

        TextBox Addressÿ txtAddress Addressÿ 2.13,ÿ0.19 2.44,ÿ0ÿ

        TextBox Cityÿ txtCity Cityÿ 1,ÿ0.19 4.63,ÿ0ÿ

        TextBox Countryÿ txtCountry Countryÿ 0.8,ÿ0.19 5.69,ÿ0

        ToÿaddÿcontrolsÿtoÿrptTemplate 1. Makeÿtheÿfollowingÿchangesÿtoÿtheÿpageÿheader:ÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿDarkSlateBlue

        ¡ ChangeÿtheÿHeight propertyÿtoÿ0.4 2. Addÿlabelsÿwithÿtheÿfollowingÿpropertiessÿtoÿtheÿpageÿheader:ÿ

        Font Name Text ForeColor Location

        lblCompanyName CompanyÿName White 0,ÿ0 Sizeÿ=ÿ18 Style=Bold

        lblCompanyLogo (CompanyÿLogo) White 4.69,ÿ0 Sizeÿ=ÿ16 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ286

        Style=Bold

        3. Addÿaÿlabelÿwithÿtheÿfollowingÿpropertiesÿtoÿtheÿpageÿfooter:ÿ

        Miscellaneous Name Text ForeColor Location

        lblCompanyInfo CompanyÿAddress,ÿPhoneÿ White 0,ÿ0 Styleÿ=ÿBold Number,ÿFaxÿNumber,ÿURL Sizeÿ=ÿ6.5,ÿ 0.2

        AddingÿcodeÿtoÿtheÿForm_Loadÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# Double-clickÿatÿtheÿtopÿofÿForm1.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿ codeÿtoÿtheÿhandlerÿto: l Applyÿtheÿ"letterhead"ÿtemplateÿpageÿtoÿrptReportÿ TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿOverlayÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ MyBase.Load DimÿrptÿAsÿNewÿrptReport() rpt.Run() Dimÿrpt2ÿAsÿNewÿrptTemplate() rpt2.Run() Viewer1.Documentÿ=ÿrpt.Document Forÿiÿ=ÿ0ÿToÿrpt.Document.Pages.Countÿ- 1 rpt.Document.Pages(i).Overlay(rpt2.Document.Pages(0)) Next EndÿSub

        //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptReportÿrptÿ=ÿnewÿrptReport(); rpt.Run(); rptTemplateÿrpt2ÿ=ÿnewÿrptTemplate(); rpt2.Run(); viewer1.Documentÿ=ÿrpt.Document; for(intÿiÿ=ÿ0;ÿiÿ<ÿrpt.Document.Pages.Count;ÿi++) { rpt.Document.Pages[i].Overlay(rpt2.Document.Pages[0]); } ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿMergingÿReports

        ActiveReportsÿallowsÿyouÿtoÿmergeÿtwoÿorÿmoreÿreportsÿinÿVisualÿStudioÿforÿpreviewingÿinÿtheÿviewerÿcontrolÿ orÿprinting.ÿTheÿdocumentÿcontainingÿtheÿmergedÿreportsÿcanÿalsoÿbeÿsavedÿtoÿanÿRDFÿfileÿorÿexported.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ287

        ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿtwoÿActiveReportsÿandÿmergeÿtheÿreportsÿintoÿoneÿdocument. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportsÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿbothÿreportsÿtoÿcontainÿdataÿ

        l AddingÿcodeÿtoÿtheÿForm_Loadÿeventÿtoÿcombineÿtheÿreportsÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptOne.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptTwo.ÿ 7. ClickÿOpen.ÿ

        Connectingÿtheÿreportsÿtoÿaÿdataÿsource

        ToÿconnectÿrptOneÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ288

        2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿtheÿBuild button.ÿ 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿorders".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ToÿconnectÿrptTwoÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproducts".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        ToÿaddÿcontrolsÿtoÿrptOne 1. Changeÿtheÿfollowingÿpropertiesÿofÿtheÿdetailÿsection:ÿ ¡ SetÿtheÿBackColor propertyÿtoÿThistle

        ¡ SetÿtheÿCanShrink propertyÿtoÿTrue 2. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Size DataField Name Text Location OutputFormat

        0.6,ÿ0.19ÿ OrderDateÿ txtOrderDate OrderÿDateÿ 0,ÿ0ÿ MM/dd/yy

        0.5,ÿ0.19 OrderIDÿ txtOrderID OrderÿIDÿ 0.69,ÿ0ÿ

        1.94,ÿ0.19 ShipNameÿ txtShipName ShipÿNameÿ 1.25,ÿ0ÿ

        2.3,ÿ0.19 ShipAddressÿ txtShipAddress ShipÿAddressÿ 3.25,ÿ0ÿ

        0.88,ÿ0.19 ShipCityÿ txtShipCity ShipÿCityÿ 5.63,ÿ0ÿ

        ToÿaddÿcontrolsÿtoÿrptTwoÿ 1. Changeÿtheÿfollowingÿpropertiesÿofÿtheÿdetailÿsection:ÿ

        ¡ SetÿtheÿBackColor propertyÿtoÿLightSteelBlue ¡ SetÿtheÿCanShrink propertyÿtoÿTrue 2. Dragÿtheÿfollowingÿfieldsÿontoÿtheÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Size DataField Name Text Location

        0.88,ÿ0.19 ProductID txtProductID ProductÿID 0,ÿ0

        2.44,ÿ0.19 ProductName txtProductName ProductÿName 1,ÿ0

        1.38,ÿ0.19 QuantityPerUnit txtQuantityPerUnit QuantityÿPerÿUnit 3.5,ÿ0

        0.75,ÿ0.19 ReorderLevel txtReorderLevel ReorderÿLevel 4.94,ÿ0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ289

        0.75,ÿ0.19 UnitsOnOrder txtUnitsOnOrder UnitsÿOnÿOrder 5.75,ÿ0

        AddingÿcodeÿtoÿtheÿForm_Loadÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC#

        l Double-clickÿtheÿtopÿofÿForm1ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿ codeÿtoÿtheÿhandlerÿto:ÿ

        l AddÿrptTwoÿtoÿrptOneÿ TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿAddRangeÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿrptÿAsÿNewÿrptOne() rpt.Run() Dimÿrpt2ÿAsÿNewÿrptTwo() rpt2.Run() rpt.Document.Pages.AddRange(rpt2.Document.Pages) Viewer1.Documentÿ=ÿrpt.Document EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptOneÿrpt1ÿ=ÿnewÿrptOne(); rpt1.Run(); rptTwoÿrpt2ÿ=ÿnewÿrptTwo(); rpt2.Run(); rpt1.Document.Pages.AddRange(rpt2.Document.Pages); viewer1.Documentÿ=ÿrpt1.Document; } TheÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿAddÿmethodÿlooksÿlike. 'VisualÿBasic DimÿiÿAsÿInteger PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿrptÿAsÿNewÿrptOne() rpt.Run() Dimÿrpt2ÿAsÿNewÿrptTwo() rpt2.Run() Forÿiÿ=ÿ0ÿToÿrpt2.Document.Pages.Countÿ- 1 rpt.Document.Pages.Add(rpt2.Document.Pages(i)) Next Viewer1.Documentÿ=ÿrpt.Document EndÿSub //C# intÿi; privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptOneÿrpt1ÿ=ÿnewÿrptOne(); rpt1.Run(); rptTwoÿrpt2ÿ=ÿnewÿrptTwo(); rpt2.Run(); for(iÿ=ÿ0;ÿiÿ<ÿrpt2.Document.Pages.Count;ÿi++) { rpt1.Document.Pages.Add(rpt2.Document.Pages[i]); } viewer1.Documentÿ=ÿrpt1.Document; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ290

        1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        PageÿNumberingÿWalkthroughs

        WithÿActiveReports,ÿpageÿnumberingÿcanÿbeÿsetÿupÿusingÿeitherÿtheÿreport'sÿPageHeader/Footerÿsectionsÿorÿ GroupHeader/Footerÿsection.ÿTheÿfollowingÿwalkthroughsÿillustrateÿhowÿtoÿsetÿupÿpageÿnumberingÿinÿtheÿ GroupHeaderÿsection andÿinÿtheÿPageFooterÿsection. ÿ PageÿNumberingÿinÿtheÿGroupÿHeader Describesÿhowÿtoÿsetÿupÿpageÿnumberingÿusingÿtheÿreport'sÿgroupÿheader.ÿ PageÿNumberingÿinÿtheÿPageÿFooter ÿ Describesÿhowÿsetÿupÿpageÿnumberingÿusingÿtheÿreport'sÿpageÿfooter.ÿ

        Walkthrough:ÿPageÿNumberingÿinÿtheÿGroupÿHeader

        WithÿActiveReports,ÿpageÿnumberingÿcanÿbeÿeasilyÿappliedÿtoÿgroupsÿinÿaÿreportÿusingÿtheÿGroupHeaderÿ section.ÿ ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿpageÿnumberingÿforÿgroupsÿinÿtheÿGroupHeaderÿsection. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ291

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProjectÿmenu,ÿselectÿAddÿNewÿItem . 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿitÿrptNumberGH.ÿ 3. ChangeÿtheÿnameÿofÿtheÿreportÿandÿclickÿOpen.ÿ 4. TheÿActiveReportsÿdesignÿsurfaceÿisÿdisplayed.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿorderÿbyÿcountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ292

        Toÿaddÿcontrolsÿtoÿcontainÿdata 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptNumberGH.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿnameÿtoÿghCustomersÿ ¡ ChangeÿtheÿDataField propertyÿtoÿCountry

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿFirstDetail ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Miscellaneous Location

        ReportInfo reportInfo1 ReportÿInfo 0,ÿ0 FormatString=ÿPage {PageNumber}ÿofÿ {PageCount} SummaryGroup=ÿ ghCustomers SummaryRunningÿ=ÿ Group

        Label lblCustomerID CustomerIDÿ NAÿ 0,ÿ0.25ÿ

        Label lblCompanyName CompanyNameÿ NA 1.1875,ÿ 0.25ÿ

        Label lblAddress Addressÿ NA 3.3125,ÿ 0.25ÿ

        Label lblCountry Countryÿ NA 5.125,ÿ 0.25ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿÿ

        Field Text Location

        CustomerID CustomerID 0,ÿ0

        CompanyName CompanyÿName 1.1875,ÿ0

        Address Address 3.3125,ÿ0

        Country Country 5.114,ÿ0

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿPageÿNumberingÿinÿtheÿPageÿFooter

        WithÿActiveReports,ÿpageÿnumberingÿcanÿbeÿeasilyÿappliedÿtoÿaÿreportÿusingÿtheÿPageFooterÿsection.ÿ ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿpageÿnumberingÿinÿtheÿPageFooterÿsection. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ293

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProjectÿmenu,ÿselectÿAddÿNewÿItem . 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿitÿrptNumberPF.ÿ 3. ChangeÿtheÿnameÿofÿtheÿreportÿandÿclickÿOpen.ÿ 4. TheÿActiveReportsÿdesignÿsurfaceÿisÿdisplayed.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ294

        3. ClickÿtheÿBuild button.ÿ 4. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext.ÿ 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿcontainÿdata 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptNumberPF.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿnameÿtoÿghProductsÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿGainsboro ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryIDÿ ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ ChangeÿtheÿKeepTogether propertyÿto True 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Location

        Label lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Label lblProductName ProductÿNameÿ 1.1875,ÿ0ÿ

        Label lblUnitsInStock UnitsÿInÿStockÿ 3,ÿ0ÿ

        Label lblUnitPrice UnitÿPriceÿ 4.375,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿÿ Field Text Miscellaneous Location ProductID ProductÿIDÿ NA 0,ÿ0ÿ ProductName ProductÿNameÿNA 1.1875,ÿ0ÿ UnitsInStock UnitsÿInÿStockÿNA 3,ÿ0ÿ UnitPrice UnitÿPriceÿ OutputFormatÿ=ÿCurrencyÿ4.375,ÿ0ÿ 5. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageFooterÿsection:ÿ

        Control Name Text Miscellaneous Location

        ReportInfo reportInfo1 Reportÿ FormatString=Page{PageNumber}ÿofÿ 0,ÿ0ÿ Info {PageCount}ÿ SummaryGroup=ghProductsÿ SummaryRunningÿ=ÿGroup

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ295

        ParametersÿWalkthroughs

        WithÿActiveReports,ÿparametersÿmayÿbeÿusedÿwithÿsimpleÿreportsÿtoÿpromptÿaÿuserÿforÿinputÿbeforeÿrunningÿ theÿreportÿorÿusedÿwithÿsubreportsÿtoÿlinkÿaÿsubreportÿtoÿaÿparentÿreport. ÿ ParametersÿwithÿSimpleÿReports Describesÿhowÿparametersÿcanÿbeÿusedÿwithÿsimpleÿreports.ÿ ParametersÿwithÿSubreports Describesÿhowÿparametersÿcanÿbeÿusedÿtoÿconnectÿaÿsubreportÿtoÿaÿparentÿreport.ÿ ParametersÿwithÿCharts ÿ Describesÿhowÿparametersÿcanÿbeÿusedÿtoÿconnectÿaÿchartÿtoÿaÿreport.ÿ

        Walkthrough:ÿParametersÿwithÿSimpleÿReports

        InÿActiveReports,ÿtheÿParametersÿdialogÿcanÿbeÿusedÿtoÿpromptÿforÿuserÿinputÿwhenÿreportsÿareÿgenerated.ÿIfÿ youÿaddÿ"<%FieldNameÿ|ÿPromptStringÿ|ÿDefaultValueÿ|ÿTypeÿ%>"ÿtoÿtheÿreport'sÿSQLÿstring,ÿtheÿParametersÿ dialogÿappearsÿwhenÿtheÿreportÿopens.ÿÿ Thisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿusingÿparametersÿinÿsimpleÿreports. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ

        l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptParams.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ296

        4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿordersÿINNERÿJOINÿ[orderÿdetails]ÿONÿorders.orderidÿ=ÿ[orderÿ details].orderidÿWHEREÿorderdateÿ=#<%Date|Orderÿdate:|1/1/1994|D%>#".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptParams.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghOrders ¡ ChangeÿtheÿBackColor propertyÿtoÿOrchid 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Location

        Label lblOrderDate OrderÿDateÿ 0,ÿ0ÿ

        Label lblShipName ShipÿNameÿ 1,ÿ0ÿ

        Label lblShipAddress ShipÿAddressÿ 3,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Location Size

        OrderDate OrderÿDateÿ(OutputFormat =ÿMM/dd/yy) 0,ÿ0 1,ÿ0.19

        ShipName ShipÿName 1,ÿ0 1.9,ÿ0.19

        ShipAddress ShipÿAddress 3,ÿ0 1.7,ÿ0.19

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ 3. Whenÿyouÿrunÿtheÿreport,ÿaÿparameterÿUIÿisÿpresented.ÿEnterÿ9/2/94 toÿseeÿtheÿreportÿshownÿabove.

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿParametersÿwithÿSubreports

        Parametersÿcanÿbeÿusedÿwithÿsubreportsÿtoÿconnectÿtheÿsubreportÿtoÿtheÿparentÿreport.ÿByÿsettingÿaÿ parameterÿforÿtheÿfieldÿthatÿlinksÿtheÿparentÿreportÿtoÿtheÿsubreport,ÿtheÿparentÿreportÿcanÿpassÿtheÿ informationÿtoÿtheÿsubreportÿthroughÿtheÿparameters. Note: SubreportsÿwillÿnotÿrenderÿPageHeader/Footerÿsections.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿsubreportÿusingÿparametersÿtoÿlinkÿtheÿparentÿreportÿtoÿtheÿ subreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities: l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ297

        l Connectingÿtheÿparentÿreportÿtoÿaÿdataÿsourceÿ l Connectingÿtheÿchildÿreportÿtoÿaÿdataÿsourceÿusingÿparametersÿ

        l Addingÿcontrolsÿtoÿdisplayÿtheÿdataÿ l Addingÿtheÿcodeÿneededÿtoÿlinkÿtheÿsubreportÿtoÿtheÿcurrentÿrecord'sÿsupplierIDÿ

        l Addingÿtheÿcodeÿtoÿsetÿtheÿsubreport'sÿShowParametersUIÿpropertyÿtoÿFalseÿ

        l Viewingÿtheÿreportÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptParent.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptChild.ÿ 7. ClickÿOpen.

        Connectingÿtheÿparentÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿparentÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ298

        3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿsuppliersÿorderÿbyÿcountry".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Connectingÿtheÿchildÿreportÿtoÿaÿdataÿsourceÿusingÿparameters

        Toÿconnectÿtheÿchildÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿproductsÿINNERÿJOINÿcategoriesÿONÿproducts.categoryidÿ=ÿ categories.categoryidÿWHEREÿproducts.supplierIDÿ=<%SupplierID%>".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptParent.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿNameÿpropertyÿtoÿghSuppliers

        ¡ ChangeÿtheÿDataField propertyÿto Country 3. AddÿtheÿfollowingÿcontrolsÿtoÿrptParent,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿÿÿ

        Control DataField Name Text Section Location Miscellaneous

        TextBox Country txtCountry Country GroupHeader 0,ÿ0 Fontÿsizeÿ=ÿ12

        TextBox CompanyName txtCompanyName Companyÿ Detail 0,ÿ0 Sizeÿ=ÿ1.94,ÿ Name 0.19

        TextBox ContactName txtContactName Contactÿ Detail 2,ÿ0 Sizeÿ=ÿ1.9,ÿ Name 0.19

        TextBox Phone txtPhone Phone Detail 4,ÿ0 Sizeÿ=ÿ1,ÿ0.19

        Subreport Subreport1 Detail 0,ÿ0.31 Sizeÿ=ÿ5,ÿ1

        ÿ 4. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptChild.ÿ 5. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghProducts

        ¡ ChangeÿtheÿBackColor propertyÿtoÿSilver ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryName 6. DragÿtheÿfollowingÿfieldsÿontoÿrptChild,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿÿÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ299

        Size DataField Name Text Section Location

        2.5,ÿ CategoryName txtCategoryName Categoryÿ GroupHeader 0,ÿ0 0.19 Name

        2.5,ÿ ProductName txtProductName ProductÿName Detail 0,ÿ0 0.19

        Addingÿtheÿcodeÿneededÿtoÿlinkÿtheÿsubreportÿtoÿtheÿcurrentÿrecord'sÿ supplierID

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿinÿtheÿdetailÿsectionÿofÿrptParent.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptParent'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Linkÿtheÿsubreportÿtoÿtheÿcurrentÿrecord'sÿsupplierID

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿdetailÿsectionÿofÿrptParent.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptParent'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Linkÿtheÿsubreportÿtoÿtheÿcurrentÿrecord'sÿsupplierID Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿrptÿAsÿNewÿrptChild() Me.SubReport1.Reportÿ=ÿrpt EndÿSub ÿ //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptChildÿrptÿ=ÿnewÿrptChild(); this.SubReport1.Reportÿ=ÿrpt; } ÿ

        Addingÿtheÿcodeÿtoÿsetÿtheÿsubreport'sÿShowParametersUIÿpropertyÿtoÿFalse

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptChild.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿrptChild'sÿ ReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿtheÿsubreport'sÿShowParametersUIÿpropertyÿtoÿFalse

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptChild.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptChild'sÿ ReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿtheÿsubreport'sÿShowParametersUIÿpropertyÿtoÿFalse Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptChild_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart Me.ShowParameterUIÿ=ÿFalse EndÿSub ÿ //C# privateÿvoidÿrptChild_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.ShowParameterUIÿ=ÿfalse; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ300

        } ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ParametersÿwithÿCharts

        Parametersÿcanÿbeÿusedÿwithÿchartsÿtoÿconnectÿtheÿinformationÿshownÿinÿtheÿchartÿtoÿthatÿshownÿinÿtheÿ report.ÿByÿsettingÿaÿparameterÿforÿtheÿfieldÿthatÿlinksÿtheÿreportÿtoÿtheÿchart,ÿtheÿreportÿcanÿpassÿtheÿ informationÿtoÿtheÿchartÿthroughÿtheÿparameters. Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿchartÿusingÿparametersÿtoÿlinkÿtheÿreportÿtoÿtheÿchart. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿdisplayÿtheÿdataÿ l Settingÿaÿdataÿsourceÿforÿtheÿchartÿusingÿparametersÿ

        l Settingÿtheÿchart'sÿpropertiesÿ

        l Viewingÿtheÿreportÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ301

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ302

        4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptChartParams.ÿ 4. ClickÿOpen.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. Selectÿtheÿ"OLEÿDB"ÿtab.ÿ 3. ClickÿonÿBuild. 4. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 5. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿProductsÿORDERÿBYÿCategoryID,ÿProductName".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. Right-clickÿonÿtheÿreportÿandÿdeleteÿtheÿPageHeader/Footerÿsectionÿpair.ÿ 2. Right-clickÿonÿtheÿreportÿandÿinsertÿaÿGroupHeader/Footerÿsectionÿpair.ÿ 3. MakeÿtheÿfollowingÿchangesÿtoÿtheÿGroupHeaderÿsection:ÿ ¡ ChangeÿtheÿNameÿpropertyÿtoÿghCategoryID

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll ¡ ChangeÿtheÿHeight propertyÿtoÿ5.65ÿin 4. ChangeÿtheÿHeight propertyÿofÿtheÿDetailÿsection toÿ0.23ÿin.ÿ 5. ChangeÿtheÿHeight propertyÿofÿtheÿGroupFooterÿsection toÿ0ÿin.ÿ 6. AddÿtheÿfollowingÿcontrolsÿtoÿrptChartParams,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿ ÿ

        Control DataField Name Text Section Location

        Label NA lblCategoryID CategoryÿIDÿ ghCategoryID 1.78,ÿ0 Number:

        TextBox CategoryID txtCategoryID CategoryID ghCategoryID 3.72,ÿ0

        ChartControl NA chartControl1 NA ghCategoryID 0.063,ÿ 0.313

        Label NA lblProductName Productÿ ghCategoryID 0.23,ÿ Name 5.43

        Label NA lblUnitsInStock UnitsÿInÿ ghCategoryID 5,ÿ5.43 Stock

        TextBox ProductName txtProductName ProductName Detail 0.23,ÿ0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ303

        TextBox UnitsInStock txtUnitsInStock UnitsInStock Detail 5,ÿ0.23

        ÿ

        Settingÿaÿdataÿsourceÿforÿtheÿchart

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿDataÿSource verbÿbelowÿtheÿPropertiesÿWindowÿtoÿopenÿtheÿ ChartÿDataSourceÿdialog.ÿ 2. ClickÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿselectedÿtheÿfile.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheQueryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿProductsÿWHEREÿCategoryIDÿ=ÿ<%CategoryID||1%>ÿORDERÿBYÿ ProductName."ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface. NOTE:ÿWhenÿusingÿparameters,ÿtheÿchartÿwillÿdrawÿatÿrunÿtimeÿbutÿnotÿatÿdesignÿtimeÿifÿyouÿdoÿnotÿprovideÿaÿ defaultÿvalue.ÿ NOTEÿ2:ÿIfÿyouÿdon'tÿsetÿtheÿORDERÿinÿbothÿSQLÿstatementsÿ(i.e.ÿthatÿofÿtheÿreportÿandÿthatÿofÿtheÿchart),ÿ theÿchartÿdataÿwillÿnotÿbeÿordered.

        Settingÿtheÿchart'sÿproperties

        Toÿsetÿtheÿchart'sÿproperties 1. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿChartAreas (Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿ thenÿclickÿtheÿellipsisÿbuttonÿtoÿopenÿtheÿChartAreaÿCollectionÿEditor.ÿ 2. InÿtheÿdefaultAreaÿProperties,ÿclickÿtheÿAxes (Collection)ÿproperty,ÿthenÿclickÿtheÿellipsisÿbuttonÿtoÿopenÿ theÿAxisBaseÿCollectionÿEditor.ÿ 3. ClickÿtheÿAxisXÿmember,ÿandÿsetÿitsÿLabelFontÿ>ÿAngle propertyÿtoÿ90 soÿtheÿProductNameÿlabelsÿwillÿ notÿoverlap.ÿ 4. ClickÿtheÿAxisY member,ÿandÿsetÿitsÿTitleÿpropertyÿtoÿ"UnitsÿinÿStock".ÿ 5. StillÿinÿtheÿAxisYÿmember,ÿexpandÿtheÿMajorTick propertyÿtreeviewÿnodeÿandÿsetÿtheÿfollowingÿ properties:ÿ

        ¡ ChangeÿtheÿGridLineÿ>ÿStyle propertyÿto Dot

        ¡ ChangeÿtheÿGridLineÿ>ÿColor propertyÿtoÿSilver ¡ ChangeÿtheÿGridLineÿ>ÿWeight propertyÿtoÿ1 6. ClickÿOK toÿreturnÿtoÿtheÿChartAreaÿCollectionÿEditor.ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 8. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿthe Series (Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿtoÿopenÿtheÿSeriesÿCollectionÿEditor.ÿ 9. ClickÿSeries1 toÿselectÿit.ÿ 10. ChangeÿtheÿValueMembersY propertyÿtoÿUnitsInStock.ÿ 11. ChangeÿtheÿValueMembersX propertyÿtoÿProductName.ÿ 12. RemoveÿSeries2ÿandÿSeries3.ÿ 13. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 14. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿTitles (Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ clickÿtheÿellipsisÿbuttonÿtoÿopenÿtheÿTitleÿCollectionÿEditor.ÿ 15. Inÿtheÿheaderÿproperties,ÿchangeÿtheÿText propertyÿtoÿ"ProductsÿInÿStock."ÿ 16. RemoveÿtheÿfooterÿtitleÿandÿclickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 17. Withÿtheÿchartÿcontrolÿhighlighted,ÿclickÿtheÿLegends (Collection)ÿpropertyÿinÿtheÿPropertiesÿWindow,ÿthenÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ304

        clickÿtheÿellipsisÿbuttonÿtoÿopenÿtheÿLegendÿCollectionÿEditor.ÿ 18. ChangeÿtheÿVisible propertyÿofÿtheÿdefaultLegendÿtoÿFalse.ÿ 19. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        PrintingÿWalkthroughs

        WithÿActiveReports,ÿprinterÿsettingsÿcanÿbeÿmodifiedÿatÿdesignÿtimeÿasÿwellÿasÿatÿrunÿtime.ÿTheÿfollowingÿ walkthroughsÿwillÿdescribeÿhowÿtoÿmakeÿsuchÿmodificationsÿinÿyourÿreport. Note: PrinterÿvaluesÿareÿsetÿafterÿtheÿReportStartÿeventÿfires.ÿÿTheÿvaluesÿthatÿwillÿbeÿappliedÿtoÿtheÿ PrinterÿobjectÿareÿinÿtheÿPageSettingsÿobject,ÿsoÿtoÿmodifyÿtheÿvaluesÿinÿtheÿPageSettingsÿobjectÿbeforeÿ theyÿareÿappliedÿtoÿtheÿPrinterÿobject,ÿdoÿsoÿinÿtheÿReportStartÿevent. ÿ AlsoÿnoteÿthatÿcallingÿDocument.Printÿwillÿnotÿrunÿtheÿreport.ÿTheÿreportÿmustÿbeÿrunÿbeforeÿattemptingÿtoÿ printÿtheÿdocument. ÿ Duplexing Describesÿhowÿtoÿsetÿupÿduplexingÿwhenÿprintingÿyourÿreport.ÿ MultipleÿCopies Describesÿhowÿtoÿsetÿmultipleÿcopiesÿforÿprintingÿyourÿreport.ÿ Orientation ÿ Describesÿhowÿtoÿchangeÿtheÿpaperÿorientationÿforÿprintingÿyourÿreport.ÿ

        Walkthrough:ÿDuplexing

        Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿtheÿtypeÿofÿduplexÿactionÿtoÿuseÿwhenÿprintingÿoutÿdouble-sidedÿ reports.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l Accessingÿtheÿprinterÿsettingsÿdialogÿ

        l Settingÿtheÿtypeÿofÿduplexingÿforÿprintingÿdouble-sidedÿreportsÿ l Usingÿcodeÿtoÿsetÿtheÿtypeÿofÿduplexingÿforÿprintingÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿthisÿwalkthrough,ÿyouÿmustÿhaveÿaÿprintÿdriverÿwhichÿsupportsÿprintingÿinÿduplexÿinÿ.NET.

        Accessingÿtheÿprinterÿsettingsÿdialog

        Toÿaccessÿtheÿprinterÿsettingsÿdialog 1. OpenÿanÿexistingÿActiveReport.ÿ 2. Clickÿonÿanyÿsectionÿofÿtheÿreportÿtoÿselectÿit.ÿ 3. Clickÿon Report >ÿSettings. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ305

        4. ClickÿonÿPrinterÿSettings.ÿ

        Settingÿtheÿtypeÿofÿduplexingÿforÿprintingÿdouble-sidedÿreports

        Toÿsetÿtheÿtypeÿofÿduplexingÿforÿprintingÿdouble-sidedÿreports 1. Goÿtoÿtheÿprinterÿsettingsÿdialog.ÿ 2. ForÿDuplex,ÿchooseÿoneÿofÿtheÿfourÿoptions:ÿ ÿ Printerÿdefault:ÿtheÿreportÿwillÿuseÿtheÿdefaultÿsettingÿonÿtheÿselectedÿprinter. ÿSimplex:ÿturnsÿoffÿduplexÿprinting. ÿHorizontal:ÿprintsÿhorizontallyÿonÿbothÿsidesÿofÿtheÿpaper. ÿVertical:ÿprintsÿverticallyÿonÿbothÿsidesÿofÿtheÿpaper.

        ÿ

        Usingÿcodeÿtoÿsetÿtheÿtypeÿofÿduplexingÿatÿrunÿtime

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿtheÿtypeÿofÿduplexingÿneededÿinÿtheÿreportÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿtheÿtypeÿofÿduplexingÿneededÿinÿtheÿreportÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿforÿsettingÿhorizontalÿduplexing. 'VisualÿBasic PrivateÿSubÿrptKeepTG_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart Me.PageSettings.Duplexÿ=ÿDrawing.Printing.Duplex.Horizontal EndÿSub //C# privateÿvoidÿrptprint_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.PageSettings.Duplexÿ=ÿSystem.Drawing.Printing.Duplex.Horizontal }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ306

        2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿMultipleÿCopies

        Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿmultipleÿcopiesÿforÿprintingÿaÿreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l Settingÿmultipleÿcopiesÿforÿprintingÿaÿreportÿfromÿtheÿprintÿdialogÿatÿrunÿtimeÿ l Settingÿmultipleÿcopiesÿinÿcodeÿforÿprintingÿaÿreportÿ

        l Usingÿcodeÿtoÿsetÿmultipleÿcopiesÿforÿprintingÿ l Viewingÿtheÿreportÿÿ Note: Settingÿtheÿnumberÿofÿcopiesÿisÿonlyÿsupportedÿinÿ.NETÿFrameworkÿ1.0ÿSP3ÿandÿ1.1ÿSP1.

        Settingÿmultipleÿcopiesÿforÿprintingÿaÿreportÿfromÿtheÿprintÿdialogÿatÿrunÿtime

        Toÿsetÿmultipleÿcopiesÿforÿprintingÿaÿreportÿfromÿtheÿprintÿdialogÿatÿrunÿtime 1. PressÿF5ÿtoÿrunÿanÿexistingÿActiveReport.ÿ 2. Clickÿonÿtheÿprinterÿiconÿinÿtheÿviewerÿwindow.ÿ

        ÿ 3. InÿtheÿCopiesÿbox,ÿselectÿtheÿnumberÿofÿcopiesÿneeded.ÿ

        ÿ ÿ

        Usingÿcodeÿtoÿsetÿmultipleÿcopiesÿforÿprintingÿatÿrunÿtime

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿmultipleÿcopiesÿofÿtheÿreportÿforÿprintingÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿmultipleÿcopiesÿofÿtheÿreportÿforÿprintingÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿforÿprintingÿfiveÿcopies. 'VisualÿBasic PrivateÿSubÿActiveReport1_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystemÿ_ .EventArgs)ÿHandlesÿMyBase.ReportStart ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ307

        Me.Document.Printer.PrinterSettings.Copiesÿ=ÿ5 EndÿSub PrivateÿSubÿrptPrint_ReportEnd(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart Me.Document.Print(false,ÿfalse) EndÿSub //C# privateÿvoidÿActiveReport1_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.Document.Printer.PrinterSettings.Copiesÿ=ÿ5; } privateÿvoidÿrptPrint_ReportEnd(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.Document.Print(false,ÿfalse); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿOrientation

        Thisÿwalkthroughÿillustratesÿhowÿtoÿmakeÿsimpleÿmodificationsÿtoÿtheÿpageÿorientationÿofÿyourÿreportÿforÿ printing.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l Accessingÿtheÿprinterÿsettingsÿdialogÿ

        l Changingÿtheÿpageÿorientationÿofÿyourÿreportÿforÿprintingÿ l Usingÿcodeÿtoÿchangeÿtheÿpageÿorientationÿforÿprintingÿ

        l Viewingÿtheÿreportÿÿ

        Accessingÿtheÿprinterÿsettingsÿdialog

        Toÿaccessÿtheÿprinterÿsettingsÿdialog 1. OpenÿanÿexistingÿActiveReport.ÿ 2. Clickÿonÿanyÿsectionÿofÿtheÿreportÿtoÿselectÿit.ÿ 3. FromÿtheÿReport menu,ÿselectÿSettings.

        4. SelectÿtheÿPrinterÿSettings tab.ÿ

        Changingÿtheÿpageÿorientationÿofÿyourÿreportÿforÿprinting ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ308

        Toÿchangeÿtheÿpageÿorientationÿofÿyourÿreportÿforÿprinting 1. OnÿtheÿPrinterÿSettingsÿtab,ÿinÿtheÿorientationÿbox,ÿselectÿeitherÿportraitÿorÿlandscape.ÿ

        2. ClickÿOK toÿreturnÿtoÿtheÿreport.ÿ Note: Pageÿorientationÿcanÿonlyÿbeÿmodifiedÿbeforeÿtheÿreportÿruns.ÿOtherwise,ÿchangesÿmadeÿtoÿtheÿ pageÿorientationÿwillÿnotÿbeÿreflectedÿwhenÿprinted.

        Usingÿcodeÿtoÿchangeÿtheÿpageÿorientation

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Changeÿtheÿpageÿorientationÿofÿtheÿreportÿforÿprintingÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Clickÿinÿtheÿgrayÿsectionÿunderneathÿtheÿreportÿtoÿselectÿtheÿreport,ÿthenÿdouble-click.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿreport'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Changeÿtheÿpageÿorientationÿofÿtheÿreportÿforÿprintingÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlikeÿforÿchangingÿtheÿpageÿorientationÿ toÿlandscape. 'VisualÿBasic PrivateÿSubÿrptPrint_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart Me.PageSettings.Orientationÿ=ÿPageOrientation.Landscape EndÿSub //C# privateÿvoidÿrptPrint_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.PageSettings.Orientationÿ=ÿDataDynamics.ActiveReports.Document .PageOrientation.Landscape; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        RichTextÿWalkthroughs

        WithÿActiveReports,ÿRichTextÿcanÿbeÿusedÿforÿfieldÿmergingÿasÿwellÿasÿforÿformattingÿtext.ÿTheÿfollowingÿ walkthroughsÿdescribeÿhowÿtoÿuseÿtheÿfeaturesÿofÿtheÿRichTextÿcontrol. RichTextÿandÿFieldÿMerging Illustratesÿhowÿtoÿcreateÿaÿmail-mergeÿreportÿusingÿtheÿRichTextÿcontrol.ÿ HTML,ÿTablesÿandÿExportingÿwithÿRichText ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ309

        ÿ IllustratesÿhowÿtoÿcreateÿandÿexportÿaÿreportÿwhichÿcontainsÿtheÿRichTextÿcontrol.ÿ

        Walkthrough:ÿRichÿTextÿandÿFieldÿMerging

        ActiveReportsÿsupportsÿfieldÿmergedÿreportsÿusingÿtheÿRichTextÿcontrol.ÿTheÿRichTextÿcontrolÿcanÿcontainÿfieldÿ placeholdersÿthatÿareÿreplaceableÿwithÿtheirÿvaluesÿ(merged)ÿatÿrunÿtime.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿmail-mergeÿreportÿusingÿtheÿRichTextÿcontrol. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿfieldsÿtoÿtheÿRichTextÿcontrolÿ l UsingÿtheÿFetchDataÿeventÿtoÿgetÿinformationÿfromÿtheÿdataÿsourceÿ

        l AddingÿcodeÿtoÿupdateÿfieldÿvaluesÿinÿtheÿRichTextÿcontrolÿforÿeachÿrecordÿ l AddingÿcodeÿtoÿtheÿgroupÿheaderÿBeforePrintÿeventÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿcompleteÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing:

        AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ310

        3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptLetter.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿ Customers.CustomerID,ÿCustomers.CompanyName,ÿ Customers.ContactName,ÿCustomers.Address,ÿ Customers.City,ÿCustomers.Region,ÿCustomers.Country,ÿCustomers.PostalCode,ÿOrders.OrderID,ÿ Orders.OrderDate,ÿ[OrderÿSubtotals].Subtotal FROMÿCustomersÿINNERÿJOINÿ([OrderÿSubtotals]ÿINNERÿJOINÿOrdersÿONÿ[OrderÿSubtotals].OrderIDÿ=ÿ Orders.OrderID)ÿONÿCustomers.CustomerIDÿ=ÿOrders.CustomerID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptLetter.ÿÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghCustomerID

        ¡ ChangeÿtheÿDataField propertyÿtoÿCustomerID ¡ ChangeÿtheÿColumnLayoutÿpropertyÿto False ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿfooter:ÿ ¡ ChangeÿtheÿNameÿpropertyÿtoÿgfCustomerID

        ¡ ChangeÿtheÿColumnLayoutÿpropertyÿtoÿFalse

        ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue ¡ ChangeÿtheÿNewPage propertyÿtoÿAfter.ÿ 4. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageHeaderÿsection:ÿ

        Control Name Text Location

        Picture imgLogo 4,ÿ0ÿ

        Label lblNorthWind NorthWindÿ 5,ÿ0.0625ÿ

        Label lblTraders Tradersÿ 5,ÿ0.4375ÿ

        5. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        RichText rtf 0,ÿ0ÿ

        Textbox Subtotalÿ txtTotalOrders Visibleÿ=ÿFalseÿ 5.437,ÿ 0.0625ÿ OutputFormatÿ=ÿ Currency SummaryType =ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ311

        SubTotal SummaryGroup =ÿ ghCustomerID

        Label lblOrderID OrderÿIDÿ 0.875,ÿ 2.25ÿ

        Label lblOrderDate Orderÿ 1.875,ÿ Dateÿ 2.25ÿ

        Label lblAmount Amountÿ 4.375,ÿ 2.25ÿ

        6. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Miscellaneous Location

        OrderIDÿ OrderÿIDÿ Alignnent:ÿRightÿ 0.8125,ÿ0ÿ

        OrderDateÿ OrderÿDateÿ OutputFormatÿ=ÿMM/dd/yy 1.875,ÿ0ÿ

        Subtotalÿ Subtotalÿ OutputFormatÿ=ÿCurrencyÿ 4.3125,ÿ0ÿ Alignment:ÿRight

        7. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupFooterÿsection:ÿ

        Control Name Text Location

        Label lblYours Yours,ÿ 0.1875,ÿ0.125ÿ

        Label lblNTAP AccountsÿReceivableÿ 0.1875,ÿ0.4375ÿ

        8. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿPageFooterÿsection:ÿ

        Control Name Text Location

        Label lblNWAddress NorthWindÿTraders,ÿOneÿPortalsÿWay,ÿTwinÿPointsÿ 0,ÿ WAÿ98156 0.0625

        AddingÿfieldsÿtoÿtheÿRichTextÿcontrol

        ToÿaddÿfieldsÿtoÿtheÿRichTextÿcontrol 1. Double-clickÿinsideÿtheÿRichTextÿcontrolÿboxÿtoÿselectÿit.ÿ 2. Right-clickÿinsideÿtheÿboxÿandÿchooseÿInsertÿField.ÿ 3. Insertÿtheÿfollowingÿfieldsÿinÿtheÿfollowingÿorder:ÿ ¡ Dateÿ

        ¡ CompanyNameÿ ¡ ContactNameÿ

        ¡ AddressLineÿ

        ¡ Cityÿ ¡ Regionÿ

        ¡ Countryÿ ¡ PostalCodeÿ ¡ ContactNameÿ

        ¡ TotalOrdersÿ 4. AddÿtheÿfollowingÿtextÿtoÿtheÿRichTextÿcontrolÿbox:ÿ"Dearÿ[!ContactName],ÿThankÿyouÿforÿyourÿbusiness,ÿ belowÿisÿaÿlistÿofÿyourÿordersÿforÿtheÿpastÿyearÿwithÿaÿtotalÿofÿ[!TotalOrders].ÿPleaseÿtakeÿthisÿopportunityÿ toÿreviewÿeachÿorderÿandÿtotalÿforÿaccuracy.ÿCallÿusÿatÿ1-800-DNT-CALLÿwithÿanyÿquestionsÿorÿconcerns."ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ312

        5. YourÿRichTextÿcontrolÿshouldÿbeÿarrangedÿlikeÿtheÿfollowing.ÿ

        UsingÿtheÿFetchDataÿeventÿtoÿgetÿinformationÿfromÿtheÿdataÿsource

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptLetter,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptLetter,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ (BaseÿClassÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ FetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptLetter'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ l Retrieveÿinformationÿfromÿtheÿdataÿsourceÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿgrayÿareaÿbelowÿrptLetterÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptLetter'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Retrieveÿinformationÿfromÿtheÿdataÿsourceÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic Dimÿm_companyNameÿAsÿString Dimÿm_contactNameÿAsÿString Dimÿm_addressLineÿAsÿString Dimÿm_cityÿAsÿString Dimÿm_regionÿAsÿString Dimÿm_countryÿAsÿString Dimÿm_postalCodeÿAsÿString PrivateÿSubÿrptLetter_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamicsÿ_ .ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData m_companyNameÿ=ÿFields("CompanyName").Value m_contactNameÿ=ÿFields("ContactName").Value m_addressLineÿ=ÿFields("Address").Value m_cityÿ=ÿFields("City").Value IfÿFields("Region").ValueÿIsÿSystem.DBNull.ValueÿThen m_regionÿ=ÿ"" Else m_regionÿ=ÿFields("Region").Value EndÿIf m_countryÿ=ÿFields("Country").Value m_postalCodeÿ=ÿFields("PostalCode").Value EndÿSub //C# stringÿm_companyName; stringÿm_contactName; stringÿm_addressLine; stringÿm_city; stringÿm_region; stringÿm_country; stringÿm_postalCode; privateÿvoidÿrptLetter_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3ÿ .FetchEventArgsÿeArgs) ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ313

        { m_companyNameÿ=ÿFields["CompanyName"].Value.ToString(); m_contactNameÿ=ÿFields["ContactName"].Value.ToString(); m_addressLineÿ=ÿFields["Address"].Value.ToString(); m_cityÿ=ÿFields["City"].Value.ToString(); if(Fields["Region"].ValueÿisÿSystem.DBNull) m_regionÿ=ÿ""; else m_regionÿ=ÿFields["Region"].Value.ToString(); m_countryÿ=ÿFields["Country"].Value.ToString(); m_postalCodeÿ=ÿFields["PostalCode"].Value.ToString(); }

        AddingÿcodeÿtoÿupdateÿtheÿfieldÿvaluesÿinÿtheÿRichÿTextÿcontrol

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptLetter,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptLetter,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ ghCustomerID.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿFormat.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿrptLetter'sÿghCustomerID_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿ to:ÿ

        l UpdateÿtheÿfieldÿvaluesÿinÿtheÿRichTextÿcontrolÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿGroupHeaderÿsectionÿofÿrptLetterÿtoÿselectÿit.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿforÿghCustomerIDÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿFormat.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿrptLetter'sÿghCustomerID_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l UpdateÿtheÿfieldÿvaluesÿinÿtheÿRichTextÿcontrol Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿghCustomerID_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿghCustomerID.Format Me.rtf.ReplaceField("CompanyName",ÿm_companyName) Me.rtf.ReplaceField("ContactName",ÿm_contactName) Me.rtf.ReplaceField("AddressLine",ÿm_addressLine) Me.rtf.ReplaceField("City",ÿm_city) Me.rtf.ReplaceField("Region",ÿm_region) Me.rtf.ReplaceField("Country",ÿm_country) Me.rtf.ReplaceField("PostalCode",ÿm_postalCode) Me.rtf.ReplaceField("Date",ÿSystem.DateTime.Today.Date) EndÿSub //C# privateÿvoidÿghCustomerID_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.rtf.ReplaceField("CompanyName",ÿm_companyName); this.rtf.ReplaceField("ContactName",ÿm_contactName); this.rtf.ReplaceField("AddressLine",ÿm_addressLine); this.rtf.ReplaceField("City",ÿm_city); this.rtf.ReplaceField("Region",ÿm_region); this.rtf.ReplaceField("Country",ÿm_country); this.rtf.ReplaceField("PostalCode",ÿm_postalCode); this.rtf.ReplaceField("Date",ÿSystem.DateTime.Today.Date.ToString()); }

        AddingÿcodeÿtoÿtheÿGroupÿHeaderÿBeforePrintÿEvent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptLetter,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptLetter,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ ghCustomerID.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿBeforePrint.ÿ Thisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptLetter'sÿghCustomerID_BeforePrintÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ314

        l ClickÿinÿtheÿGroupHeaderÿsectionÿofÿrptLetterÿtoÿselectÿit.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿforÿghCustomerIDÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿBeforePrint.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿrptLetter'sÿghCustomerID_BeforePrintÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿghCustomerID_BeforePrint(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿghCustomerID.BeforePrint Me.rtf.ReplaceField("TotalOrders",ÿMe.txtTotalOrders.Text) EndÿSub //C# privateÿvoidÿghCustomerID_BeforePrint(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.rtf.ReplaceField("TotalOrders",this.txtTotalOrders.Text); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        HTML,ÿTablesÿandÿExportingÿwithÿRichText

        ActiveReportsÿsupportsÿexportingÿwithÿtablesÿinÿtheÿRichTextÿcontrol.ÿRichTextÿcontrolsÿcanÿbeÿloadedÿwithÿanÿ RTFÿfileÿwhichÿcontainsÿtables,ÿorÿevenÿanÿHTMLÿfile,ÿandÿtheÿresultingÿreportÿcanÿbeÿexportedÿtoÿanyÿofÿaÿ numberÿofÿformats.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿandÿexportÿaÿreportÿwhichÿcontainsÿtheÿRichTextÿcontrol. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿprojectÿ l Addingÿtheÿappropriateÿexportÿfiltersÿtoÿyourÿprojectÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l LoadingÿanÿRTFÿfileÿintoÿaÿRichTextÿcontrolÿ l CreatingÿanÿHTMLÿfileÿtoÿbeÿloadedÿintoÿaÿRichTextÿcontrolÿ l LoadingÿtheÿHTMLÿfileÿintoÿaÿRichTextÿcontrolÿ

        l Viewingÿtheÿreportÿ l Usingÿtheÿexportÿmethodsÿtoÿexportÿdataÿtoÿallÿavailableÿfileÿformatsÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿwillÿneedÿanÿRTFÿfileÿwhichÿcontainsÿaÿtable.

        AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptRich.ÿ 4. ClickÿOpen.ÿ

        Addingÿtheÿexportÿfiltersÿtoÿyourÿproject

        Toÿaddÿtheÿexportÿfiltersÿtoÿyourÿproject ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ315

        1. Clickÿonÿtheÿfollowingÿexportÿcontrolsÿoneÿatÿaÿtimeÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿthem.ÿ ¡ HtmlExportÿ ¡ PdfExportÿ

        ¡ RtfExportÿ ¡ TextExportÿ

        ¡ TiffExportÿ

        ¡ XlsExportÿ 2. DragÿeachÿcontrolÿontoÿtheÿWindowsÿForm.ÿ 3. TheÿcontrolsÿwillÿappearÿinÿtheÿtrayÿbelowÿtheÿWindowsÿForm.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsection:ÿ

        Control Name Size Location

        RichText rtfRTF 3,ÿ1.5 0,ÿ0

        RichText rtfHTML 3,ÿ1.5 3.25,ÿ0

        CreatingÿanÿRTFÿfileÿtoÿbeÿloadedÿintoÿaÿRichTextÿcontrol

        ToÿwriteÿaÿquickÿRTFÿfile

        l OpenÿWordpad,ÿandÿpasteÿtheÿfollowingÿtextÿintoÿit.ÿ CustomerÿListÿbyÿCountry

        Argentina

        ¡ Ranchoÿgrandeÿ ¡ OcéanoÿAtlánticoÿLtda.ÿ ¡ CactusÿComidasÿparaÿllevarÿ

        Austria

        ¡ Piccoloÿundÿmehrÿ ¡ ErnstÿHandelÿ

        Belgium ¡ Suprêmesÿdélicesÿ

        ¡ MaisonÿDeweyÿ

        Brazil ¡ FamiliaÿArquibaldoÿ

        ¡ WellingtonÿImprotadoraÿ

        ¡ QueÿDelíciaÿ ¡ TradiçãoÿHipermercadosÿ

        ¡ RicardoÿAdocicadosÿ ¡ HanariÿCarnesÿ ¡ QueenÿCozinhaÿ

        ¡ ComércioÿMineiroÿ ¡ GourmetÿLanchonetesÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ316

        Month Sales October $4,872 November $8,517 December $9,623

        l Saveÿtheÿfileÿasÿ"sample.rtf"ÿinÿtheÿbinÿdirectoryÿ(VB)ÿorÿtheÿdebugÿdirectoryÿinÿtheÿbinÿ(C#)ÿofÿyourÿ project.ÿ

        LoadingÿanÿRTFÿfileÿintoÿaÿRichTextÿcontrolÿ

        ToÿloadÿanÿRTFÿfileÿintoÿtheÿRichTextÿcontrol

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC#

        l Double-clickÿinÿtheÿdetailÿsectionÿofÿofÿrptRich.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptRich'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ ¡ LoadÿanÿRTFÿfileÿintoÿtheÿRichTextÿcontrolÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail.Format rtfRTF.LoadFile(Application.StartupPathÿ&ÿ"\sample.rtf") EndÿSub //C# privateÿvoidÿDetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rtfRTF.LoadFile(System.Windows.Forms.Application.StartupPathÿ+ÿ"\\sample.rtf"); }

        CreatingÿanÿHTMLÿfileÿtoÿbeÿloadedÿintoÿaÿRichTextÿcontrol

        ToÿwriteÿaÿquickÿHTMLÿfile l OpenÿaÿNotepad,ÿandÿpasteÿtheÿfollowingÿcodeÿintoÿit.ÿ

        CustomerÿListÿbyÿCountry

        Argentina

        • Ranchoÿgrande
        • OcéanoÿAtlánticoÿLtda.
        • CactusÿComidasÿparaÿllevar

        Austria

        • Piccoloÿundÿmehr
        • ErnstÿHandel

        Belgium

        • Suprêmesÿdélices
        • MaisonÿDewey

        Brazil

        • FamiliaÿArquibaldo
        • WellingtonÿImprotadora
        • QueÿDelícia
        • TradiçãoÿHipermercados
        • RicardoÿAdocicados
        • HanariÿCarnes
        • QueenÿCozinha
        • ComércioÿMineiro
        • GourmetÿLanchonetes
        ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ317

        MonthSales
        October$4,872
        November$8,517
        December$9,623
        l Saveÿtheÿfileÿasÿ"sample.html"ÿinÿtheÿbinÿdirectoryÿ(VB)ÿorÿtheÿdebugÿdirectoryÿinÿtheÿbinÿ(C#)ÿofÿyourÿ project.ÿ

        LoadingÿtheÿHTMLÿfileÿintoÿaÿRichTextÿcontrol

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptRich,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿInÿtheÿevent-handlingÿmethodÿforÿrptRich'sÿDetail_Formatÿeventÿcreatedÿpreviously,ÿ addÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l LoadÿtheÿHTMLÿfileÿintoÿtheÿRichTextÿcontrolÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptRich,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿInÿtheÿevent-handlingÿmethodÿforÿrptRich'sÿDetail_Formatÿeventÿcreatedÿpreviously,ÿ addÿcodeÿtoÿtheÿhandlerÿto:ÿ l LoadÿtheÿHTMLÿfileÿintoÿtheÿRichTextÿcontrolÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail.Format rtfRTF.LoadFile(Application.StartupPathÿ&ÿ"\sample.rtf")

        DimÿstreamÿAsÿNewÿSystem.IO.FileStream(Application.StartupPathÿ&ÿ"\sample.html",ÿ_ IO.FileMode.Open) rtfHTML.LoadFile(stream) EndÿSub //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rtfRTF.LoadFile(System.Windows.Forms.Application.StartupPathÿ+ÿ"\\sample.rtf"); System.IO.FileStreamÿstreamÿ=ÿnewÿSystem.IO.FileStream(System.Windows.Forms .Application.StartupPathÿ+ÿ"\\sample.html",System.IO.FileMode.Open); rtfHTML.LoadFile(stream); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿForm1.ÿ 2. Setÿtheÿviewerÿcontrol'sÿDockÿpropertyÿtoÿFill.ÿ 3. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿVisualÿBasic

        l Double-clickÿtheÿcenterÿofÿtheÿviewerÿcontrol.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿViewer1ÿ _Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrun

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿC#

        l Double-clickÿtheÿcenterÿofÿtheÿviewerÿcontrol.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ318

        viewer1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrunÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿViewer1_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Viewer1.Load DimÿrptÿAsÿNewÿrptRich() Viewer1.Documentÿ=ÿrpt.Document rpt.Run() EndÿSub //C# privateÿvoidÿviewer1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptRichÿrptÿ=ÿnewÿrptRich(); this.viewer1.Documentÿ=ÿrpt.Document; rpt.Run(); }

        Usingÿtheÿexportÿmethodsÿtoÿexportÿdataÿtoÿallÿavailableÿfileÿformats

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasicÿorÿC# l Inÿtheÿevent-handlingÿmethodÿforÿtheÿViewer1_Loadÿeventÿcreatedÿpreviously,ÿaddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Exportÿtheÿreportÿtoÿallÿavailableÿfileÿformats Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿViewer1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ Handlesÿarv.Load DimÿrptÿAsÿNewÿrptRich rpt.Run() Viewer1.Documentÿ=ÿrpt.Document

        Me.HtmlExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\HTMLExpt.html") Me.PdfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\PDFExpt.pdf") Me.RtfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\RTFExpt.rtf") Me.TextExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TextExpt.txt") Me.TiffExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TIFFExpt.tiff") Me.XlsExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\XLSExpt.xls") EndÿSub //C# privateÿvoidÿviewer1_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptDDÿrptÿ=ÿnewÿrptRich(); rpt.Run(); viewer1.Documentÿ=ÿrpt.Document;

        this.htmlExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ "\\HTMLExpt.html"); this.pdfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\PDFExpt.pdf"); this.rtfExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\RTFExpt.rtf"); this.textExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TextExpt.txt"); this.tiffExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\TIFFExpt.tiff"); ÿ this.xlsExport1.Export(rpt.Document,ÿApplication.StartupPathÿ+ÿ"\\XLSExpt.xls"); }

        Run-TimeÿReportingÿWalkthroughs

        ActiveReportsÿallowsÿobjects,ÿcontrolsÿandÿtheÿdataÿsourceÿtoÿbeÿcompletelyÿaccessibleÿatÿrunÿtime.ÿTheseÿ propertiesÿcanÿbeÿmodifiedÿtoÿprovideÿaÿdynamicÿviewÿofÿyourÿreport. ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ319

        CreatingÿandÿModifyingÿReportÿLayoutsÿatÿRunÿTime Describesÿhowÿtoÿcreateÿandÿmodifyÿreportÿlayoutsÿdynamically.ÿ ModifyingÿtheÿReportÿDataÿSourceÿatÿRunÿTime ÿ DescribesÿhowÿtoÿchangeÿtheÿreportÿdataÿsourceÿatÿrunÿtimeÿusingÿtheÿReportStartÿevent.ÿ

        Walkthrough:ÿCreatingÿandÿModifyingÿReportÿLayoutsÿatÿRunÿTime

        ActiveReportsÿobjectsÿandÿcontrolsÿareÿcompletelyÿaccessibleÿatÿrunÿtime.ÿTheÿpropertiesÿofÿanyÿofÿtheÿreportÿ sectionsÿorÿcontrolsÿcanÿbeÿmodifiedÿtoÿproduceÿaÿdynamicÿviewÿofÿtheÿreport.ÿTheÿformatÿeventÿallowsÿtheÿ propertiesÿofÿreportÿsectionsÿandÿcontrolsÿtoÿbeÿmodifiedÿincludingÿheight,ÿvisibilityÿandÿotherÿvisualÿ properties.ÿTheÿformatÿeventÿisÿtheÿonlyÿeventÿinÿwhichÿtheÿprintableÿareaÿofÿaÿsectionÿcanÿbeÿmodified.ÿOnceÿ thisÿeventÿisÿcompleted,ÿanyÿchangesÿtoÿtheÿsection'sÿheightÿwillÿnotÿbeÿreflectedÿinÿtheÿreportÿoutput.ÿ Note ControlsÿmayÿbeÿaddedÿdynamicallyÿinÿtheÿReportStartÿeventÿbutÿshouldÿnotÿbeÿaddedÿ dynamicallyÿafterÿtheÿReportStartÿeventÿfiresÿasÿproblemsÿmayÿresult.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿreportÿlayoutÿatÿrunÿtimeÿbasedÿonÿuserÿinput.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l AddingÿcontrolsÿtoÿtheÿWindowsÿFormÿtoÿcontainÿdataÿ

        l AddingÿtheÿdataÿadapterÿtoÿtheÿWindowsÿFormÿandÿgeneratingÿaÿdatasetÿ l Addingÿcodeÿtoÿtheÿblankÿreportÿ

        l AddingÿcodeÿtoÿtheÿWindowsÿFormÿ

        l Addingÿcodeÿtoÿtheÿreport'sÿDetail_Formatÿeventÿ l Addingÿcodeÿtoÿtheÿreport'sÿReportStartÿeventÿ

        l AddingÿcodeÿtoÿtheÿWindowÿForm'sÿ"GenerateÿReport"ÿbuttonÿClickÿeventÿ l AddingÿcodeÿtoÿtheÿCheckedÿListBox'sÿSelectedIndexChangedÿeventÿonÿtheÿWindowsÿFormÿ l AddingÿcodeÿtoÿtheÿForm_Loadÿeventÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿoutputÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ320

        AddingÿanÿActiveReportÿtoÿyourÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptFieldsRT.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ321

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproducts".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        AddingÿcontrolsÿtoÿtheÿWindowsÿFormÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿform l AddÿtheÿfollowingÿcontrolsÿtoÿtheÿWindowsÿForm:ÿ

        Dockÿ Control Property Name Text Miscellaneous

        Panel Left Panel1 Height:ÿ406ÿ Width:ÿ200

        Label Top lblSelectFields SelectÿFieldsÿforÿ Location:ÿPanel1 YourÿReport

        Checkedÿ Fill clbFields ReportÿFields Location:ÿPanel1 ListBox

        Button Bottom btnGenRep GenerateÿReport Location:ÿPanel1

        CheckBox Bottom chkGroup GroupÿByÿCategoryÿ Location:ÿPanel1 ID

        Viewer Fill Viewer1 Location:ÿWindowsÿ Form

        AddingÿaÿdataÿadapterÿtoÿtheÿWindowsÿFormÿandÿgeneratingÿtheÿdataset

        Toÿaddÿaÿdataÿadapterÿtoÿtheÿform 1. OnÿtheÿData toolbox,ÿdouble-clickÿOleDbDataAdapter.ÿ 2. ThisÿaddsÿtheÿadapterÿtoÿtheÿWindowsÿFormÿandÿopensÿtheÿDataÿAdapterÿConfigurationÿWizard.ÿ 3. Followÿtheÿinstructionsÿtoÿchooseÿtheÿdataÿconnection,ÿselectÿtheÿdataÿprovider,ÿselectÿtheÿdatabaseÿandÿ enterÿtheÿSQLÿstatement,ÿ"SELECTÿCategoryID,ÿDiscontinued,ÿProductID,ÿProductName,ÿQuantityPerUnit,ÿ ReorderLevel,ÿSupplierID,ÿUnitPrice,ÿUnitsInStock,ÿUnitsOnOrderÿFROMÿProducts"ÿ(Forÿhelpÿwithÿthis,ÿseeÿ "Connectingÿtheÿreportÿtoÿaÿdataÿsource"ÿabove.ÿ 4. Clickÿ"Finish"ÿtoÿreturnÿtoÿtheÿWindowsÿForm.ÿ

        Toÿgenerateÿtheÿdataset 1. ClickÿonÿDataÿ>ÿGenerateÿDataset. onÿtheÿVisualÿStudioÿmenuÿbar.ÿ

        2. ThisÿopensÿtheÿGenerateÿDatasetÿdialog.ÿ 3. ClickÿNew andÿmakeÿsureÿtheÿselectedÿtableÿtoÿbeÿaddedÿtoÿtheÿdatasetÿisÿProducts.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ322

        4. Checkÿ"Addÿthisÿdatasetÿtoÿtheÿdesigner"ÿandÿclick OK.ÿ

        AddingÿcodeÿtoÿtheÿblankÿActiveReport

        Toÿaddÿcodeÿtoÿtheÿblankÿreport

        l Insertÿtheÿfollowingÿcodeÿbeneathÿ"ActiveReportsÿDesignerÿgeneratedÿcode."ÿ 'ÿVisualÿBasic Privateÿm_arrayFieldsÿAsÿArrayListPublicÿWriteOnlyÿPropertyÿFieldsList()ÿAsÿArrayList Set(ByValÿValueÿAsÿArrayList) m_arrayFieldsÿ=ÿValue EndÿSet EndÿProperty Privateÿm_useGroupsÿAsÿBooleanPublicÿWriteOnlyÿPropertyÿUseGroups()ÿAsÿBoolean Set(ByValÿValueÿAsÿBoolean) m_useGroupsÿ=ÿFalse m_useGroupsÿ=ÿValue EndÿSet EndÿProperty PrivateÿSubÿconstructReport() Try Me.Detail1.CanGrowÿ=ÿTrue Me.Detail1.CanShrinkÿ=ÿTrue Me.Detail1.KeepTogetherÿ=ÿTrue Ifÿm_useGroupsÿ=ÿTrueÿThen Me.Sections.InsertGroupHF() CType(Me.Sections("GroupHeader1"),ÿGroupHeader)._ DataFieldÿ=ÿ"CategoryID" Me.Sections("GroupHeader1").BackColorÿ=ÿSystem.Drawingÿ_ .Color.SlateBlue Me.Sections("GroupHeader1").CanGrowÿ=ÿTrue Me.Sections("GroupHeader1").CanShrinkÿ=ÿTrue CType(Me.Sections("GroupHeader1"),ÿGroupHeader).RepeatStyleÿÿ_ =ÿRepeatStyle.OnPageIncludeNoDetail Me.Sections("GroupHeader1").Heightÿ=ÿ0 DimÿtxtÿAsÿNewÿTextBox() txt.DataFieldÿ=ÿ"CatagoryID" txt.Locationÿ=ÿNewÿSystem.Drawing.PointF(0.0F,ÿ0) txt.Widthÿ=ÿ2.0F txt.Heightÿ=ÿ0.3F txt.Styleÿ=ÿ"font-weight:ÿbold;ÿfont-size:ÿ16pt" Me.Sections("GroupHeader1").Controls.Add(txt) EndÿIf Forÿiÿ=ÿ0ÿToÿm_arrayFields.Countÿ- 1 Ifÿ(m_useGroupsÿ=ÿFalse)ÿOrÿ(m_useGroupsÿAndAlsoÿ_ m_arrayFields(i).ToStringÿ<>ÿ"CategoryID")ÿThen DimÿlblÿAsÿNewÿLabel() lbl.Textÿ=ÿm_arrayFields(i)ÿ+ÿ":" lbl.Location()ÿ=ÿNewÿSystem.Drawing.PointFÿ_ (0.0F,ÿm_currentY) lbl.Widthÿ=ÿ0.9F lbl.Heightÿ=ÿm_defaultHeight Me.Detail.Controls.Add(lbl) DimÿtxtÿAsÿNewÿTextBox() txt.DataFieldÿ=ÿm_arrayFields(i) txt.Locationÿ=ÿNewÿSystem.Drawing.PointFÿ_ (1.0F,ÿm_currentY) txt.Widthÿ=ÿm_defaultWidth txt.Heightÿ=ÿm_defaultHeight Me.Detail.Controls.Add(txt) Ifÿm_arrayFields(i)ÿ=ÿ"UnitPrice"ÿThen txt.OutputFormatÿ=ÿ"$#.00" EndÿIf m_currentYÿ=ÿm_currentYÿ+ÿm_defaultHeight EndÿIf Next CatchÿexÿAsÿException System.Windows.Forms.MessageBox.Show("Errorÿinÿ_ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ323

        Report-constructReport:ÿ"ÿ+ÿex.Message,ÿ"ProjectÿError",ÿ_ System.Windows.Forms.MessageBoxButtons.OK,ÿSystem.Windowsÿ_ .Forms.MessageBoxIcon.Error) EndÿTry EndÿSub //C# privateÿArrayListÿm_arrayFields; publicÿArrayListÿFieldsList { set{m_arrayFieldsÿ=ÿvalue;} } privateÿboolÿm_useGroupsÿ=ÿfalse; publicÿboolÿUseGroups { set{m_useGroupsÿ=ÿvalue;} } floatÿm_defaultHeightÿ=ÿ.2f; floatÿm_defaultWidthÿ=ÿ4f; floatÿm_currentYÿ=ÿ0f; privateÿvoidÿconstructReport() { try { this.detail.CanGrowÿ=ÿtrue; this.detail.CanShrinkÿ=ÿtrue; this.detail.KeepTogetherÿ=ÿtrue; if(m_useGroups) { this.Sections.InsertGroupHF(); ((GroupHeader)this.Sections["GroupHeader1"]).DataFieldÿ= "CategoryID"; this.Sections["GroupHeader1"].BackColorÿ=ÿSystem.Drawing .Color.SlateBlue; this.Sections["GroupHeader1"].CanGrowÿ=ÿtrue; this.Sections["GroupHeader1"].CanShrinkÿ=ÿtrue; ((GroupHeader)this.Sections["GroupHeader1"]).RepeatStyleÿ= RepeatStyle.OnPageIncludeNoDetail; this.Sections["GroupFooter1"].Heightÿ=ÿ0; TextBoxÿtxtÿ=ÿnewÿTextBox(); txt.DataFieldÿ=ÿ"CategoryID"; txt.Locationÿ=ÿnewÿSystem.Drawing.PointF(0f,0); txt.Widthÿ=2f; txt.Heightÿ=ÿ.3f; txt.Styleÿ=ÿ"font-weight:ÿbold;ÿfont-size:ÿ16pt;"; this.Sections["GroupHeader1"].Controls.Add(txt); } for(intÿi=0;i

        } catch(Exceptionÿex) { System.Windows.Forms.MessageBox.Show("ErrorÿinÿReport-constructReport: "ÿ+ÿex.Message,"ProjectÿError",System.Windows.Forms .MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error); } }

        AddingÿcodeÿtoÿtheÿWindowsÿForm

        Toÿaddÿcodeÿtoÿtheÿform

        l Insertÿtheÿfollowingÿcodeÿbeneathÿ"ActiveReportsÿDesignerÿgeneratedÿcode."ÿ 'ÿVisualÿBasic PrivateÿSubÿfillCheckBox() Forÿiÿ=ÿ0ÿToÿMe.DataSet11.Tables.Countÿ- 1 Forÿcÿ=ÿ0ÿToÿMe.DataSet11.Tables(i).Columns.Countÿ - 1 Me.clbFields.Items.Add(Me.DataSet11.Tables(i).Columns(c).ColumnName) Next Next EndÿSub PrivateÿSubÿlaunchReport() DimÿrptÿAsÿNewÿrptFieldsRT() Try rpt.FieldsListÿ=ÿm_arrayField rpt.ds.SQLÿ=ÿMe.OleDbDataAdapter1.SelectCommand.CommandText rpt.ds.ConnectionStringÿ=ÿMe.OleDbConnection1.ConnectionString Viewer1.Documentÿ=ÿrpt.Document rpt.Run() CatchÿexÿAsÿException System.Windows.Forms.MessageBox.Show(Me,ÿ"ErrorÿinÿlaunchReport:ÿ"ÿ_ +ÿex.Message,ÿ"ProjectÿError",ÿMessageBoxButtons.OK,ÿ_ MessageBoxIcon.Error) EndÿTry EndÿSub //C# staticÿvoidÿMain() { Application.Run(newÿForm1()); } privateÿstringÿgetDatabasePath() { RegistryKeyÿregKeyÿ=ÿRegistry.LocalMachine; regKeyÿ=ÿregKey.CreateSubKey("SOFTWARE\\DataÿDynamics\\ActiveReports.NET \\SampleDB"); returnÿ(string)regKey.GetValue(""); } privateÿvoidÿfillCheckBox() { for(intÿi=0;i

        this.viewer1.Documentÿ=ÿrpt.Document; rpt.Run(); } catch(Exceptionÿex) { MessageBox.Show(this,"ErrorÿinÿlaunchReport:ÿ"ÿ+ÿex.Message,"Project Error",MessageBoxButtons.OK,MessageBoxIcon.Error); } }

        AddingÿcodeÿtoÿtheÿDetail_Formatÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿinÿtheÿdetailÿsectionÿofÿrptFields.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptFieldsRT'sÿ Detail_Formatÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿinÿtheÿdetailÿsectionÿofÿrptFields.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptFieldsRT'sÿ Detail_Formatÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic Dimÿm_default HeightÿAsÿSingleÿ=ÿ0.2 Dimÿm_default WidthÿAsÿSingleÿ=ÿ4 Dimÿm_currentYÿAsÿSingleÿ=ÿ0 DimÿiÿAsÿInteger Dimÿm_countÿAsÿInteger PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail1.Format Ifÿm_countÿModÿ2ÿ=ÿ0ÿThen Me.Detail.BackColorÿ=ÿSystem.Drawing.Color.SlateGray Else Me.Detail.BackColorÿ=ÿSystem.Drawing.Color.DarkSeaGreen EndÿIf m_countÿ=ÿm_countÿ+ÿ1 EndÿSub //C# intÿm_count; privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { if(m_countÿ%ÿ2ÿ==0) { this.detail.BackColorÿ=ÿSystem.Drawing.Color.SlateGray; } else { this.detail.BackColorÿ=ÿSystem.Drawing.Color.DarkSeaGreen; } m_count++; }

        AddingÿcodeÿtoÿtheÿReportStartÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptFieldsRTÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptFieldsRT.ÿAddÿ codeÿtoÿtheÿhandlerÿto:ÿ l ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptFieldsRTÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptFieldsRT.ÿAddÿ codeÿtoÿtheÿhandlerÿto:ÿ

        l Setÿtheÿdataÿsourceÿconnectionÿstringÿ l SetÿtheÿdataÿsourceÿSQLÿqueryÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ326

        l OpenÿtheÿconnectionÿtoÿcreateÿtheÿDataReaderÿ anÿevent-handlingÿmethodÿforÿrptFieldsRT'sÿReportStartÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿrptFieldsRT_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿ_ System.EventArgs)ÿHandlesÿMyBase.ReportStart constructReport() EndÿSub //C# privateÿvoidÿrptFieldsRT_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { constructReport(); }

        AddingÿcodeÿforÿbtnGenRep'sÿClickÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿonÿbtnGenRep.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿbtnGenRep'sÿClickÿevent.ÿAddÿtheÿ followingÿcodeÿtoÿtheÿbtnGenRep_Clickÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿonÿbtnGenRep.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿbtnGenRep'sÿClickÿevent.ÿAddÿtheÿ followingÿcodeÿtoÿtheÿbtnGenRep_Clickÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿbtnGenRep_Click(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿbtnGenRep.Click Me.m_arrayField.Clear() Forÿiÿ=ÿ0ÿToÿMe.clbFields.CheckedItems.Countÿ - 1 m_arrayField.Add(Me.clbFields.CheckedItems(i).ToString) Next launchReport() EndÿSub //C# privateÿvoidÿbtnGenRep_Click(objectÿsender,ÿSystem.EventArgsÿe) { this.m_arrayField.Clear(); for(intÿi=0;i

        AddingÿcodeÿtoÿtheÿclbFields_SelectedIndexChangedÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿWindowsÿForm,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿtheÿform,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ clbFields.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ SelectedIndexChanged.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿForm1_SelectedIndexChangedÿ event.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿdesignerÿwindowÿofÿtheÿWindowsÿFormÿtoÿselectÿit.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿSelectedIndexChanged.ÿThisÿcreatesÿanÿ event-handlingÿmethodÿforÿtheÿForm1_SelectedIndexChangedÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿclbFields_SelectedIndexChanged(ByValÿsenderÿAsÿObject,ÿByValÿeÿ_ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ327

        AsÿSystem.EventArgs)ÿHandlesÿCheckedListBox1.SelectedIndexChanged IfÿMe.clbFields.CheckedItems.Countÿ<ÿ0ÿThen Me.btnGenRep.Enabledÿ=ÿFalse Else Me.btnGenRep.Enabledÿ=ÿTrue EndÿIf EndÿSub //C# privateÿvoidÿclbFields_SelectedIndexChanged(objectÿsender,ÿSystem.EventArgsÿe) { if(this.clbFields.CheckedItems.Count>0) { this.btnGenRep.Enabledÿ=ÿtrue; } else { this.btnGenRep.Enabledÿ=ÿfalse; } }

        AddingÿcodeÿtoÿtheÿForm1_Loadÿevent

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿVisualÿBasic l Double-clickÿtheÿtitleÿbarÿofÿtheÿform.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿ Addÿcodeÿtoÿtheÿhandlerÿto:ÿ l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrun

        ToÿwriteÿtheÿcodeÿforÿtheÿviewerÿinÿC# l Double-clickÿtheÿtitleÿbarÿofÿtheÿform.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿ Addÿcodeÿtoÿtheÿhandlerÿto:ÿ l Formatÿtheÿviewerÿtoÿshowÿtheÿreportÿwhenÿitÿisÿrunÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic DimÿiÿAsÿInteger DimÿcÿAsÿInteger Dimÿm_arrayFieldÿAsÿNewÿArrayList() PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load Try Me.OleDbConnection1.ConnectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;_ ÿ DataÿSource=C:\ProgramÿFiles\DataÿDynamics\ActiveReports.NET\Data\ÿ_ NWIND.MDB;PersistÿSecurityÿInfo=False" Me.OleDbDataAdapter1.Fill(Me.DataSet11) fillCheckBox() CatchÿexÿAsÿException System.Windows.Forms.MessageBox.Show(Me,ÿ"ErrorÿinÿForm_Load:ÿ"ÿ+ÿexÿ_ .Message,ÿ"ProjectÿError",ÿMessageBoxButtons.OK,ÿMessageBoxIcon.Error) EndÿTry EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { try { stringÿm_dbPathÿ=ÿgetDatabasePath(); this.oleDbConnection1.ConnectionStringÿ=ÿ"Provider=Microsoft.Jet .OLEDB.4.0;ÿDataÿSource="ÿ+ÿm_dbPathÿ+ÿ"\\theÿNorthwindÿdatabase;Persistÿ SecurityÿInfo=False"; this.oleDbDataAdapter1.Fill(this.dataSet11); fillCheckBox(); } catch(Exceptionÿex) { MessageBox.Show(this,"ErrorÿinÿForm_Load:ÿ"ÿ+ÿex.Message,"Projectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ328

        Error",ÿMessageBoxButtons.OK,MessageBoxIcon.Error); } }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿModifyingÿtheÿReportÿDataÿSourceÿatÿRunÿTime

        ActiveReportsÿallowsÿyouÿtoÿchangeÿtheÿdataÿsourceÿofÿaÿreportÿatÿrunÿtimeÿbasedÿonÿtheÿlocationÿofÿtheÿ sampleÿdatabaseÿfileÿonÿtheÿuser'sÿcomputer. Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿreportÿtoÿsetÿaÿreport'sÿdataÿsourceÿatÿrunÿtime. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Addingÿcodeÿtoÿsetÿtheÿdatabaseÿpathÿ

        l AddingÿcodeÿtoÿtheÿReportStartÿeventÿtoÿchangeÿdataÿsourceÿatÿrunÿtimeÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.

        AddingÿanÿActiveReportÿtoÿyourÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptModifyDS.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproducts".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ329

        Toÿaddÿcontrolsÿtoÿtheÿreport l InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location OutputFormat

        ProductID ProductÿID 0,ÿ0.625 NA

        ProductName ProductÿName 1.125,ÿ0.0625 NA

        UnitsInStock UnitsÿInÿStock 2.25,ÿ0.0625 NA

        UnitsOnOrder UnitsÿOnÿOrder 3.375,ÿ0.0625 NA

        UnitPrice UnitÿPrice 4.5,ÿ0.0625 Currency

        Addingÿcodeÿtoÿsetÿtheÿdatabaseÿpath

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptModifyDS,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿUnderneathÿtheÿ"ImportsÿSystem"ÿatÿtheÿtopÿofÿtheÿcodeÿview,ÿaddÿ"Importsÿ Microsoft.Win32;".ÿBeneathÿ"ActiveReportsÿDesignerÿGeneratedÿCode",ÿtypeÿtheÿfollowing:ÿ"Privateÿ FunctionÿgetDatabasePath()ÿAsÿString"ÿandÿhitÿ"Enter."ÿThisÿcreatesÿaÿfunctionÿforÿgetDatabasePath.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptModifyDSÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿreport.ÿ Underneathÿtheÿ"usingÿSystem;"ÿatÿtheÿtopÿofÿtheÿcodeÿview,ÿaddÿ"usingÿMicrosoft.Win32;".ÿBeneathÿ "ActiveReportsÿDesignerÿGeneratedÿCode",ÿtypeÿtheÿfollowing:ÿ"privateÿstringÿgetDatabasePath()".ÿThisÿ createsÿaÿfunctionÿforÿgetDatabasePath.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿfunctionÿlooksÿlike. 'ÿVisualÿBasic PrivateÿFunctionÿgetDatabasePath()ÿAsÿString DimÿregKeyÿAsÿRegistryKey regKeyÿ=ÿRegistry.LocalMachine regKeyÿ=ÿregKey.CreateSubKey("SOFTWARE\\DataÿDynamics\\ActiveReportsÿforÿ.NETÿ_ 2.0\\SampleDB") getDatabasePathÿ=ÿCType(regKey.GetValue(""),ÿString) EndÿFunction //C# privateÿstringÿgetDatabasePath() { RegistryKeyÿregKeyÿ=ÿRegistry.LocalMachine; regKeyÿ=ÿregKey.CreateSubKey("SOFTWARE\\DataÿDynamics\\ActiveReportsÿforÿ.NETÿ 2.0\\SampleDB"); returnÿ(string)regKey.GetValue(""); }

        AddingÿcodeÿtoÿtheÿReportStartÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptModifyDS,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptModifyDS,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿ(BaseÿClassÿEvents) .ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ ReportStart.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptModifyDS'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ l Changeÿtheÿdataÿsourceÿatÿrunÿtimeÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptModifyDSÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿReportStart.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿrptModifyDS'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ330

        l Changeÿtheÿdataÿsourceÿatÿrunÿtimeÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic Dimÿm_cnnÿAsÿOleDbConnection Dimÿm_dbpathÿAsÿString Dimÿm_cnnStringÿAsÿString DimÿsqlStringÿAsÿString PrivateÿSubÿrptModifyDS_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart m_dbpathÿ=ÿgetDatabasePath() m_cnnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource="ÿ+ÿm_dbpathÿ+ÿ"\\theÿNorthWindÿdatabase" sqlStringÿ=ÿ"SELECTÿ*ÿfromÿproducts" m_cnnÿ=ÿNewÿOleDbConnection(m_cnnString) Ifÿm_cnn.Stateÿ=ÿConnectionState.ClosedÿThen m_cnn.Open() EndÿIf ÿ m_readerÿ=ÿm_Cmd.ExecuteReader() Me.DataSourceÿ=ÿm_reader EndÿSub //C# privateÿstaticÿOleDbConnectionÿm_cnn; privateÿstaticÿOleDbDataReaderÿÿm_reader; privateÿvoidÿrptModifyDS_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { stringÿm_dbPathÿ=ÿgetDatabasePath(); stringÿm_cnnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource="ÿ+ÿm_dbPathÿ +ÿ"\\theÿNorthWindÿdatabase"; stringÿsqlStringÿ=ÿ"SELECTÿ*ÿfromÿproducts"; m_cnnÿ=ÿnewÿOleDbConnection(m_cnnString); if(m_cnn.Stateÿ==ÿConnectionState.Closed) { m_cnn.Open(); } ÿ m_readerÿ=ÿm_Cmd.ExecuteReader(); this.DataSourceÿ=ÿm_reader; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿSavingÿandÿLoadingÿtoÿaÿMemoryÿStream

        ActiveReportsÿallowsÿyouÿtoÿsaveÿandÿloadÿaÿreportÿasÿaÿmemoryÿstream.ÿSavingÿaÿreportÿasÿaÿmemoryÿ streamÿmakesÿitÿpossibleÿtoÿsaveÿandÿloadÿreportsÿfromÿaÿdatabaseÿorÿpassÿreportsÿbackÿandÿforthÿbetweenÿ DLLs.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿviewerÿtoÿForm1ÿ

        l AddingÿcodeÿtoÿtheÿForm_Loadÿeventÿtoÿsaveÿtheÿreportÿtoÿaÿmemoryÿstreamÿandÿloadÿitÿtoÿtheÿviewerÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ331

        Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMemoryStream.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿORDERÿBYÿcountry".ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ332

        7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptMemoryStream.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghCustomersÿ ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿCountryÿ 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿrptMemoryStream:ÿ

        Control DataField Name Text Section Location

        TextBox Country txtCountry Country GroupHeader 0,ÿ0

        TextBox CustomerID txtCustomerID CustomerÿID Detail 0,ÿ0

        TextBox CompanyName txtCompanyName Companyÿ Detail 1.125,ÿ0 Name

        TextBox Address txtAddress Address Detail 3.01,ÿ0

        TextBox City txtCity City Detail 4.375,ÿ0

        TextBox Phone txtPhone Phone Detail 5.437,ÿ0

        AddingÿtheÿviewerÿtoÿForm1

        ToÿaddÿtheÿviewerÿtoÿForm1 1. ClickÿonÿtheÿActiveReportsÿviewerÿcontrolÿinÿtheÿappropriateÿtoolboxÿandÿdragÿitÿontoÿForm1.ÿ 2. Setÿtheÿviewerÿcontrol'sÿDock propertyÿtoÿFill.ÿ

        AddingÿÿcodeÿtoÿtheÿForm1_Loadÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ

        l Saveÿtheÿreportÿtoÿaÿmemoryÿstreamÿ

        l LoadÿtheÿmemoryÿstreamÿtoÿtheÿActiveReportsÿviewerÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ l Saveÿtheÿreportÿtoÿaÿmemoryÿstreamÿ l LoadÿtheÿmemoryÿstreamÿtoÿtheÿActiveReportsÿviewerÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿstrmÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptMemoryStream() rpt.Run() rpt.Document.Save(strm) DimÿtheBytes(strm.Length)ÿAsÿByte strm.Read(theBytes,ÿ0,ÿInt(strm.Length)) strm.Positionÿ=ÿ0 Viewer1.Document.Load(strm) EndÿSub //C# ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ333

        privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿstrmÿ=ÿnewÿSystem.IO.MemoryStream(); rptMemoryStreamÿrptÿ=ÿnewÿrptMemoryStream(); rpt.Run(); rpt.Document.Save(strm); byte[]ÿtheBytesÿ=ÿnewÿbyte[strm.Length]; strm.Read(theBytes,ÿ0,ÿ(int)strm.Length); strm.Positionÿ=0; ÿ viewer1.Document.Load(strm); }

        ScriptingÿWalkthroughs

        ActiveReportsÿallowsÿyouÿtoÿuseÿscriptingÿtoÿprovideÿeaseÿinÿreportingÿfunctionality.ÿScriptingÿpermitsÿreportsÿ savedÿtoÿanÿRPXÿfileÿtoÿcontainÿcode.ÿThisÿcharacteristicÿallowsÿtheÿoptionsÿofÿstand-aloneÿreportingÿandÿwebÿ reportingÿwithoutÿrequiringÿ.vbÿorÿ.csÿfiles.ÿByÿincludingÿscriptingÿwhenÿtheÿreportÿisÿsavedÿasÿanÿRPXÿfile,ÿitÿ canÿlaterÿbyÿloaded,ÿrunÿandÿdisplayedÿdirectlyÿtoÿtheÿviewerÿcontrolÿwithoutÿusingÿtheÿdesigner.ÿScriptingÿcanÿ alsoÿbeÿusedÿinÿconjunctionÿwithÿRPXÿfilesÿtoÿallowÿdistributedÿreportsÿtoÿbeÿupdatedÿwithoutÿrecompiling. ÿ ScriptingÿandÿSimpleÿReports Describesÿhowÿtoÿuseÿscriptingÿtoÿcreateÿaÿsimpleÿstand-aloneÿreport.ÿ

        ScriptingÿandÿSubreports ÿ Describesÿhowÿtoÿuseÿscriptingÿtoÿcreateÿaÿsubreport.ÿ

        Walkthrough:ÿScriptingÿandÿSimpleÿReports

        ActiveReportsÿallowsÿyouÿtoÿuseÿscriptingÿtoÿpermitÿreportsÿsavedÿtoÿanÿXMLÿfileÿtoÿcontainÿcode.ÿByÿincludingÿ scriptingÿwhenÿtheÿreportsÿareÿsavedÿintoÿXML,ÿtheÿreportsÿlaterÿcanÿbeÿloaded,ÿrunÿandÿdisplayedÿdirectlyÿinÿ theÿviewerÿcontrolÿwithoutÿtheÿuseÿofÿtheÿdesigner.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿincludeÿscriptingÿinÿaÿreport. Thisÿwalkthroughÿisÿsplitÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ

        l Addingÿscriptingÿtoÿsupplyÿdataÿforÿtheÿcontrolsÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ334

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptScript.ÿ 4. ClickÿOpen.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/Footerÿsectionÿtoÿyourÿreport.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCategories ¡ ChangeÿtheÿBackColor propertyÿtoÿLightBlue

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID ¡ SetÿtheÿGroupKeepTogether propertyÿtoÿAll

        ¡ SetÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ335

        Control DataField Name Text Location Size Miscellaneous

        TextBox CategoryNameÿ txtCategoryName Categoryÿ 0,ÿ0ÿ 6.5,ÿ BackColorÿ=ÿ Nameÿ 0.2 CadetBlue;ÿ FontÿStyleÿ=ÿ Bold;ÿFontÿSizeÿ =ÿ12

        TextBox Descriptionÿ txtDescription Descriptionÿ 0,ÿ0.2 6.5,ÿ BackColorÿ=ÿ 0.2 CadetBlue;ÿ FontÿStyleÿ=ÿ Bold

        Label lblProductName Productÿ 0,ÿ0.ÿ 1,ÿ FontÿStyleÿ=ÿ Nameÿ 0.2 Bold

        Label ÿ lblUnitsInStock Unitsÿinÿ 5.5,ÿ0.4ÿ 1,ÿ FontÿStyleÿ=ÿ Stockÿ 0.2 Bold;ÿ Alignmentÿ=ÿ Right

        4. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrueÿandÿaddÿtextÿboxesÿwithÿtheÿfollowingÿ properties.ÿÿ

        DataField Name Text Location Size Alignment

        ProductNameÿ txtProductName ProductÿNameÿ 0,ÿ0ÿ 5.5,ÿ0.19

        UnitsInStockÿ txtUnitsInStock UnitsÿinÿStockÿ 5.5,ÿ0ÿ 1,ÿ0.19 Right

        5. Selectÿbothÿofÿtheÿtextÿboxesÿinÿtheÿdetailÿsection,ÿright-clickÿandÿchooseÿFormatÿBorder.ÿ

        ¡ Selectÿdarkÿtealÿinÿtheÿcolorÿcomboÿboxÿ ¡ SelectÿtheÿdottedÿlineÿinÿtheÿLineÿStylesÿpaneÿ ¡ ClickÿtheÿbottomÿedgeÿinÿtheÿPreviewÿpaneÿ

        ¡ ClickÿtheÿOK buttonÿtoÿaddÿaÿdottedÿlineÿtoÿtheÿbottomÿedgeÿofÿtheÿtextÿboxes. 6. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿfooter:ÿ ¡ ChangeÿtheÿName propertyÿtoÿgfCategories

        ¡ ChangeÿtheÿBackColor propertyÿtoÿPaleGreen ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 7. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupFooterÿsection:ÿ

        Control DataField Name Text Miscellaneous Location

        Label TotalLabel lblTotalLabel Total: Sizeÿ=ÿ3,ÿ0.19;ÿFontÿStyleÿ 2.5,ÿ0 =ÿBold

        TextBox ProductName txtTotalItems Totalÿ SummaryTypeÿ=ÿ 5.5,ÿ0 Items Subtotal;ÿSummaryFuncÿ =ÿCount;ÿ SummaryRunningÿ=ÿ Group;ÿSummaryGroupÿ=ÿ ghCategories;ÿAlignmentÿ =ÿRight

        Label lblWhiteSpace (deleteÿ BackColorÿ=ÿWhite;ÿSizeÿ 0,ÿ0.25 defaultÿ =ÿ6.5,ÿ0.2 text)

        Addingÿscriptingÿtoÿsupplyÿdataÿforÿtheÿcontrols

        Toÿaddÿscriptingÿtoÿtheÿreport 1. ClickÿtheÿScriptÿtabÿlocatedÿbelowÿtheÿreportÿdesignerÿtoÿaccessÿtheÿscriptingÿeditor.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ336

        2. Addÿtheÿscriptingÿcode.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿscriptingÿcodeÿlooksÿlike. 'VB.NET PrivateÿSharedÿm_readerÿAsÿSystem.Data.OleDb.OleDbDataReader

        PrivateÿFunctionÿgetDatabasePath()ÿAsÿString DimÿregKeyÿAsÿMicrosoft.Win32.RegistryKeyÿ=ÿMicrosoft.Win32.Registry.LocalMachine regKeyÿ=ÿregKey.CreateSubKey("SOFTWARE\DataÿDynamics\ActiveReports.NET\SampleDB") ReturnÿCType(regKey.GetValue(""),ÿString) EndÿFunction

        PublicÿSubÿActiveReport_ReportStart() DimÿdatabasePathÿAsÿStringÿ=ÿgetDatabasePath DimÿconnectionStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.mdb;PersistÿSecurityÿInfo=False"

        DimÿsqlStringÿAsÿStringÿ=ÿ"SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿcategories.categoryidÿ=ÿproducts.categoryidÿORDERÿBYÿproducts.categoryid,ÿproducts.productid" ÿ Dimÿm_cnnÿAsÿSystem.Data.OleDb.OleDbConnectionÿ=ÿnewÿSystem.Data.OleDb.OleDbConnection(connectionString) Dimÿm_CmdÿAsÿSystem.Data.OleDb.OleDbCommandÿ=ÿnewÿSystem.Data.OleDb.OleDbCommand(sqlString,ÿm_cnn) ÿ Ifÿm_cnn.Stateÿ=ÿSystem.Data.ConnectionState.ClosedÿThen m_cnn.Open EndÿIf m_readerÿ=ÿm_Cmd.ExecuteReader EndÿSub

        PublicÿSubÿActiveReport_DataInitialize() rpt.Fields.Add("CategoryID") rpt.Fields.Add("CategoryName") rpt.Fields.Add("ProductName") rpt.Fields.Add("UnitsInStock") rpt.Fields.Add("Description") rpt.Fields.Add("TotalLabel") EndÿSub

        PublicÿFunctionÿActiveReport_FetchData(ByValÿeofÿAsÿBoolean)ÿAsÿBoolean Try m_reader.Read rpt.Fields("CategoryID").Valueÿ=ÿm_reader("categories.CategoryID") rpt.Fields("CategoryName").Valueÿ=ÿm_reader("CategoryName") rpt.Fields("ProductName").Valueÿ=ÿm_reader("ProductName") rpt.Fields("UnitsInStock").Valueÿ=ÿm_reader("UnitsInStock") rpt.Fields("Description").Valueÿ=ÿm_reader("Description") rpt.Fields("TotalLabel").Valueÿ=ÿ"TotalÿNumberÿofÿ"ÿ+ÿm_reader("CategoryName")+ÿ"ÿUnits:" eofÿ=ÿFalse Catch eofÿ=ÿTrue EndÿTry Returnÿeof EndÿFunction

        //C# privateÿstaticÿSystem.Data.OleDb.OleDbDataReaderÿÿm_reader; ÿ privateÿstringÿgetDatabasePath() { Microsoft.Win32.RegistryKeyÿregKeyÿ=ÿMicrosoft.Win32.Registry.LocalMachine; regKeyÿ=ÿregKey.CreateSubKey(@"SOFTWARE\\DataÿDynamics\\ActiveReports.NET\\SampleDB"); returnÿ(string)regKey.GetValue(""); } publicÿvoidÿActiveReport_ReportStart() ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ337

        { stringÿm_dbPathÿ=ÿgetDatabasePath(); stringÿm_cnnStringÿ=ÿ@"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\Programÿ ÿ Files\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.mdb;Persistÿ SecurityÿInfo=False"; stringÿsqlStringÿ=ÿ"SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿ categories.categoryidÿ=ÿproducts.categoryidÿORDERÿBYÿproducts.categoryid,ÿ products.productid"; System.Data.OleDb.OleDbConnectionÿm_cnnÿ=ÿnewÿSystem.Data.OleDb.OleDbConnection (m_cnnString); System.Data.OleDb.OleDbCommandÿm_Cmdÿ=ÿnewÿSystem.Data.OleDb.OleDbCommand (sqlString,m_cnn); if(m_cnn.Stateÿ==ÿSystem.Data.ConnectionState.Closed) { m_cnn.Open(); } m_readerÿ=ÿm_Cmd.ExecuteReader(); } ÿ publicÿvoidÿActiveReport_DataInitialize() { rpt.Fields.Add("CategoryID"); rpt.Fields.Add("CategoryName"); rpt.Fields.Add("ProductName"); rpt.Fields.Add("UnitsInStock"); rpt.Fields.Add("Description"); ÿrpt.Fields.Add("TotalLabel"); } ÿ publicÿboolÿActiveReport_FetchData(boolÿeof) { try { m_reader.Read(); rpt.Fields["CategoryID"].Valueÿ=ÿm_reader["categories.CategoryID"] .ToString(); rpt.Fields["CategoryName"].Valueÿ=ÿm_reader["CategoryName"] .ToString(); rpt.Fields["ProductName"].Valueÿ=ÿm_reader["ProductName"].ToString(); rpt.Fields["UnitsInStock"].Valueÿ=ÿm_reader["UnitsInStock"] .ToString(); rpt.Fields["Description"].Valueÿ=ÿm_reader["Description"].ToString(); rpt.Fields["TotalLabel"].Valueÿ=ÿ"TotalÿNumberÿofÿ"ÿ+ÿm_reader ["CategoryName"].ToString()ÿ+ÿ"ÿUnits:"; eofÿ=ÿfalse; } catch { eofÿ=ÿtrue; } ÿ returnÿeof; } 3. ToÿsaveÿtheÿreportÿtoÿRPXÿ(ReportÿXML)ÿformat,ÿopenÿtheÿReport menu,ÿselectÿSaveÿLayout,ÿandÿchooseÿ eitherÿArnetÿ3ÿFormat orÿArnetÿFormat.ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ338

        Walkthrough:ÿScriptingÿandÿSubreports

        ActiveReportsÿallowsÿyouÿtoÿuseÿscriptingÿtoÿpermitÿreportsÿsavedÿtoÿanÿXMLÿfileÿtoÿcontainÿcode.ÿByÿincludingÿ scriptingÿwhenÿreportsÿareÿsavedÿintoÿXML,ÿtheÿreportsÿlaterÿcanÿbeÿloaded,ÿrunÿandÿdisplayedÿdirectlyÿtoÿtheÿ viewerÿcontrolÿwithoutÿneedingÿtoÿuseÿtheÿdesigner.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿuseÿscriptingÿwhenÿcreatingÿaÿsubreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ

        l Connectingÿtheÿsubreportÿtoÿaÿdataÿsourceÿ l Temporarilyÿconnectionÿtheÿmainÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ

        l SavingÿtheÿrptSubÿlayoutÿtoÿRPXÿformatÿ l AddingÿtheÿscriptingÿcodeÿforÿrptMainÿ

        l SavingÿtheÿrptMainÿlayoutÿtoÿRPXÿformatÿ

        l Viewingÿtheÿreportÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ339

        2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMain.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptSub.ÿ 7. ClickÿOpen.ÿ 8. Right-clickÿtheÿpageÿheaderÿofÿrptSubÿandÿselectÿDelete.ÿ(Pageÿheadersÿandÿfootersÿareÿnotÿdisplayedÿinÿ subreports,ÿsoÿitÿisÿaÿgoodÿpracticeÿtoÿdeleteÿthemÿandÿsaveÿonÿprocessing.)ÿ 9. SelectÿrptSubÿinÿtheÿPropertiesÿwindowÿandÿsetÿtheÿShowParameterUI propertyÿtoÿFalse.ÿ(Thisÿstepÿ preventsÿActiveReportsÿfromÿrequestingÿaÿparameterÿvalueÿfromÿtheÿuserÿatÿrunÿtime.)

        Connectingÿtheÿsubreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿsubreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿ products.productid".ÿ Note: WeÿwillÿaddÿparametersÿtoÿtheÿqueryÿinÿtheÿscriptÿofÿrptMain. 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Temporarilyÿconnectingÿtheÿmainÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿmainÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿordersÿinnerÿjoinÿcustomersÿonÿorders.customeridÿ=ÿ customers.customeridÿorderÿbyÿCompanyName,OrderDate".ÿ Note: ThisÿstepÿisÿjustÿforÿconvenienceÿsoÿthatÿweÿcanÿpopulateÿtheÿfieldsÿlistÿinÿtheÿReportÿExplorerÿ atÿdesignÿtime. 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdata

        ToÿaddÿcontrolsÿtoÿrptMain 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptMain.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghCompaniesÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLemonChiffon ¡ ChangeÿtheÿCanShrinkÿpropertyÿtoÿTrue ¡ ChangeÿtheÿDataField propertyÿtoÿCompanyName

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ340

        3. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldÿ ontoÿghCompaniesÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿ

        Field Name Miscellaneous Size Location

        CompanyNameÿ txtCompanyName1 FontÿStyleÿ=ÿBold;ÿFontÿSizeÿ=ÿ 4,ÿ 0,ÿ0ÿ 12ÿ 0.2ÿ

        4. AddÿaÿsecondÿGroupHeader/FooterÿsectionÿtoÿrptMain.ÿ 5. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghOrders

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightYellow ¡ ChangeÿtheÿCanShrinkÿpropertyÿtoÿTrue

        ¡ ChangeÿtheÿDataField propertyÿtoÿOrderDate

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll 6. DragÿtheÿfollowingÿfieldsÿandÿcontrolsÿontoÿghOrdersÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿÿ

        Control DataField Name Text Miscellaneous Location

        TextBox OrderDateÿ txtOrderDate1 Orderÿ OutputFormatÿ=ÿ 1.13,ÿ0ÿ Dateÿ MM/dd/yy

        TextBox RequiredDateÿ txtRequiredDate1 Requiredÿ OutputFormatÿ=ÿ 3.5,ÿ0ÿ Dateÿ MM/dd/yy

        TextBox ShippedDateÿ txtShippedDate1 Shippedÿ OutputFormatÿ=ÿ 5.5,ÿ0ÿ Dateÿ MM/dd/yy

        Label lblOrderDate Ordered:ÿ FontÿStyleÿ=ÿBold 0,ÿ0ÿ

        Label lblRequiredDate Required:ÿ FontÿStyleÿ=ÿBold 2.5,ÿ0ÿ

        Label lblShippedDate Shipped:ÿ FontÿStyleÿ=ÿBold 4.875,ÿ0ÿ

        7. ChangeÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.ÿ 8. Dragÿtheÿfollowingÿcontrolÿontoÿtheÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿ

        Control ReportName Name Text Size Location

        Subreport C:\fullÿprojectÿpath\rptSub.rpx SubReport1 6.5,ÿ0.2ÿ 0,ÿ0ÿ

        Note:ÿTheÿpathÿofÿtheÿRPXÿwillÿbeÿsetÿlater.

        ToÿaddÿcontrolsÿtoÿrptSub 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptSub.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿNameÿpropertyÿtoÿghOrderDetails

        ¡ ChangeÿtheÿBackColor propertyÿtoÿLightSteelBlue ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue ¡ ChangeÿtheÿDataField propertyÿtoÿOrderID 3. AddÿfourÿlabelÿcontrolsÿtoÿghOrderDetailsÿandÿsetÿtheÿpropertiesÿasÿfollows:ÿ

        FontÿStyle Name Text Alignment Location

        Bold lblProductName ProductÿNameÿ 0,ÿ0ÿ

        Bold lblQuantity Quantity Right 3.25,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ Right 4.38,ÿ0ÿ

        Bold lblDiscount Discountÿ Right 5.5,ÿ0ÿ

        4. AddÿfourÿlineÿcontrolsÿtoÿghOrderDetailsÿandÿsetÿtheÿpropertiesÿasÿfollows:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ341

        Name X1 X2 Y1 Y2

        Line1 3.1875ÿ 3.1875 0 0.1875

        Line2 4.3125ÿ 4.3125 0 0.1875

        Line3 5.4375ÿ 5.4375 0 0.1875

        Line4 0 6.5 0.1875 0.1875

        5. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿGainsboro ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 6. Dragÿtheÿfollowingÿfieldsÿontoÿtheÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿ

        Field Name Alignment Miscellaneous Location

        ProductName txtProductName1 Right Sizeÿ=ÿ3.15,ÿ0.19 0,ÿ0

        Quantity txtQuantity1 Right 3.25,ÿ0

        products.UnitPrice txtproducts_UnitPrice1 Right OutputFormatÿ=ÿ 4.4,ÿ0 Currency

        Discount txtDiscount1 Right OutputFormatÿ=ÿ 5.5,ÿ0 Currency;ÿSizeÿ=ÿ 0.95,ÿ0.19

        7. Addÿfourÿlineÿcontrolsÿtoÿtheÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿasÿfollowsÿ(orÿcopyÿandÿpasteÿthemÿfromÿ ghOrderDetails):ÿ

        Name X1 X2 Y1 Y2

        Line5 3.1875ÿ 3.1875 0 0.1875

        Line6 4.3125ÿ 4.3125 0 0.1875

        Line7 5.4375ÿ 5.4375 0 0.1875

        Line8 0 6.5 0.1875 0.1875 ÿ

        SavingÿtheÿrptSubÿlayoutÿtoÿRPXÿformat

        ToÿsaveÿtheÿlayoutÿtoÿRPXÿformat 1. WhileÿinÿtheÿdesignÿviewÿofÿrptSub,ÿopenÿtheÿReport menuÿandÿselectÿSaveÿLayout.ÿ 2. NavigateÿtoÿyourÿprojectÿfolderÿandÿsaveÿtheÿreportÿasÿrptSub.rpx.ÿ 3. LeaveÿtheÿSaveÿasÿtype comboÿboxÿsetÿtoÿArnetÿ3ÿFormatÿ(*rpx).ÿ 4. ClickÿtheÿSaveÿbutton.ÿ 5. UseÿWindowsÿExplorerÿtoÿnavigateÿtoÿrptSub.rpxÿandÿensureÿthatÿtheÿsubreportÿcontrolÿinÿrptMainÿhasÿtheÿ ReportNameÿpropertyÿsetÿtoÿtheÿfullÿpath.

        AddingÿtheÿscriptingÿcodeÿforÿrptMain

        Toÿaddÿscriptingÿtoÿtheÿreport 1. Belowÿtheÿreportÿdesigner,ÿyouÿwillÿfindÿthreeÿtabs.ÿClickÿonÿtheÿScript tabÿtoÿexposeÿtheÿScriptÿeditor.ÿ

        2. Addÿtheÿfollowingÿscriptingÿcode.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ342

        Theÿfollowingÿexampleÿshowsÿwhatÿtheÿscriptingÿcodeÿlooksÿlike. 'VB.NET PublicÿSubÿActiveReport_ReportStart() DimÿconnectionStringÿAsÿStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿForÿ.NETÿ3.0\Data\NWIND.mdb;PersistÿSecurityÿInfo=False" DimÿsqlStringÿAsÿStringÿ=ÿ"Selectÿ*ÿfromÿordersÿinnerÿjoinÿcustomersÿonÿorders.customeridÿ=ÿcustomers.customeridÿorderÿbyÿCompanyName,OrderDate" DimÿdsÿAsÿNewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource() ds.ConnectionStringÿ=ÿconnectionString ds.SQLÿ=ÿsqlString rpt.DataSourceÿ=ÿds EndÿSub

        PublicÿSubÿDetail1_Format() DimÿrptSubCtlÿAsÿDataDynamics.ActiveReports.SubReportÿ=ÿCType(rpt.Sections("Detail1").Controls("SubReport1"),ÿDataDynamics.ActiveReports.SubReport) DimÿrptSubÿAsÿnewÿDataDynamics.ActiveReports.ActiveReport3() rptSub.LoadLayout(CType(rpt.Sections("Detail1").Controls("SubReport1"),ÿDataDynamics.ActiveReports.SubReport).ReportName) DimÿchildDataSourceÿAsÿNewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource() childDataSource.ConnectionStringÿ=ÿrpt.DataSource.ConnectionString childDataSource.SQLÿ=ÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿproducts.productidÿwhereÿ[orderÿdetails].orderidÿ=ÿ"ÿ+ÿorderIDString rptSub.DataSourceÿ=ÿchildDataSource rptSubCtl.Reportÿ=ÿrptSub EndÿSub

        DimÿorderIDStringÿAsÿString SubÿActiveReport_FetchData(byrefÿEOFÿAsÿBoolean) orderIDStringÿ=ÿrpt.Fields("OrderID").Value EndÿSub ÿ //C# publicÿvoidÿActiveReport_ReportStart() { stringÿconnectionStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿForÿ.NETÿ3.0\Data\NWIND.mdb;PersistÿSecurityÿInfo=False"; stringÿsqlStringÿ=ÿ"Selectÿ*ÿfromÿordersÿinnerÿjoinÿcustomersÿonÿ orders.customeridÿ=ÿcustomers.customeridÿorderÿbyÿCompanyName,OrderDate"; DataDynamics.ActiveReports.DataSources.OleDBDataSourceÿdsÿ=ÿnewÿDataDynamics .ActiveReports.DataSources.OleDBDataSource(); ds.ConnectionStringÿ=ÿconnectionString; ds.SQLÿ=ÿsqlString; rpt.DataSourceÿ=ÿds; } publicÿvoidÿdetail_Format()ÿ {ÿ DataDynamics.ActiveReports.SubReportÿrptSubCtlÿ=ÿ((DataDynamics.ActiveReports.SubReport)(rpt.Sections("detail").Controls("SubReport1"))); DataDynamics.ActiveReports.ActiveReport3ÿrptSubÿ=ÿnewÿDataDynamics.ActiveReports.ActiveReport3();ÿ rptSub.LoadLayout(((DataDynamics.ActiveReports.SubReport)(rpt.Sections("detail").Controls("SubReport1"))).ReportName);ÿ DataDynamics.ActiveReports.DataSources.OleDBDataSourceÿchildDataSourceÿ=ÿnewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource(); childDataSource.ConnectionStringÿ=ÿrpt.DataSource.ConnectionString;ÿ childDataSource.SQLÿ=ÿ"Selectÿ*ÿfromÿ[orderÿdetails]ÿinnerÿjoinÿproductsÿonÿ[orderÿdetails].productidÿ=ÿproducts.productidÿwhereÿ[orderÿdetails].orderidÿ=ÿ"ÿ+ÿorderIDString;ÿ rptSub.DataSourceÿ=ÿchildDataSource;ÿ rptSubCtl.Reportÿ=ÿrptSub;ÿ }ÿ

        stringÿorderIDString;ÿ voidÿActiveReport_FetchData(refÿboolÿEOF)ÿ {ÿ orderIDStringÿ=ÿrpt.Fields("OrderID").Value;ÿ } 3. ClickÿOK toÿcontinue.ÿ

        SavingÿtheÿrptMainÿlayoutÿtoÿRPXÿformat

        ToÿsaveÿtheÿrptMainÿlayoutÿtoÿRPXÿformat 1. Withÿtheÿdesignÿviewÿofÿtheÿreportÿvisible,ÿopenÿtheÿReportÿmenuÿandÿselectÿSaveÿLayout.ÿ 2. ChooseÿeitherÿArnetÿ3ÿFormat orÿArnetÿFormatÿ(forÿbackwardÿcompatibility).

        Viewingÿtheÿreport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ343

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿUsingÿSpreadBuilder

        IncludedÿwithÿtheÿActiveReportsÿExcelÿexportÿfilterÿisÿtheÿSpreadBuilderÿAPI.ÿWithÿthisÿutility,ÿyouÿcanÿcreateÿ Excelÿspreadsheetsÿcellÿbyÿcellÿforÿmaximumÿcontrol.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿcustomÿspreadsheetÿcellÿbyÿcell,ÿandÿsaveÿitÿtoÿanÿExcelÿfile. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿtheÿExcelÿexportÿfilterÿtoÿyourÿprojectÿ l CreatingÿaÿWorkbook,ÿandÿaddingÿaÿsheetÿtoÿtheÿWorkbook'sÿSheetsÿcollectionÿ l Settingÿpropertiesÿonÿcolumnsÿandÿrowsÿinÿtheÿsheetÿ

        l Settingÿvaluesÿofÿcellsÿinÿtheÿsheetÿÿ l UsingÿtheÿSaveÿmethodÿtoÿcreateÿanÿExcelÿfileÿ Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿcreatedÿaÿcustomÿExcelÿfileÿwhichÿcanÿbeÿfoundÿinÿ theÿBin/Debugÿ(C#)ÿorÿBinÿ(VB.NET)ÿsubfolderÿofÿyourÿproject'sÿfolder. ÿ

        Addingÿtheÿexportÿfilterÿtoÿyourÿproject

        Toÿaddÿtheÿexportÿfilterÿtoÿyourÿproject 1. ClickÿonÿtheÿXlsExportÿexportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWindowsÿForm.ÿ 3. TheÿcontrolÿwillÿappearÿinÿtheÿtrayÿunderneathÿtheÿWindowsÿForm.ÿ

        CreatingÿaÿWorkbook

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ344

        handlerÿto:ÿ l CreateÿaÿWorkbook,ÿandÿaddÿaÿsheetÿtoÿtheÿWorkbook'sÿSheetsÿcollectionÿ

        l Setÿpropertiesÿonÿcolumnsÿandÿrowsÿinÿtheÿsheetÿ l Setÿvaluesÿofÿcellsÿinÿtheÿsheetÿ

        l UseÿtheÿSaveÿmethodÿtoÿcreateÿanÿExcelÿfile

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ

        l CreateÿaÿWorkbook,ÿandÿaddÿaÿsheetÿtoÿtheÿWorkbook'sÿSheetsÿcollectionÿ

        l Setÿpropertiesÿonÿcolumnsÿandÿrowsÿinÿtheÿsheetÿ l Setÿvaluesÿofÿcellsÿinÿtheÿsheetÿ

        l UseÿtheÿSaveÿmethodÿtoÿcreateÿanÿExcelÿfileÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ÿ HandlesÿMyBase.Load 'DimensionÿaÿWorkbookÿandÿaddÿaÿsheetÿtoÿitsÿSheetsÿcollection DimÿsbÿAsÿNewÿDataDynamics.SpreadBuilder.Workbook() sb.Sheets.AddNew() 'Setÿupÿpropertiesÿandÿvaluesÿforÿcolumns,ÿrowsÿandÿcellsÿasÿdesired Withÿsb.Sheets(0) .Nameÿ=ÿ"CustomerÿCallÿList" .Columns(0).Widthÿ=ÿ2ÿ*ÿ1440 .Columns(1).Widthÿ=ÿ1440 .Columns(2).Widthÿ=ÿ1440 .Rows(0).Heightÿ=ÿ1440ÿ/ÿ4 'Headerÿrow .Cell(0,ÿ0).SetValue("CompanyÿName") .Cell(0,ÿ0).FontBoldÿ=ÿTrue .Cell(0,ÿ1).SetValue("ContactÿName") .Cell(0,ÿ1).FontBoldÿ=ÿTrue .Cell(0,ÿ2).SetValue("Phone") .Cell(0,ÿ2).FontBoldÿ=ÿTrue 'Firstÿrowÿofÿdata .Cell(1,ÿ0).SetValue("DataÿDynamics") .Cell(1,ÿ1).SetValue("Mortimer") .Cell(1,ÿ2).SetValue("(614)ÿ895-3142") EndÿWith 'SaveÿtheÿWorkbookÿtoÿanÿExcelÿfile sb.Save(Application.StartupPathÿ&ÿ"\x.xls") MsgBox("YourÿSpreadsheetÿhasÿbeenÿsavedÿtoÿ"ÿ&ÿApplication.StartupPathÿ&ÿ_ÿ "\x.xls") EndÿSub //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { //DimensionÿaÿWorkbookÿandÿaddÿaÿsheetÿtoÿitsÿSheetsÿcollection DataDynamics.SpreadBuilder.Workbookÿsbÿ=ÿnewÿDataDynamics.SpreadBuilder .Workbook(); sb.Sheets.AddNew(); //Setÿupÿpropertiesÿandÿvaluesÿforÿcolumns,ÿrowsÿandÿcellsÿasÿdesired sb.Sheets[0].Nameÿ=ÿ"CustomerÿCallÿList"; sb.Sheets[0].Columns(0).Widthÿ=ÿ2ÿ*ÿ1440; sb.Sheets[0].Columns(1).Widthÿ=ÿ1440; sb.Sheets[0].Columns(2).Widthÿ=ÿ1440; sb.Sheets[0].Rows(0).Heightÿ=ÿ1440/4; //Headerÿrow sb.Sheets[0].Cell(0,0).SetValue("CompanyÿName"); sb.Sheets[0].Cell(0,0).FontBoldÿ=ÿtrue; sb.Sheets[0].Cell(0,1).SetValue("ContactÿName"); sb.Sheets[0].Cell(0,1).FontBoldÿ=ÿtrue; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ345

        sb.Sheets[0].Cell(0,2).SetValue("Phone"); sb.Sheets[0].Cell(0,2).FontBoldÿ=ÿtrue; //Firstÿrowÿofÿdata sb.Sheets[0].Cell(1,0).SetValue("DataÿDynamics"); sb.Sheets[0].Cell(1,1).SetValue("Mortimer"); sb.Sheets[0].Cell(1,2).SetValue("(614)ÿ895-3142"); //SaveÿtheÿWorkbookÿtoÿanÿExcelÿfile sb.Saveÿ(Application.StartupPathÿ+ÿ@"\x.xls"); MessageBox.Show("YourÿSpreadsheetÿhasÿbeenÿsavedÿtoÿ"ÿ+ÿApplication.StartupPathÿ ÿ +ÿ@"\x.xls"); }

        Walkthrough:ÿStyleÿSheets

        ActiveReportsÿaddsÿstyleÿclassÿnamesÿtoÿallowÿcontrolsÿtoÿbeÿformattedÿeasily.ÿWithÿtheÿuseÿofÿstyleÿsheets,ÿ groupsÿofÿcontrolsÿcanÿbeÿsetÿtoÿaÿsingleÿstyleÿwithÿjustÿaÿfewÿclicks.ÿClassName andÿtheÿdifferentÿcontrols'ÿ Styleÿpropertyÿcanÿalsoÿbeÿusedÿtoÿcreateÿspecializedÿstylesÿinÿcodeÿandÿthroughÿscripting.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿandÿuseÿstyleÿsheetsÿinÿaÿÿreport. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿÿ l OpeningÿanÿexistingÿActiveReportÿ

        l Creatingÿstyleÿsheetsÿ

        l Usingÿcreatedÿstyleÿsheetsÿinÿyourÿreportÿatÿdesignÿtimeÿ l Usingÿcreatedÿstyleÿsheetsÿinÿyourÿreportÿatÿrunÿtimeÿ

        l Viewingÿtheÿreportÿÿ

        OpeningÿanÿexistingÿActiveReport

        ToÿopenÿanÿexistingÿActiveReportÿÿÿ 1. ClickÿOpen >ÿProject.ÿ 2. SelectÿyourÿActiveReportÿprojectÿfromÿtheÿappropriateÿlocationÿandÿclickÿonÿitÿtoÿselectÿit.ÿ 3. ClickÿOpen.ÿ

        CreatingÿStyleÿSheets

        Toÿcreateÿaÿstyleÿsheet 1. Clickÿanywhereÿonÿtheÿreportÿdesignÿsurfaceÿtoÿselectÿit.ÿ 2. ClickÿonÿReport >ÿSettings.ÿ 3. ClickÿonÿStyles toÿdisplayÿtheÿstyleÿsheet.ÿ 4. SelectÿNew toÿaddÿaÿnewÿstyle,ÿorÿselectÿaÿpredefinedÿstyleÿtoÿmodify.ÿ 5. Nameÿtheÿnewÿstyleÿ"MyNewStyle"ÿandÿselectÿaÿbaseÿstyle.ÿ 6. ModifyÿtheÿpropertiesÿtoÿsetÿupÿtheÿdesiredÿeffectÿandÿclickÿOK .ÿ

        UsingÿCreatedÿStyleÿSheetsÿinÿaÿReportÿatÿDesignÿTime

        Toÿuseÿaÿcreatedÿstyleÿsheetÿatÿdesignÿtime 1. Clickÿonÿtheÿcontrolÿtoÿwhichÿyouÿwishÿtoÿapplyÿtheÿstyle.ÿ 2. Selectÿ"MyNewStyle"ÿfromÿtheÿstyleÿsheetsÿdrop-downÿbox.ÿ 3. Theÿnewÿstyleÿisÿappliedÿtoÿyourÿselectedÿcontrol.ÿ

        UsingÿCreatedÿStyleÿSheetsÿinÿaÿReportÿatÿRunÿTime

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿyourÿreport,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ346

        codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿtheÿreport,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿDetail.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿFormat.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿtheÿreport'sÿDetail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Updateÿtheÿselectedÿcontrolÿwithÿtheÿstyleÿsheetÿchosenÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿDetailÿsection ofÿyourÿreportÿtoÿselectÿit.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿ displayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿFormat.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ theÿreport'sÿDetail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Updateÿtheÿselectedÿcontrolÿwithÿtheÿstyleÿsheetÿchosen Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿDetail.Format Me.TextBox1.ClassNameÿ=ÿ"MyNewStyle" EndÿSub //C# privateÿvoidÿDetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.TextBox1.ClassNameÿ=ÿ"MyNewStyle"; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        SubreportsÿWalkthroughs

        WithÿActiveReports,ÿreportsÿmayÿcontainÿanyÿnumberÿofÿchildÿreportsÿbyÿusingÿtheÿSubreportÿcontrol.ÿChildÿ reports,ÿorÿsubreports,ÿareÿexecutedÿeachÿtimeÿtheÿparentÿsectionÿ(i.e.ÿtheÿsectionÿinÿwhichÿtheÿSubreportÿ controlÿisÿplaced)ÿisÿprinted. ÿ HierarchicalÿSubreports Describesÿhowÿtoÿsetÿupÿaÿhierarchicalÿsubreport.ÿ NestedÿSubreports Describesÿhowÿtoÿcreateÿanÿembeddedÿsubreport.ÿ SimpleÿSubreports Describesÿhowÿsimpleÿsubreportsÿcanÿbeÿsetÿupÿusingÿtheÿsubreportÿcontrol.ÿ SubreportsÿwithÿXMLÿData ÿ DescribesÿhowÿtoÿuseÿsubreportsÿwithÿtheÿXMLDataSource.ÿ

        Walkthrough:ÿHierarchicalÿSubreports

        ByÿusingÿtheÿSubreportÿcontrol,ÿActiveReportsÿreportsÿcanÿcontainÿanyÿnumberÿofÿchildÿreports.ÿChildÿreports,ÿ orÿsubreports,ÿareÿexecutedÿeachÿtimeÿtheÿparentÿsectionÿ(i.e.ÿtheÿsectionÿinÿwhichÿtheÿSubreportÿcontrolÿisÿ placed)ÿisÿprinted.ÿ Note: SubreportsÿwillÿnotÿrenderÿPageHeader/Footerÿsections,ÿsoÿyouÿcanÿdeleteÿthemÿtoÿ saveÿprocessingÿtime.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ347

        ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿboundÿsubreportÿbyÿsettingÿtheÿReportÿpropertyÿofÿtheÿSubreportÿ controlÿtoÿtheÿchildÿreport.ÿThisÿwalkthroughÿalsoÿdemonstratesÿhowÿtoÿmodifyÿtheÿsubreportÿrecordÿsourceÿ fromÿtheÿdataÿinÿtheÿparentÿreportÿtoÿretrieveÿtheÿcorrectÿinformation. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreport,ÿrptCustomers,ÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ l AddingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreportÿcontrolÿequalÿtoÿrptOrdersÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomers.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptOrders.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ348

        7. ClickÿOpen.ÿ

        ConnectingÿrptCustomersÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿhaveÿ selectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"SHAPEÿ{SELECTÿCustomerID,ÿCompanyName,ÿAddressÿFROMÿCustomers}ÿ APPENDÿ({SELECTÿCustomerID,ÿOrderID,ÿFreight,ÿOrderDate,ÿEmployeeIDÿFROMÿOrders}ÿASÿ CustomerOrdersÿRELATEÿCustomerIDÿTOÿCustomerID)".ÿ 7. Addÿ"Provider=MSDataShape;"ÿtoÿtheÿbeginningÿofÿyourÿConnectionÿStringÿandÿchangeÿ "Provider=Microsoft.Jet.OLEDB.4.0;"ÿtoÿ"DataÿProvider=Microsoft.Jet.OLEDB.4.0;".ÿYourÿcompleteÿ ConnectionÿStringÿshouldÿlookÿsimilarÿto:ÿ"Provider=MSDataShape;Dataÿ Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\NWIND.mdb;PersistÿSecurityÿInfo=False".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿdetailÿsectionÿofÿrptCustomers,ÿnamingÿthemÿasÿindicated:ÿ

        Control DataField Name Text Location

        TextBox CustomerIDÿ txtCustomerID CustomerÿIDÿ 0,ÿ0ÿ

        TextBox CompanyNameÿ txtCompanyName CompanyÿNameÿ 1.0625,ÿ0ÿ

        TextBox Addressÿ txtAddress Addressÿ 3.9375,ÿ0ÿ

        Subreport CustomerOrdersÿ Subreport1 NAÿ 0,ÿ0.5ÿ

        2. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptOrdersÿ 3. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghOrdersÿ ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿCustomerIDÿ 4. AddÿtheÿfollowingÿcontrolsÿtoÿrptOrders,ÿnamingÿthemÿasÿindicated:ÿ

        Control DataField Name Text Section Location

        Label NA lblOrderDate OrderÿDate GroupHeader 0,ÿ0

        Label NA lblOrderID OrderÿID GroupHeader 1.1875,ÿ 0

        Label NA lblFreight Freight GroupHeader 2.375,ÿ0

        TextBox OrderDate txtOrderDate OrderÿDate Detail 0,ÿ0

        TextBox OrderID txtOrderID OrderÿID Detail 1.1875,ÿ 0

        TextBox Freight txtFreight Freight Detail 2.375,ÿ0

        TextBox EmployeeID txtEmployeeID EmployeeÿID Detail 5.9375,ÿ 0

        Label NA lblProcessed Processedÿbyÿ Detail 3.5625,ÿ EmployeeÿIDÿ#: 0 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ349

        Line NA Line1 NA Detail X1:ÿ0ÿ Y1:ÿ0.25 X2:ÿ6.5 Y2:ÿ0.25

        AddingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreportÿcontrolÿequalÿtoÿrptOrders

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿtheÿgrayÿareaÿbelowÿrptCustomers.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptCustomers'ÿ ReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l SetÿtheÿsubreportÿcontrolÿequalÿtoÿrptOrdersÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿtheÿgrayÿareaÿbelowÿrptCustomers.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptCustomers'ÿ ReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l SetÿtheÿsubreportÿcontrolÿequalÿtoÿrptOrdersÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptCustomers_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart Me.SubReport1.Reportÿ=ÿNewÿrptOrders() EndÿSub //C# privateÿvoidÿrptCustomers_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { this.SubReport1.Reportÿ=ÿnewÿrptOrders(); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿSimpleÿSubreports

        ActiveReportsÿallowsÿreportsÿtoÿcontainÿanyÿnumberÿofÿchildÿreportsÿbyÿusingÿtheÿSubreportÿcontrol.ÿChildÿ reports,ÿorÿsubreports,ÿareÿexecutedÿeachÿtimeÿtheÿparentÿsectionÿ(i.e.ÿtheÿsectionÿinÿwhichÿtheÿSubreportÿ controlÿisÿplaced)ÿisÿprinted.ÿ Note: SubreportsÿdoÿnotÿrenderÿPageHeader/Footerÿsections,ÿsoÿyouÿcanÿdeleteÿthemÿtoÿsaveÿonÿ processingÿtime. ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿboundÿsubreportÿbyÿsettingÿtheÿReportÿpropertyÿofÿtheÿSubreportÿ controlÿtoÿtheÿchildÿreport.ÿThisÿwalkthroughÿalsoÿdemonstratesÿhowÿtoÿmodifyÿtheÿsubreportÿrecordÿsourceÿ fromÿtheÿdataÿinÿtheÿparentÿreportÿtoÿretrieveÿtheÿcorrectÿinformation. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿparentÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿdisplayÿtheÿdataÿ

        l Addingÿtheÿcodeÿneededÿtoÿsaveÿtheÿcurrentÿrecord'sÿCategoryIDÿtoÿuseÿinÿtheÿsubreport'sÿSQLÿqueryÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ350

        l Addingÿcodeÿtoÿcreateÿaÿnewÿdataÿsource,ÿsetÿitsÿconnectionÿstringÿandÿSQLÿquery,ÿandÿsetÿtheÿnewÿdataÿ sourceÿequalÿtoÿtheÿsubreport'sÿdataÿsourceÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptParent.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ351

        6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptChild.ÿ 7. ClickÿOpen.ÿ

        Connectingÿtheÿparentÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿparentÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDatasourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDatasourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcategories".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptParent,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿ

        Control DataField Name Text Location

        Label NAÿ lblProducts Productsÿ 1.15,ÿ0.25ÿ

        Label NA lblCategoryName CategoryÿName:ÿ 0,ÿ0ÿ

        TextBox CategoryNameÿ txtCategoryName CategoryNameÿ 1.15,ÿ0ÿ

        Subreport NAÿ subReport1ÿ NA 1.15,ÿ0.5ÿ

        2. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptChild,ÿsettingÿtheÿpropertiesÿasÿindicated:ÿ

        Control DataField Name Text Location

        TextBox ProductName txtProductName ProductÿName 1.15,ÿ0

        Label NA lblProductName ProductÿName: 0,ÿ0

        Addingÿtheÿcodeÿneededÿtoÿsaveÿtheÿcurrentÿrecord'sÿcategoryID Note: TheÿFieldsÿcollectionÿshouldÿneverÿbeÿaccessedÿoutsideÿtheÿDataInitializeÿandÿFetchDataÿevents.

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptParent,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptParent,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ (BaseÿClassÿEvents )ÿ(orÿ(rptParentÿevents) inÿVisualÿStudioÿ2005).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿ clickÿtheÿdrop-downÿarrowÿandÿselectÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptParent'sÿ FetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Saveÿtheÿcurrentÿrecord'sÿcategoryIDÿtoÿuseÿinÿtheÿsubreport'sÿSQLÿqueryÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿtheÿgrayÿareaÿbelowÿrptParentÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptParent'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Saveÿtheÿcurrentÿrecord'sÿcategoryIDÿtoÿuseÿinÿtheÿsubreport'sÿSQLÿqueryÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic DimÿcategoryIDStringÿAsÿString PrivateÿSubÿrptParent_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamicsÿ_ .ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ352

        categoryIDStringÿ=ÿMe.Fields("CategoryID").Value EndÿSub //C# stringÿcategoryIDString; PrivateÿVoidÿrptParent_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3. FetchEventArgsÿeArgs) { categoryIDStringÿ=ÿFields["CategoryID"].Value.ToString(); }

        Addingÿtheÿcodeÿtoÿcreateÿaÿnewÿdataÿsourceÿforÿtheÿsubreport

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿtheÿDetailÿsectionÿofÿrptParentÿtoÿcreateÿanÿevent -handlingÿmethodÿforÿrptParent'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿÿ

        l CreateÿaÿnewÿDataDynamicsÿOleDBDataSourceÿ

        l Setÿtheÿconnectionÿstringÿofÿtheÿnewÿdataÿsourceÿ l Setÿtheÿnewÿdataÿsource'sÿSQLÿqueryÿ

        l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿtheÿDetailÿsectionÿofÿrptParentÿtoÿcreateÿanÿevent -handlingÿmethodÿforÿrptParent'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l CreateÿaÿnewÿDataDynamicsÿOleDBDataSourceÿ l Setÿtheÿconnectionÿstringÿofÿtheÿnewÿdataÿsourceÿ l Setÿtheÿnewÿdataÿsource'sÿSQLÿqueryÿ

        l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail1.Format DimÿrptÿAsÿNewÿrptChild() DimÿchildDataSourceÿAsÿNewÿDataDynamics.ActiveReports.DataSources.OleDBDataSource() childDataSource.ConnectionStringÿ=ÿMe.DataSource.ConnectionString childDataSource.SQLÿ=ÿ"Selectÿ*ÿfromÿproductsÿwhereÿcategoryIDÿ=ÿ"ÿ+ÿcategoryIDString rpt.DataSourceÿ=ÿchildDataSource Me.subReport1.Reportÿ=ÿrpt EndÿSub

        //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptChildÿrptÿ=ÿnewÿrptChild(); DataDynamics.ActiveReports.DataSources.OleDBDataSourceÿchildDataSourceÿ=ÿnewÿDataDynamics. ActiveReports.DataSources.OleDBDataSource(); childDataSource.ConnectionStringÿ=ÿthis.DataSource.ConnectionString; childDataSource.SQLÿ=ÿ"Selectÿ*ÿfromÿproductsÿwhereÿcategoryIDÿ=ÿ"ÿ+ÿcategoryIDString; rpt.DataSourceÿ=ÿchildDataSource; subReport1.Reportÿ=ÿrpt; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        ÿ Note: YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.ÿInÿthisÿcase,ÿclickÿtheÿPreviewÿtabÿforÿrptParent. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ353

        NestedÿSubreports

        WhenÿsettingÿupÿembeddedÿsubreportsÿinÿActiveReports,ÿtheÿprinciplesÿareÿtheÿsameÿasÿwhenÿsettingÿupÿ simpleÿsubreportsÿbutÿareÿappliedÿtoÿtheÿchild-grandchildÿreports.ÿ Note: SubreportsÿwillÿnotÿrenderÿPageHeader/Footerÿsections,ÿsoÿyouÿcanÿdeleteÿthemÿtoÿsaveÿonÿ processingÿtime.ÿ Thisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿembeddedÿsubreports. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿeachÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ l Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿsubreportÿcontrolsÿequalÿtoÿtheirÿcorrespondingÿreportsÿ l Settingÿtheÿsubreports'ÿShowParametersUIÿpropertyÿtoÿFalseÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿthreeÿActiveReportsÿtoÿaÿVisualÿStudioÿproject ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ354

        1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptEmployees.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptOrders.ÿ 7. ClickÿOpen.ÿ 8. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 9. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomers.ÿ 10. ClickÿOpen.ÿ

        ConnectingÿrptEmployeesÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿemployees".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ConnectingÿrptOrdersÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿordersÿinnerÿjoinÿ[orderÿdetails]ÿonÿorders.orderIDÿ=ÿ[orderÿ details].orderIDÿwhereÿorders.employeeIDÿ=ÿ<%employeeID%>".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        ConnectingÿrptCustomersÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿwhereÿcustomerIDÿ=ÿ'<%CustomerID%>'ÿ".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ355

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptEmployeesÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿnameÿtoÿghEmployeesÿ ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿEmployeeIDÿ 3. AddÿtheÿfollowingÿcontrolsÿtoÿrptEmployees,ÿnamingÿthemÿasÿindicated:ÿ

        Control DataField Name Text Section Location

        TextBox EmployeeIDÿ txtEmployeeID EmployeeÿIDÿ GroupHeaderÿ 0,ÿ0ÿ

        TextBox Extensionÿ txtExtension Extensionÿ GroupHeaderÿ 3.375,ÿ0ÿ

        TextBox LastNameÿ txtLastName LastÿNameÿ GroupHeaderÿ 1.125,ÿ0ÿ

        TextBox FirstNameÿ txtFirstName FirstÿNameÿ GroupHeaderÿ 2.25,ÿ0ÿ

        Label lblEmployeeID EmployeeÿIDÿ GroupHeaderÿ 0,ÿ0ÿ

        Label lblExtension Extensionÿ GroupHeaderÿ 3.375,ÿ0ÿ

        Label lblLastName LastÿNameÿ GroupHeaderÿ 1.125,ÿÿ0ÿ

        Label lblFirstName FirstÿNameÿ GroupHeaderÿ 2.25,ÿ0ÿ

        Subreport subOrders Detailÿ 0,ÿ0ÿ

        4. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptOrders,ÿsettingÿtheÿpropertiesÿasÿindicated.ÿ

        Control DataField Name Text Location

        TextBox OrderDateÿ txtOrderDate OrderÿDateÿ 1.9375,ÿ0.25ÿ

        TextBox Quantityÿ txtQuantity Quantityÿ 4.4375,ÿ0.25ÿ

        TextBox orders.OrderIDÿ txtOrderID OrderÿIDÿ 0,ÿ0.25ÿ

        TextBox ProductIDÿ txtProductID ProductÿIDÿ 3,ÿ0.25ÿ

        Label lblOrderDate OrderÿDate:ÿ 1.9375,ÿ0ÿ

        Label lblQuantity Quantity:ÿ 4.4375,ÿ0ÿ

        Label lblOrderID OrderÿID:ÿ 0,ÿ0ÿ

        Label lblProductID ProductÿID:ÿ 3,ÿ0ÿ

        Subreport subCustomers 0,ÿ0.5ÿ

        5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        CompanyName CompanyÿName 0,ÿ0.25

        ContactName ContactÿName 1.25,ÿ0.25

        Phone Phone 2.3125,ÿ0.25

        CompanyÿName 0,ÿ0

        ContactÿName 1.25,ÿ0

        Phone 2.3125,ÿ0

        AddingÿtheÿcodeÿneededÿtoÿsetÿsubOrdersÿequalÿtoÿrptOrdersÿinÿrptEmployees

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ356

        l Double-clickÿinÿtheÿdetailÿsectionÿrptEmployees.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptEmployees'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l SetÿsubOrdersÿequalÿtoÿrptOrdersÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿdetailÿsectionÿrptEmployees.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptEmployees'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l SetÿsubOrdersÿequalÿtoÿrptOrdersÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿDetail1_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ Detail1.Format DimÿrptÿAsÿNewÿrptOrders() Me.subOrders.Reportÿ=ÿrpt EndÿSub //C# privateÿvoidÿdetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptOrdersÿrptÿ=ÿnewÿrptOrders(); subOrders.Reportÿ=ÿrpt; }

        AddingÿtheÿcodeÿneededÿtoÿsetÿsubCustomersÿequalÿtoÿrptCustomersÿinÿ rptOrders

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿinÿtheÿinÿtheÿDetailÿsectionÿofÿrptOrdersÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptOrders'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l SetÿsubCustomersÿequalÿtoÿrptCustomersÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿinÿtheÿinÿtheÿDetailÿsectionÿofÿrptOrdersÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptOrders'ÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l SetÿsubCustomersÿequalÿtoÿrptCustomersÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿghOrders_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ ghOrders.Format DimÿrptÿAsÿNewÿrptCustomers() Me.subCustomers.Reportÿ=ÿrpt EndÿSub //C# privateÿvoidÿDetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptCustomersÿrptÿ=ÿnewÿrptCustomers(); subCustomers.Reportÿ=ÿrpt; }

        SettingÿtheÿShowParametersUIÿpropertyÿtoÿfalse

        ToÿsetÿtheÿShowParametersUIÿpropertyÿtoÿfalse 1. ClickÿinÿtheÿdarkÿgrayÿareaÿunderneathÿrptCustomers toÿselectÿtheÿActiveReport.ÿ 2. Inÿtheÿpropertiesÿwindow,ÿchangeÿtheÿShowParametersUI propertyÿtoÿFalse.ÿ 3. Inÿtheÿsameÿway,ÿsetÿtheÿShowParametersUI propertyÿtoÿFalse forÿrptOrders.ÿÿ

        Viewingÿtheÿreport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ357

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        SubreportsÿwithÿXMLÿData

        ActiveReportsÿallowsÿreportsÿtoÿcontainÿanyÿnumberÿofÿchildÿreportsÿbyÿusingÿtheÿSubreportÿcontrol.ÿChildÿ reports,ÿorÿsubreports,ÿareÿexecutedÿeachÿtimeÿtheÿparentÿsectionÿ(i.e.ÿtheÿsectionÿinÿwhichÿtheÿSubreportÿ controlÿisÿplaced)ÿisÿprinted.ÿ Note: SubreportsÿwillÿnotÿrenderÿPageHeader/Footerÿsections,ÿsoÿyouÿcanÿdeleteÿthemÿtoÿsaveÿonÿ processingÿtime. ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿsubreportÿboundÿtoÿanÿXMLÿDataSourceÿbyÿsettingÿtheÿSubreportÿ control'sÿReportÿpropertyÿtoÿtheÿchildÿreportÿandÿhowÿtoÿmodifyÿtheÿsubreportÿrecordÿsourceÿfromÿtheÿdataÿinÿ theÿparentÿreportÿtoÿretrieveÿtheÿcorrectÿinformation. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿprojectÿ l ConnectingÿtheÿparentÿreportÿtoÿanÿXMLÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿdisplayÿtheÿdataÿ l AddingÿtheÿcodeÿtoÿcreateÿaÿnewÿXMLÿdataÿsource,ÿsettingÿtheÿNodeListÿforÿtheÿcurrentÿrecord,ÿandÿsettingÿ theÿnewÿdataÿsourceÿequalÿtoÿtheÿsubreport'sÿdataÿsourceÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿXMLÿCustomerÿdatabaseÿ(Customer.xml). Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿtwoÿActiveReportsÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ358

        3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptMain.ÿ 4. ClickÿOpen.ÿ 5. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 6. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptSub.ÿ 7. ClickÿOpen.ÿ

        Connectingÿtheÿparentÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿparentÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. InÿtheÿDataÿsourceÿcomboÿboxÿatÿtheÿtopÿofÿtheÿdialog,ÿselectÿXML.ÿ 3. ClickÿtheÿellipsisÿbuttonÿbesideÿFileÿURL toÿbrowseÿforÿtheÿaccessÿpathÿtoÿCustomer.xml.ÿClickÿOpen onceÿ youÿhaveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ(TheÿdefaultÿinstallationÿpathÿisÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Samples\CSharp\XMLSample\customer.xml.)ÿ 4. InÿtheÿRecordsetÿPatternÿfield,ÿtypeÿ"//CUSTOMER".ÿ 5. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptMain,ÿnamingÿthemÿasÿindicated:ÿ

        Control DataField Name Text/ReportName Location

        Label lblCustomerName CustomerÿName:ÿ 0,ÿ0ÿin

        TextBox NAMEÿ txtCustomerName NAME 1.2,ÿ0ÿin

        Label lblOrders Orders: 0.25,ÿ0.25ÿin

        Subreport ctlSubreport rptSub 0.75,ÿ0.5ÿin

        2. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptSub,ÿnamingÿthemÿasÿindicated:ÿ

        Control DataField Name Text Location

        TextBox TITLE txtTitle TITLE 0,ÿ0ÿin

        TextBox PRICE txtPrice PRICE 3.5,ÿ0ÿin

        Addingÿtheÿcodeÿtoÿcreateÿaÿnewÿdataÿsourceÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿtheÿDetailÿsectionÿinÿrptMain,ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿreport'sÿ Detail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l CreateÿaÿnewÿDataDynamicsÿXMLDataSourceÿ l TypeÿcastÿtheÿnewÿdataÿsourceÿasÿrptMain'sÿdataÿsourceÿandÿsetÿtheÿNodeListÿtoÿtheÿ"ORDER/ITEM"ÿ fieldÿ l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿDetailÿsectionÿofÿrptMainÿtoÿselectÿtheÿsection.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿDetailÿsection.ÿDouble-clickÿFormat.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿrptMain'sÿDetail_Formatÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l CreateÿaÿnewÿDataDynamicsÿXMLDataSourceÿ

        l TypeÿcastÿtheÿnewÿdataÿsourceÿasÿrptMain'sÿdataÿsourceÿandÿsetÿtheÿNodeListÿtoÿtheÿ"ORDER/ITEM"ÿ fieldÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ359

        l Setÿtheÿsubreport'sÿdataÿsourceÿequalÿtoÿtheÿnewÿdataÿsourceÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿDetail_Format(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿDetail.Format DimÿxmlDSÿAsÿNewÿDataDynamics.ActiveReports.DataSources.XMLDataSource xmlDS.NodeListÿ=ÿCType(CType(Me.DataSource,ÿDataDynamics.ActiveReports.DataSourcesÿ_ .XMLDataSource).Field("ORDER/ITEM",ÿTrue),ÿSystem.Xml.XmlNodeList) CType(Me.SubReport.Report,ÿrptSub).DataSourceÿ=ÿxmlDS EndÿSub //C#

        privateÿvoidÿDetail_Format(objectÿsender,ÿSystem.EventArgsÿeArgs) { DataDynamics.ActiveReports.DataSources.XMLDataSourceÿxmlDSÿ=ÿnewÿDataDynamics .ActiveReports.DataSources.XMLDataSource(); xmlDS.NodeListÿ=ÿ(System.Xml.XmlNodeList)((DataDynamics.ActiveReports .DataSources.XMLDataSource)ÿthis.DataSource).Field("ORDER/ITEM",true); ((rptSub)this.SubReport.Report).DataSourceÿ=ÿxmlDS; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿSummaryÿFields

        InÿActiveReports,ÿsummaryÿfieldsÿcanÿbeÿaddedÿtoÿanyÿsectionÿtoÿcalculateÿtotals,ÿcounts,ÿaveragesÿandÿotherÿ aggregations.ÿTheÿsummaryÿfield'sÿplacementÿdictatesÿwhenÿtheÿsectionÿcontainingÿtheÿfield,ÿandÿsectionsÿ afterÿit,ÿwillÿbeÿprinted.ÿAÿsectionÿwithÿaÿsummaryÿfieldÿwillÿbeÿdelayedÿuntilÿallÿtheÿcalculationsÿareÿcompleted.ÿ Thisÿallowsÿsummaryÿfieldsÿtoÿbeÿplacedÿaheadÿofÿtheÿcorrespondingÿdetail.ÿ Summaryÿfieldsÿareÿcalculatedÿaccordingÿtoÿtheÿtextbox'sÿSummaryÿproperties.ÿAÿsummaryÿtextboxÿisÿ updatedÿwithÿeachÿnewÿdetailÿrecord.ÿWhenÿaÿfieldÿisÿplacedÿaheadÿofÿtheÿDetailÿsection (i.e.ÿinÿtheÿ ReportHeader,ÿPageHeaderÿorÿGroupHeaderÿsections),ÿtheÿDetailÿsectionÿisÿformattedÿwithÿeachÿrecordÿandÿ theÿsummaryÿfieldÿisÿupdated.ÿWhenÿallÿrecordsÿforÿtheÿsummaryÿlevelÿareÿread,ÿtheÿheaderÿsectionÿisÿprintedÿ followedÿbyÿtheÿdelayedÿsections. ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿreportÿwithÿaÿsummaryÿfieldÿinÿtheÿGroupFooterÿsection.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ360

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptSumFields.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"SELECTÿDISTINCTROWÿOrders.*,ÿ[OrderÿDetails].*,ÿProducts.*ÿFROMÿProductsÿ INNERÿJOINÿ(OrdersÿINNERÿJOINÿ[OrderÿDetails]ÿONÿOrders.OrderIDÿ=ÿ[OrderÿDetails].OrderID)ÿONÿ Products.ProductIDÿ=ÿ[OrderÿDetails].ProductIDÿorderÿbyÿorderdate".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ361

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptSumFields.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghOrdersÿ ¡ ChangeÿtheÿDataField propertyÿtoÿOrderDateÿ 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Location

        Label lblProductID ProductÿIDÿ 1.208,ÿ0ÿ

        Label lblProductName ProductÿNameÿ 2.489,ÿ0ÿ

        Label lblUnitPrice UnitÿPriceÿ 4.56,ÿ0ÿ

        Label lblOrderDate OrderÿDateÿ 0,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Location OutputÿFormat

        products.ProductIDÿ ProductÿIDÿ 1.218,ÿ0ÿ NA

        ProductNameÿ ProductÿNameÿ 2.5,ÿ0ÿ NA

        OrderDateÿ OrderÿDateÿ 0,ÿ0ÿ NA

        products.UnitPriceÿ UnitÿPriceÿ 4.562,ÿ0ÿ Currencyÿ

        5. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupFooterÿsection:ÿ

        Control DataField Name Text Location Miscellaneous

        Label lblSalesTotal Dailyÿ 3,ÿ0 Salesÿ Total

        TextBox products.UnitPrice txtSalesTotal Salesÿ 4.562,ÿ0 OutputFormatÿ=ÿ Total Currencyÿ SummaryType =ÿ SubTotal SummaryRunning =ÿ Group SummaryGroup =ÿ ghOrders

        Label lblWhiteLine 0,ÿ0.25 Backgroundÿcolorÿ=ÿ white

        Note Distinctÿsummarizationÿcanÿbeÿusedÿinÿaÿsituationÿwhenÿtheÿfield'sÿvalueÿrepeatsÿinÿseveralÿdetailÿ recordsÿandÿtheÿsummaryÿfunctionÿneedsÿtoÿincludeÿaÿsingleÿvalueÿfromÿallÿrepeatingÿvalues.ÿToÿdoÿthis,ÿ youÿwouldÿneedÿtoÿsetÿtheÿDistinctFieldÿpropertyÿofÿtheÿsummaryÿfieldÿtoÿtheÿappropriateÿvalueÿandÿsetÿ theÿSummaryFuncÿpropertyÿtoÿtheÿappropriateÿdistinctÿsummaryÿfunction.ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ362

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        SummaryÿReports

        SummaryÿreportsÿareÿimplementedÿbyÿsettingÿtheÿVisibleÿpropertyÿforÿtheÿDetailÿsectionÿtoÿFalseÿorÿsettingÿ theÿHeightÿtoÿ0.ÿTheÿDetailÿsectionÿisÿprocessedÿbutÿtheÿsummaryÿGroupHeaderÿandÿFooterÿsectionsÿareÿ printedÿwithoutÿtheÿDetailÿsection. Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsummaryÿreport. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l AddingÿcodeÿtoÿtheÿDataInitializeÿandÿFetchDataÿeventsÿtoÿcreateÿaÿsummaryÿfieldÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptSummary.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ363

        3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"SELECTÿ*ÿFROMÿ[OrderÿDetails]ÿORDERÿBYÿOrderID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        AddingÿCodeÿtoÿtheÿDataInitializeÿandÿFetchDataÿEvents

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptSummary,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿ viewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptSummary,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ (BaseÿClassÿEvents) .ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿDataInitialize.ÿ Thisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptSummary'sÿDataInitializeÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿtoÿaddÿ aÿfieldÿtoÿtheÿreport'sÿfieldsÿcollection. Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. PrivateÿSubÿrptSummary_DataInitialize(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.DataInitialize Me.Fields.Add("total") EndÿSub AtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptSummary,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ(BaseÿClassÿEvents) .ÿAtÿ theÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿFetchData.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿrptSummary'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿtoÿpopulateÿtheÿfieldÿaddedÿtoÿ theÿreport'sÿfieldsÿcollection. Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. PrivateÿSubÿrptSummary_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamicsÿ_ .ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData Me.Fields("total").Valueÿ=ÿMe.Fields("Quantity").Valueÿ*ÿMe.Fields("UnitPrice").Value EndÿSub

        ToÿwriteÿtheÿcodeÿinÿC# ClickÿinÿtheÿgrayÿareaÿbelowÿrptSummaryÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿDataInitialize.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptSummary'sÿDataInitializeÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿtoÿaddÿaÿfieldÿtoÿtheÿreport'sÿfieldsÿ collection. Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. privateÿvoidÿrptSummary_DataInitialize(objectÿsender,ÿSystem.EventArgsÿeArgs) { Fields.Add("total"); } ClickÿinÿtheÿgrayÿareaÿbelowÿrptSummaryÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptSummary'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿtoÿpopulateÿtheÿfieldÿaddedÿtoÿtheÿ report'sÿfieldsÿcollection. Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. privateÿvoidÿrptSummary_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3 .FetchEventArgsÿeArgs) { this.Fields["total"].Valueÿ=ÿthis.Fields["Quantity"].Valueÿ*ÿthis.Fields ["UnitPrice"].Value; }

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. Rightÿclickÿonÿtheÿreport,ÿandÿchooseÿ"InsertÿGroupHeader/Footer"ÿ 2. ChangeÿtheÿGroupHeader'sÿName propertyÿtoÿghOrders andÿtheÿGroupFooter'sÿName propertyÿtoÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ364

        gfOrders 3. ChangeÿtheÿGroupHeader'sÿDataField propertyÿtoÿOrderID 4. ChangeÿtheÿGroupHeader'sÿUnderlayNext propertyÿtoÿTrue toÿalignÿtheÿcontrolÿinÿtheÿGroupFooterÿwithÿ theÿoneÿinÿtheÿGroupHeaderÿ 5. ChangeÿtheÿDetailÿsection'sÿVisible propertyÿtoÿFalseÿ 6. AddÿtheÿfollowingÿcontrolÿtoÿtheÿDetailÿsection:ÿ

        Control DataField Name Text

        TextBox totalÿ txtTotal Totalÿ

        7. AddÿtheÿfollowingÿcontrolÿtoÿtheÿPageHeaderÿsection:ÿ

        Control Name Text Formatting Location

        Label lblTitle Ordersÿ Fontÿ14pt;ÿBold;ÿCenterÿ 0,ÿ0ÿ

        Label lblOrderID OrderÿNumberÿ Underlineÿ 1.5,ÿ0.438ÿ

        Label lblAmount Amountÿ Underlineÿ 4.2,ÿ0.438ÿ

        8. AddÿtheÿfollowingÿcontrolÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control DataField Name Text Location

        TextBox OrderIDÿ txtOrderID OrderIDÿ 1.5,ÿ0ÿ

        9. AddÿtheÿfollowingÿcontrolÿtoÿtheÿGroupFooterÿsection:ÿ Control DataField Name Text Location Miscellaneous TextBox total txtTotal Total 4.2,ÿ0 OutputFormatÿ=ÿCurrencyÿ SummaryType =ÿSubTotal SummaryRunning =ÿGroup SummaryGroup =ÿghOrders

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        TopÿNÿReports

        ActiveReportsÿrequiresÿnoÿspecialÿhandlingÿforÿTopÿNÿRecordsÿreportÿstyles.ÿSuchÿreportsÿcanÿbeÿeasilyÿ implementedÿbyÿsettingÿtheÿdataÿsourceÿtoÿaÿTopÿNÿfilteredÿquery.ÿIfÿtheÿdataÿsourceÿdoesÿnotÿsupportÿTopÿNÿ queries,ÿtheÿqueryÿcanÿbeÿsetÿtoÿreturnÿrecordsÿorderedÿbyÿtheÿTopÿNÿvalueÿdescending.ÿThenÿtheÿMaxRowsÿ propertyÿshouldÿbeÿsetÿtoÿN. Forÿexample,ÿtoÿlistÿtheÿtopÿ10ÿcustomersÿbyÿtheirÿsalesÿnumbers,ÿyouÿcanÿcreateÿaÿqueryÿthatÿreturnsÿallÿ customerÿsalesÿorderedÿbyÿtheÿsalesÿvalueÿdescending.ÿThenÿsetÿtheÿMaxRowsÿpropertyÿofÿtheÿdataÿcontrolÿtoÿ 10.ÿActiveReportsÿwillÿprocessÿonlyÿ10ÿrecordsÿfromÿtheÿsortedÿqueryÿresults. Thisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿreportÿthatÿlistsÿtheÿtopÿtenÿcustomersÿbyÿsales. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ365

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptTopN.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"SELECTÿTOPÿ10ÿCustomers.CompanyName,ÿSum([UnitPrice]*[Quantity])ÿASÿ SalesÿFROMÿ(CustomersÿINNERÿJOINÿOrdersÿONÿCustomers.CustomerIDÿ=ÿOrders.CustomerID)ÿINNERÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ366

        JOINÿ[OrderÿDetails]ÿONÿOrders.OrderIDÿ=ÿ[OrderÿDetails].OrderIDÿGROUPÿBYÿCustomers.CompanyNameÿ ORDERÿBYÿSum([UnitPrice]*[Quantity])ÿDESC".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ

        Field Text Location

        CompanyNameÿ CompanyÿNameÿ 0.5,ÿ0ÿ

        Salesÿ Salesÿ 5,ÿ0ÿ

        2. AddÿtheÿfollowingÿcontrolÿtoÿtheÿPageHeaderÿsection:ÿ

        Control Name Text Location

        Label lblTopTen TopÿTenÿCustomersÿ 0,ÿ0ÿ

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        Walkthrough:ÿUnboundÿReports

        ActiveReportsÿgivesÿyouÿcompleteÿcontrolÿtoÿbindÿreportsÿtoÿanyÿtypeÿofÿdataÿsource,ÿincludingÿarrays,ÿ throughÿitsÿprogrammableÿobjectÿmodel.ÿYouÿcanÿcreateÿaÿreportÿwithoutÿsettingÿtheÿreport'sÿdataÿsourceÿthenÿ loadÿtheÿdataÿfromÿyourÿdataÿsourceÿintoÿtheÿreport'sÿcontrolÿatÿrunÿtime.ÿTheÿFieldsÿpropertyÿallowsÿdataÿ bindingÿbetweenÿtheÿcontrolÿandÿtheÿrun-timeÿfields.ÿItÿalsoÿallowsÿtheÿcontrol'sÿDataFieldÿpropertyÿtoÿbeÿsetÿ toÿanyÿofÿtheÿrun-timeÿdefinedÿnames.ÿTheÿDataInitializeÿandÿFetchDataÿeventsÿareÿusedÿtoÿdefineÿtheÿrun- timeÿfieldsÿandÿfeedÿtheÿdataÿvaluesÿofÿtheseÿfieldsÿsoÿtheyÿcanÿbeÿusedÿwithÿunboundÿcontrols. ThisÿwalkthroughÿillustratesÿtheÿfundamentalsÿofÿusingÿtheÿDataInitializeÿandÿFetchDataÿeventsÿtoÿsetÿupÿanÿ unboundÿreport. Thisÿwalkthroughÿisÿsplitÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ

        l Addingÿcodeÿtoÿconnectÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ

        l UsingÿtheÿDataInitializeÿeventÿtoÿaddÿfieldsÿtoÿtheÿreport'sÿfieldsÿcollectionÿ l UsingÿtheÿFetchDataÿeventÿtoÿpopulateÿtheÿreportÿfieldsÿ l UsingÿtheÿReportEndÿeventÿtoÿcloseÿtheÿdataÿconnectionÿÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ367

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptUnbound.ÿ 4. ClickÿOpen.ÿ

        Addingÿcodeÿtoÿconnectÿtheÿreportÿtoÿaÿdataÿsource

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnbound,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnbound,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿ(rptUnboundÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ ReportStart.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnbound'sÿReportStartÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ

        l Setÿtheÿdataÿsourceÿconnectionÿstringÿ l SetÿtheÿdataÿsourceÿSQLÿqueryÿ l OpenÿtheÿconnectionÿtoÿcreateÿtheÿDataReaderÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿrptUnbound'sÿ ReportStartÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Setÿtheÿdataÿsourceÿconnectionÿstringÿ

        l SetÿtheÿdataÿsourceÿSQLÿqueryÿ l OpenÿtheÿconnectionÿtoÿcreateÿtheÿDataReaderÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ368

        Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿconnÿAsÿOleDbConnection PrivateÿdrÿAsÿOleDbDataReader PrivateÿcmdÿAsÿOleDbCommand PrivateÿSubÿrptUnbound_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart connStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\ProgramÿFiles\ÿ_ DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.mdb;Persistÿ_ SecurityÿInfo=False" connÿ=ÿNewÿOleDbConnection(connString) cmdÿ=ÿNewÿOleDbCommand("SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿ_ categories.categoryidÿ=ÿproducts.categoryidÿORDERÿBYÿ_ products.categoryid,ÿproducts.productid",ÿconn) conn.Open() drÿ=ÿcmd.ExecuteReader() EndÿSub

        //C# privateÿstaticÿOleDbConnectionÿconn; privateÿstaticÿOleDbDataReaderÿdr; privateÿvoidÿrptUnbound_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { stringÿconnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:\Programÿ ÿ Files\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.mdb;Persistÿ SecurityÿInfo=False"; connÿ=ÿnewÿOleDbConnection(connString); OleDbCommandÿcmdÿ=ÿnewÿOleDbCommand("SELECTÿ*ÿFROMÿcategoriesÿINNERÿJOINÿproductsÿONÿ ÿ categories.categoryidÿ=ÿproducts.categoryidÿORDERÿBYÿproducts.categoryid, products.productid",ÿconn); conn.Open(); drÿ=ÿcmd.ExecuteReader(); }

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport AddÿtheÿfollowingÿcontrolsÿfromÿtheÿActiveReportsÿ3.0ÿtoolboxÿtoÿtheÿDetailÿsectionÿofÿrptUnbound:

        Control DataField Name Text Location

        TextBox ProductName txtProductName ProductÿName 0.0625,ÿ0.375

        TextBox UnitsInStock txtUnitsInStock UnitsÿInÿStock 4.75,ÿ0.375

        TextBox Description txtDescription Description 1.8125,ÿ 0.6875

        TextBox CategoryName txtCategoryName CategoryÿName 3.125,ÿ0.375

        Label NA lblCategoryDescription Categoryÿ 0.0625,ÿ Description 0.6875

        Label NA lblUnitsInStock UnitsÿInÿStock 4.75,ÿ0.0625

        Label NA lblCategoryName CategoryÿName 3.125,ÿ0.0625

        Label NA lblProductName ProductÿName 3.125,ÿ0.375

        Line NA line1 NA X1ÿ=ÿ0ÿ X2ÿ=ÿ6.5 Y1ÿ=ÿ1.0625 Y2ÿ=ÿ1.0625

        Note: Additionally,ÿyouÿcanÿsetÿtheÿBackColor propertyÿofÿtheÿlabelÿcontrolsÿtoÿanÿopaqueÿcolorÿtoÿ makeÿyourÿreportÿeasierÿtoÿread.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ369

        UsingÿtheÿDataInitializeÿeventÿtoÿaddÿfields

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnbound,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnbound,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿ(rptUnboundÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ DataInitialize.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnbound'sÿDataInitializeÿevent.ÿAddÿcodeÿtoÿ theÿhandlerÿto:ÿ

        l Addÿfieldsÿtoÿtheÿreport'sÿfieldsÿcollectionÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿDataInitialize.ÿThisÿcreatesÿanÿevent- handlingÿmethodÿforÿrptUnbound'sÿDataInitializeÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Addÿfieldsÿtoÿtheÿreport'sÿfieldsÿcollectionÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptUnbound_DataInitialize(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿ_ System.EventArgs)ÿHandlesÿMyBase.DataInitialize Fields.Add("CategoryName") Fields.Add("ProductName") Fields.Add("UnitsInStock") Fields.Add("Description") EndÿSub //C# privateÿvoidÿrptUnbound_DataInitialize(objectÿsender,ÿSystem.EventArgsÿeArgs) { Fields.Add("CategoryName"); Fields.Add("ProductName"); Fields.Add("UnitsInStock"); Fields.Add("Description"); }

        UsingÿtheÿFetchDataÿeventÿtoÿpopulateÿtheÿreportÿfields

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnbound,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnbound,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿ(rptUnboundÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ FetchData.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnbound'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ l Retrieveÿinformationÿtoÿpopulateÿtheÿreportÿfieldsÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿFetchData.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptUnbound'sÿFetchDataÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ

        l Retrieveÿinformationÿtoÿpopulateÿtheÿreportÿfieldsÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptUnbound_FetchData(ByValÿsenderÿAsÿObject,ÿByValÿeArgsÿAsÿDataDynamics._ ÿ ActiveReports.ActiveReport.FetchEventArgs)ÿHandlesÿMyBase.FetchData Try dr.Read() Me.Fields("CategoryName").Valueÿ=ÿdr("CategoryName") Me.Fields("ProductName").Valueÿ=ÿdr("ProductName") Me.Fields("UnitsInStock").Valueÿ=ÿdr("UnitsInStock") Me.Fields("Description").Valueÿ=ÿdr("Description") ÿ eArgs.EOFÿ=ÿFalse ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ370

        ÿ CatchÿexÿAsÿException eArgs.EOFÿ=ÿTrue EndÿTry EndÿSub //C# privateÿvoidÿrptUnbound_FetchData(objectÿsender,ÿDataDynamics.ActiveReports.ActiveReport3. FetchEventArgsÿeArgs) { try { dr.Read(); Fields["CategoryName"].Valueÿ=ÿdr["CategoryName"].ToString(); Fields["ProductName"].Valueÿ=ÿdr["ProductName"].ToString(); Fields["UnitsInStock"].Valueÿ=ÿdr["UnitsInStock"].ToString(); Fields["Description"].Valueÿ=ÿdr["Description"].ToString(); eArgs.EOFÿ=ÿfalse; } catch { eArgs.EOFÿ=ÿtrue; } } Note: TheÿDataInitializeÿandÿFetchDataÿeventsÿareÿtheÿonlyÿeventsÿinÿwhichÿtheÿFieldsÿcollectionÿshouldÿ everÿbeÿreferenced.

        UsingÿtheÿReportEndÿeventÿtoÿcloseÿtheÿdataÿconnection

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿtheÿdesignÿwindowÿofÿrptUnbound,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿ codeÿviewÿforÿtheÿreport.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿrptUnbound,ÿclickÿtheÿdrop-downÿarrowÿandÿ selectÿ(rptUnboundÿEvents).ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ ReportEnd.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿrptUnbound'sÿReportEndÿevent.ÿAddÿcodeÿtoÿtheÿ handlerÿto:ÿ l Closeÿtheÿdataÿconnectionÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿgrayÿareaÿbelowÿrptUnboundÿtoÿselectÿtheÿreport.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿProperties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿreport.ÿDouble-clickÿReportEnd.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿrptUnbound'sÿReportEndÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿ l Closeÿtheÿdataÿconnectionÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptUnbound_ReportEnd(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportEnd conn.Open() EndÿSub

        //C# privateÿvoidÿrptUnbound_ReportEnd(objectÿsender,ÿSystem.EventArgsÿeArgs) { conn.Open(); }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ371

        WebÿWalkthroughsÿ(StandardÿEdition)

        ActiveXÿViewerÿControl Describesÿhowÿtoÿviewÿandÿprintÿreportÿoutputÿinÿaÿwebÿbrowser.ÿ CustomÿExporting Describesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿvariousÿformatsÿonÿtheÿweb.ÿ WebÿDeployment DescribesÿhowÿtoÿdeployÿActiveReportsÿtoÿaÿWebÿserver.ÿ WebÿServices ÿ DescribesÿhowÿtoÿuseÿWebÿServicesÿwithÿActiveReports.

        Walkthrough:ÿUsingÿtheÿActiveXÿViewerÿControlÿonÿtheÿWeb

        TheÿActiveXÿViewerÿControlÿallowsÿyouÿtoÿviewÿandÿprintÿreportÿoutputÿinÿaÿwebÿbrowser.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l AddingÿtheÿActiveXÿviewerÿ.cabÿfileÿtoÿtheÿprojectÿfolderÿ l AddingÿaÿReportOutputÿfolderÿtoÿtheÿprojectÿfolderÿ l AddingÿrequiredÿObjectÿtagsÿtoÿtheÿhtmlÿcodeÿforÿtheÿWebÿFormÿ

        l Addingÿcodeÿforÿtheÿwindow_onloadÿeventÿforÿtheÿWebÿFormÿ l AddingÿcodeÿtoÿtheÿWebÿForm'sÿPage_Loadÿeventÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserver.ÿ Youÿmustÿalsoÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ 3.0ÿprogramÿmenuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ372

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptActiveX.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptActiveX.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ373

        4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptActiveX.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCategories

        ¡ ChangeÿtheÿBackColor propertyÿtoÿRosyBrown ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghCategories:ÿ

        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ÿ

        4. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.ÿ 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        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

        AddingÿtheÿActiveXÿ.cabÿfileÿtoÿtheÿprojectÿfolder

        ToÿaddÿtheÿActiveXÿ.cabÿfile 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿActiveReportsÿforÿ.NETÿ3.0ÿisÿinstalled.ÿTheÿ defaultÿlocationÿisÿ"C:\ProgramÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0."ÿ 2. Double-clickÿtheÿDeploymentÿfolder.ÿCopyÿtheÿfileÿcalledÿ"arview2.cab"ÿbyÿright-clickingÿonÿtheÿfileÿandÿ selectingÿCopy.ÿ 3. Browseÿtoÿtheÿfolderÿinÿwhichÿyourÿprojectÿisÿcontained.ÿ 4. Pasteÿtheÿ.cabÿfileÿintoÿyourÿproject'sÿfolder.ÿ

        AddingÿaÿReportOutputÿfolderÿtoÿtheÿprojectÿfolder

        Toÿaddÿaÿfolderÿtoÿtheÿproject 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿprojectÿisÿcontained.ÿ 2. OnÿtheÿFile menu,ÿclickÿNew> Folder.ÿ 3. Nameÿtheÿfolderÿ"ReportOutput".ÿ 4. Makeÿsureÿthatÿyouÿhaveÿwriteÿpermissionsÿforÿthisÿfolder.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ374

        AddingÿObjectÿtagsÿtoÿtheÿWebÿForm'sÿHTMLÿcode

        ToÿaddÿObjectÿtagsÿtoÿtheÿWebÿForm l InÿtheÿbodyÿofÿtheÿHTMLÿviewÿofÿtheÿWebÿForm,ÿbutÿoutsideÿtheÿ

        ÿtags,ÿaddÿtheÿfollowingÿcode.ÿ

        AddingÿcodeÿtoÿtheÿWebÿForm'sÿwindow_onloadÿevent

        Toÿaddÿcodeÿtoÿtheÿwindow_onloadÿevent 1. AtÿtheÿtopÿofÿtheÿHTMLÿviewÿofÿtheÿWebÿForm,ÿclickÿonÿtheÿdrop -downÿarrowÿforÿ"ClientÿObjectsÿandÿ Events"ÿandÿselectÿ"window".ÿ 2. Clickÿtheÿdrop-downÿarrowÿforÿtheÿavailableÿeventsÿtoÿtheÿrightÿofÿ"window"ÿandÿselectÿ"onload."ÿ 3. Thisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿwindow_onloadÿevent.ÿ 4. Addÿtheÿfollowingÿcodeÿtoÿtheÿwindow_onloadÿevent.ÿ arv.datapathÿ=ÿ"ReportOutput/axreport.rdf";

        AddingÿcodeÿtoÿtheÿWebÿForm'sÿPage_Loadÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l ReturnÿtoÿtheÿDesignÿviewÿofÿtheÿWebÿFormÿandÿdouble-clickÿonÿtheÿform.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿtheÿWebÿForm'sÿPage_Loadÿevent.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ReturnÿtoÿtheÿDesignÿviewÿotÿtheÿWebÿFormÿandÿdouble-clickÿonÿtheÿform.ÿThisÿcreatesÿanÿevent-handlingÿ methodÿforÿWebÿForm'sÿPage_Loadÿevent.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic 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); }

        CustomÿWebÿExportingÿWalkthroughs

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿExcelÿandÿplainÿ text.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿTheÿfollowingÿwalkthroughsÿ demonstrateÿhowÿtoÿsetÿupÿreportÿcustomÿexportingÿtoÿHTML,ÿPDF,ÿExcel,ÿTIFF,ÿRTFÿandÿplainÿtextÿformats.ÿ Forÿeachÿofÿtheseÿwalkthroughs,ÿitÿisÿassumedÿthatÿaÿreferenceÿtoÿtheÿappropriateÿ DataDynamics.ActiveReportsÿexportÿfilterÿhasÿbeenÿaddedÿtoÿtheÿproject. ÿ CustomÿExportingÿwithÿHTML DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿHTMLÿofÿaÿreportÿonÿtheÿweb.ÿ CustomÿExportingÿwithÿPDF ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ375

        DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿPDFÿofÿaÿreportÿonÿtheÿweb.ÿ CustomÿExportingÿwithÿExcel DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿExcelÿofÿaÿreportÿonÿtheÿweb.ÿ CustomÿExportingÿwithÿTIFF DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿTIFFÿofÿaÿreportÿonÿtheÿweb.ÿ CustomÿExportingÿwithÿRTF DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿRTFÿofÿaÿreportÿonÿtheÿweb.ÿ CustomÿExportingÿwithÿPlainÿText ÿ DescribesÿhowÿtoÿsetÿupÿcustomÿexportingÿtoÿTextÿofÿaÿreportÿonÿtheÿweb.

        Walkthrough:ÿCustomÿExportingÿwithÿHTML

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿExcel,ÿTIFFÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿHTMLÿ format. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿHtmlÿexportÿcontrolÿtoÿtheÿWebÿFormÿÿ

        l CreatingÿaÿpublicÿclassÿforÿtheÿHTMLÿoutputterÿ

        l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿHTMLÿ l Addingÿaÿfolderÿtoÿtheÿprojectÿforÿreportÿoutputÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserver.ÿ Youÿmustÿalsoÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿ programÿmenuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ376

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustHTML.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustHTML.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDatasourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿcustomersÿorderÿbyÿcountry".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCustHTML.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghCountries

        ¡ ChangeÿtheÿBackColor propertyÿtoÿSilver ¡ ChangeÿtheÿDataField propertyÿtoÿCountry 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghCountries:ÿ

        Name Text Location Formatting

        lblCustomerID CustomerÿIDÿ 0,ÿ0ÿ Bold

        lblCompanyName CompanyÿNameÿ 0.88,ÿ0ÿ Bold

        lblContactName ContactÿNameÿ 2.13,ÿ0ÿ Bold

        lblAddress Addressÿ 3.19,ÿ0ÿ Bold

        lblCity Cityÿ 4.31,ÿ0ÿ Bold

        lblPhone Phoneÿ 5.44,ÿ0ÿ Bold

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ377

        ¡ ChangeÿtheÿBackColor propertyÿtoÿWhiteSmoke ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿpropertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        CustomerID CustomerÿID 0,ÿ0

        CompanyName CompanyÿName 0.88,ÿ0

        ContactName ContactÿName 2.13,ÿ0

        Address Address 3.19,ÿ0

        City City 4.31,ÿ0

        Phone Phone 5.44,ÿ0

        AddingÿtheÿHtmlÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿHtmlÿExportÿcontrolÿisÿVisualÿStudioÿ2003 1. ClickÿonÿtheÿHtmlÿExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.ÿ

        ToÿaddÿtheÿHtmlÿExportÿcontrolÿisÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿHtmlÿExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        CreatingÿaÿpublicÿclassÿforÿtheÿHTMLÿoutputter

        Toÿcreateÿaÿpublicÿclass 1. InÿtheÿSolutionÿExplorerÿwindow,ÿright-clickÿonÿyourÿprojectÿnameÿandÿselectÿAddÿNewÿItem.ÿ 2. InÿtheÿTemplates windowÿofÿtheÿAddÿNewÿItem dialog,ÿselectÿClass.ÿ 3. Changeÿtheÿnameÿofÿtheÿfileÿtoÿ"MyCustomHtmlOutputter"ÿandÿclickÿtheÿOpen button.ÿ(InÿVisualÿStudioÿ 2005,ÿclickÿtheÿAdd buttonÿandÿthenÿselectÿYes toÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder.)ÿ 4. Thisÿopensÿtheÿcodeÿviewÿofÿtheÿclassÿfileÿwhereÿyouÿcanÿaddÿtheÿcodeÿneededÿtoÿcreateÿtheÿpublicÿclass.ÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Addÿtheÿfollowingÿcodeÿbetweenÿ"PublicÿClassÿMyCustomHtmlOutputter"ÿandÿ"EndÿClass".ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Addÿtheÿfollowingÿcodeÿunderÿ"publicÿclassÿMyCustomHtmlOutputter".ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcompleteÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic ImportsÿSystem ImportsÿSystem.IO ImportsÿSystem.Web ImportsÿSystem.Text ImportsÿDataDynamics.ActiveReports ImportsÿDataDynamics.ActiveReports.Export.Html PublicÿClassÿMyCustomHtmlOutputter ImplementsÿIOutputHtml 'ÿTheÿhttpÿcontextÿofÿtheÿrequest. PrivateÿcontextÿAsÿSystem.Web.HttpContextÿ=ÿNothing ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ378

        'ÿTheÿdirectoryÿtheÿfilenameÿwillÿbeÿsavedÿin--thisÿwillÿbeÿusedÿtoÿensureÿtheÿfilenameÿ 'ÿisÿunique. PrivateÿdirToSaveÿAsÿSystem.IO.DirectoryInfoÿ=ÿNothing PublicÿmainPageÿAsÿStringÿ=ÿ"" PublicÿSubÿNew(ByValÿcontextÿAsÿSystem.Web.HttpContext) IfÿcontextÿIsÿNothingÿThen ThrowÿNewÿArgumentNullException("context") EndÿIf Me.contextÿ=ÿcontext DimÿdirNameÿAsÿStringÿ=ÿcontext.Server.MapPath("ReportOutput") Me.dirToSaveÿ=ÿNewÿDirectoryInfo(dirName) EndÿSub #Regionÿ"ImplementationÿofÿIOutputHtml" PublicÿFunctionÿOutputHtmlData(ByValÿinfoÿAsÿDataDynamics.ActiveReports.Export.Htmlÿ_ .HtmlOutputInfoArgs)ÿAsÿÿStringÿImplementsÿIOutputHtml.OutputHtmlData DimÿtempÿAsÿStringÿ=ÿ"" SelectÿCaseÿinfo.OutputKind CaseÿHtmlOutputKind.BookmarksHtml CaseÿHtmlOutputKind.FramesetHtml tempÿ=ÿMe.GenUniqueFileNameWithExtension(".html") DimÿfsÿAsÿNewÿFileStream(temp,ÿFileMode.CreateNew) Me.WriteStreamToStream(info.OutputStream,ÿfs) fs.Close() Returnÿtemp CaseÿHtmlOutputKind.HtmlPage 'ÿWeÿwantÿtoÿholdÿonÿtoÿtheÿnameÿofÿtheÿmainÿpageÿsoÿweÿcanÿredirectÿtheÿ ÿ 'ÿbrowserÿtoÿit Me.mainPageÿ=ÿMe.GenUniqueFileNameWithExtension(".html") DimÿfsÿAsÿNewÿFileStream(Me.mainPage,ÿFileMode.CreateNew) Me.WriteStreamToStream(info.OutputStream,ÿfs) fs.Close() ReturnÿMe.mainPage CaseÿHtmlOutputKind.ImageJpg 'ÿshouldÿbeÿaÿfileÿwithÿaÿ.jpgÿextension: tempÿ=ÿMe.GenUniqueFileNameWithExtension(".jpg") DimÿfsÿAsÿNewÿFileStream(temp,ÿFileMode.CreateNew) fsÿ=ÿFile.Create(temp) Me.WriteStreamToStream(info.OutputStream,ÿfs) fs.Close() Returnÿtemp CaseÿHtmlOutputKind.ImagePng 'ÿshouldÿbeÿaÿfileÿwithaÿ.pngÿextension: tempÿ=ÿMe.GenUniqueFileNameWithExtension(".png") DimÿfsÿAsÿNewÿFileStream(temp,ÿFileMode.CreateNew) Me.WriteStreamToStream(info.OutputStream,ÿfs) fs.Close() Returnÿtemp CaseÿElse 'ÿThisÿcaseÿshouldn'tÿreallyÿhappen,ÿbutÿwe'llÿdefaultÿtoÿhtml. tempÿ=ÿMe.GenUniqueFileNameWithExtension(".html") DimÿfsÿAsÿNewÿFileStream(temp,ÿFileMode.CreateNew) Me.WriteStreamToStream(info.OutputStream,ÿfs) fs.Close() Returnÿtemp EndÿSelect EndÿFunction PublicÿSubÿFinish() ImplementsÿIOutputHtml.Finish EndÿSub #EndÿRegion PrivateÿSubÿWriteStreamToStream(ByValÿsourceStreamÿAsÿStream,ÿByValÿtargetStreamÿAsÿStream) 'ÿWhat'sÿtheÿsizeÿofÿtheÿsourceÿstream: DimÿsizeÿAsÿIntegerÿ=ÿCType(sourceStream.Length,ÿInteger) 'ÿCreateÿaÿbufferÿthatÿsameÿsize: Dimÿbuffer(size)ÿAsÿByte 'ÿMoveÿtheÿsourceÿstreamÿtoÿtheÿbeginning: sourceStream.Seek(0,ÿSeekOrigin.Begin) 'copyÿtheÿwholeÿsourceStreamÿintoÿourÿbuffer: ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ379

        sourceStream.Read(buffer,ÿ0,ÿsize) 'Writeÿoutÿbufferÿtoÿtheÿtargetÿstream: targetStream.Write(buffer,ÿ0,ÿsize) EndÿSub PrivateÿFunctionÿGenUniqueFileNameWithExtension(ByValÿextensionWithDotÿAsÿString)ÿAsÿString DimÿrÿAsÿNewÿSystem.Random() DimÿuniqueÿAsÿBooleanÿ=ÿFalse DimÿfilePathÿAsÿStringÿ=ÿ"" DimÿiRandomÿAsÿIntegerÿ=ÿ0 'ÿGenerateÿaÿrandomÿnameÿuntilÿit'sÿunique: WhileÿNotÿunique iRandomÿ=ÿr.Next() 'ÿBuldÿtheÿfullÿfilename Dimÿsbÿ=ÿNewÿStringBuilder() sb.Append(Me.dirToSave.FullName) sb.Append(Path.DirectorySeparatorChar) sb.Append(iRandom.ToString()) sb.Append(extensionWithDot) filePathÿ=ÿsb.ToString() IfÿFile.Exists(filePath)ÿ=ÿFalseÿThen uniqueÿ=ÿTrue Else uniqueÿ=ÿFalse EndÿIf EndÿWhile ReturnÿfilePath EndÿFunction EndÿClass //C# usingÿSystem; usingÿSystem.IO; usingÿSystem.Web; usingÿSystem.Text; usingÿDataDynamics.ActiveReports; usingÿDataDynamics.ActiveReports.Export.Html; publicÿclassÿMyCustomHtmlOutputter:DataDynamics.ActiveReports.Export.Html.IOutputHtml { //ÿTheÿhttpÿcontextÿofÿtheÿrequest. privateÿSystem.Web.HttpContextÿcontextÿ=ÿnull; //ÿTheÿdirectoryÿtheÿfilenameÿwillÿbeÿsavedÿin--thisÿwillÿbeÿusedÿtoÿensureÿtheÿ ÿ //ÿfilenameÿisÿunique. privateÿSystem.IO.DirectoryInfoÿdirToSaveÿ=ÿnull; publicÿstringÿmainPageÿ=ÿ""; publicÿMyCustomHtmlOutputter(System.Web.HttpContextÿcontext) { ifÿ(contextÿ==ÿnull) throwÿnewÿArgumentNullException("context"); this.contextÿ=ÿcontext; stringÿdirNameÿ=ÿcontext.Server.MapPath("ReportOutput"); this.dirToSaveÿ=ÿnewÿDirectoryInfo(dirName); } #regionÿImplementationÿofÿIOutputHtml publicÿstringÿOutputHtmlData(DataDynamics.ActiveReports.Export.Html.HtmlOutputInfoArgsÿinfo) { stringÿtempÿ=ÿ""; switchÿ(info.OutputKind) { caseÿHtmlOutputKind.BookmarksHtml: caseÿHtmlOutputKind.FramesetHtml: { tempÿ=ÿthis.GenUniqueFileNameWithExtension(".html"); FileStreamÿfsÿ=ÿFile.Create(temp); this.WriteStreamToStream(info.OutputStream,ÿfs); fs.Close(); returnÿtemp; } caseÿHtmlOutputKind.HtmlPage: { ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ380

        //ÿWeÿwantÿtoÿholdÿonÿtoÿtheÿnameÿofÿtheÿmainÿpageÿsoÿweÿcan ÿ //ÿredirectÿtheÿbrowserÿtoÿit: this.mainPageÿ=ÿthis.GenUniqueFileNameWithExtension(".html"); FileStreamÿfsÿ=ÿFile.Create(this.mainPage); this.WriteStreamToStream(info.OutputStream,ÿfs); fs.Close(); returnÿthis.mainPage; } caseÿHtmlOutputKind.ImageJpg: { //ÿshouldÿbeÿaÿfileÿwithÿaÿ.jpgÿextension: tempÿ=ÿthis.GenUniqueFileNameWithExtension(".jpg"); FileStreamÿfsÿ=ÿFile.Create(temp); this.WriteStreamToStream(info.OutputStream,ÿfs); fs.Close(); returnÿtemp; } caseÿHtmlOutputKind.ImagePng: { //ÿshouldÿbeÿaÿfileÿwithaÿ.pngÿextension: tempÿ=ÿthis.GenUniqueFileNameWithExtension(".png"); FileStreamÿfsÿ=ÿFile.Create(temp); this.WriteStreamToStream(info.OutputStream,ÿfs); fs.Close(); returnÿtemp; } default: { //ÿThisÿcaseÿshouldn'tÿreallyÿhappen,ÿbutÿwe'llÿdefaultÿtoÿhtml. tempÿ=ÿthis.GenUniqueFileNameWithExtension(".html"); FileStreamÿfsÿ=ÿFile.Create(temp); this.WriteStreamToStream(info.OutputStream,ÿfs); fs.Close(); returnÿtemp; } } } publicÿvoidÿFinish() { } #endregion

        privateÿvoidÿWriteStreamToStream(StreamÿsourceStream,ÿStreamÿtargetStream) {

        //ÿWhatsÿtheÿsizeÿofÿtheÿsourceÿstream: intÿsizeÿ=ÿ(int)sourceStream.Length; ÿ //ÿCreateÿaÿbufferÿthatÿsameÿsize: byte[]ÿbufferÿ=ÿnewÿbyte[size];

        //ÿMoveÿtheÿsourceÿstreamÿtoÿtheÿbegining: sourceStream.Seek(0,ÿSeekOrigin.Begin);

        //ÿcopyÿtheÿwholeÿsourceStreamÿinÿtoÿourÿbuffer: sourceStream.Read(buffer,ÿ0,ÿsize);

        //ÿWriteÿoutÿbufferÿtoÿtheÿtargetÿstream: targetStream.Write(buffer,ÿ0,ÿsize); }

        ///ÿ

        ///ÿGeneratesÿaÿunqiueÿfileÿnameÿwithÿtheÿspecifiedÿextension. ///ÿ ///ÿ ///ÿTheÿfileÿextensionÿbeginingÿwithÿaÿdotÿsuchÿasÿ".jpg". ///ÿ ///ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ381

        privateÿstringÿGenUniqueFileNameWithExtension(stringÿextensionWithDot) { System.Randomÿrÿ=ÿnewÿRandom();

        boolÿuniqueÿ=ÿfalse;

        stringÿfilePathÿ=ÿ""; intÿiRandomÿ=ÿ0; //ÿGenerateÿaÿrandomÿnameÿuntilÿit'sÿunique: whileÿ(!unique) { iRandomÿ=ÿr.Next(); ÿ //ÿBuldÿtheÿfullÿfilename System.Text.StringBuilderÿsbÿ=ÿnewÿSystem.Text.StringBuilder(); sb.Append(this.dirToSave.FullName); sb.Append(Path.DirectorySeparatorChar); sb.Append(iRandom.ToString()); sb.Append(extensionWithDot);

        filePathÿ=ÿÿÿsb.ToString();

        ÿ

        uniqueÿ=ÿ!File.Exists(filePath); }

        returnÿfilePath;

        } ÿ }

        }

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿHTML

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPageÿLoadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPageÿLoadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿPage_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿÿ_

        DimÿrptÿAsÿNewÿrptCustHTML() Try rpt.Run(False) CatchÿeRunReportÿAsÿException 'ÿFailureÿrunningÿreport,ÿjustÿreportÿtheÿerrorÿtoÿtheÿuser: Response.Clear() Response.Write("

        Errorÿrunningÿreport:

        ") Response.Write(eRunReport.ToString()) Return EndÿTry 'ÿBufferÿthisÿpage'sÿoutputÿuntilÿtheÿreportÿoutputÿisÿready. Response.Bufferÿ=ÿTrue 'ÿClearÿanyÿpartÿofÿthisÿpageÿthatÿmightÿhaveÿalreadyÿbeenÿbufferedÿforÿoutput. Response.ClearContent() 'ÿClearÿanyÿheadersÿthatÿmightÿhaveÿalreadyÿbeenÿbufferedÿ(suchÿasÿtheÿcontentÿtypeÿ 'ÿforÿanÿHTMLÿpage) Response.ClearHeaders() 'ÿTellÿtheÿbrowserÿandÿtheÿ"network"ÿthatÿthisÿresultingÿdataÿofÿthisÿpageÿshouldÿbeÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ382

        'ÿcachedÿsinceÿthisÿcouldÿbeÿaÿdynamicÿreportÿthatÿchangesÿuponÿeachÿrequest. Response.Cache.SetCacheability(HttpCacheability.NoCache) 'ÿTellÿtheÿbrowserÿthisÿisÿanÿHtmlÿdocumentÿsoÿitÿwillÿuseÿanÿappropriateÿviewer. Response.ContentTypeÿ=ÿ"text/HTML" 'ÿCreateÿtheÿHtmlÿexportÿobject DimÿHtmlExport1ÿAsÿNewÿDataDynamics.ActiveReports.Export.Html.HtmlExport() DimÿoutputterÿAsÿNewÿMyCustomHtmlOutputter(Me.Context) HtmlExport1.Export(rpt.Document,ÿoutputter,ÿ"") Response.Redirect("ReportOutput"ÿ+ÿ"/"ÿ+ÿSystem.IO.Path.GetFileNameÿ_ ÿ (outputter.mainPage)) EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { rptCustHTMLÿrptÿ=ÿnewÿrptCustHTML(); try { rpt.Run(false); } catchÿ(ExceptionÿeRunReport) { //ÿFailureÿrunningÿreport,ÿjustÿreportÿtheÿerrorÿtoÿtheÿuser: Response.Clear(); Response.Write("

        Errorÿrunningÿreport:

        "); Response.Write(eRunReport.ToString()); return; } //ÿBufferÿthisÿpage'sÿoutputÿuntilÿtheÿreportÿoutputÿisÿready. Response.Bufferÿ=ÿtrue; //ÿClearÿanyÿpartÿofÿthisÿpageÿthatÿmightÿhaveÿalreadyÿbeenÿbufferedÿforÿoutput. Response.ClearContent(); //ÿClearÿanyÿheadersÿthatÿmightÿhaveÿalreadyÿbeenÿbufferedÿ(suchÿasÿtheÿcontentÿ ÿ //ÿtypeÿforÿanÿHTMLÿpage) Response.ClearHeaders(); //ÿTellÿtheÿbrowserÿandÿtheÿ"network"ÿthatÿthisÿresultingÿdataÿofÿthisÿpageÿshouldÿ ÿ //ÿbeÿcachedÿsinceÿthisÿcouldÿbeÿaÿdynamicÿreportÿthatÿchangesÿuponÿeachÿrequest. Response.Cache.SetCacheability(HttpCacheability.NoCache); //ÿTellÿtheÿbrowserÿthisÿisÿanÿHtmlÿdocumentÿsoÿitÿwillÿuseÿanÿappropriateÿviewer. Response.ContentTypeÿ=ÿ"text/html"; //ÿCreateÿtheÿHTMLÿexportÿobject DataDynamics.ActiveReports.Export.Html.HtmlExportÿhtmlÿ=ÿnewÿDataDynamics ÿ .ActiveReports.Export.Html.HtmlExport(); //ÿExportÿtheÿreportÿtoÿHTMLÿinÿthisÿsession'sÿwebcache: //this.htmlExport1.Export(rpt.Document,ÿDataDynamics.ActiveReports.Web MyCustomHtmlOutputterÿoutputterÿ=ÿnewÿMyCustomHtmlOutputter(this.Context); this.htmlExport1.Export(rpt.Document,ÿoutputter,ÿ""); Response.Redirect("ReportOutput"ÿ+ÿ"/"ÿ+ÿSystem.IO.Path.GetFileName ÿ (outputter.mainPage)); }

        Addingÿaÿfolderÿtoÿtheÿprojectÿforÿreportÿoutput

        Toÿaddÿaÿfolderÿtoÿtheÿproject 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿprojectÿisÿcontained.ÿ 2. OnÿtheÿFile menu,ÿclickÿNewÿ>ÿFolder.ÿ

        3.ÿ Nameÿtheÿfolderÿ"ReportOutput".ÿ 4. Makeÿsureÿthatÿyouÿhaveÿwriteÿpermissionsÿforÿthisÿfolder.ÿ

        Walkthrough:ÿCustomÿExportingÿwithÿPDF

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿExcel,ÿTIFFÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ383

        ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿPDFÿ format. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿPDFÿExportÿcontrolÿtoÿtheÿWebÿFormÿÿ

        l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿPDFÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserverÿ andÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿ menuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿinÿPDFÿformatÿthatÿlooksÿsimilarÿtoÿtheÿ following.

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomPDF.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ384

        1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomPDF.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCustomPDF.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProducts ¡ ChangeÿtheÿBackColor propertyÿtoÿMediumSlateBlue ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Formatting Name Text Location

        Bold lblProductIDÿ ProductÿIDÿ 0,ÿ0ÿ

        Bold lblProductNameÿ ProductÿNameÿ 1,ÿ0ÿ

        Bold lblUnitsInStockÿ UnitsÿinÿStockÿ 2.69,ÿ0ÿ

        Bold lblUnitsOnOrderÿ UnitsÿonÿOrderÿ 3.81,ÿ0ÿ

        Bold lblUnitPriceÿ UnitÿPriceÿ 5,ÿ0ÿ

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿLightGray ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location OutputÿFormat

        ProductID ProductÿID 0,ÿ0 NA

        ProductName ProductÿName 1,ÿ0 NA

        UnitsInStock UnitsÿinÿStock 2.69,ÿ0 NA

        UnitsOnOrder UnitsÿonÿOrder 3.81,ÿ0 NA ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ385

        UnitPrice UnitÿPrice 5,ÿ0 Currency

        AddingÿtheÿPDFÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿPDFÿExportÿcontrolÿusingÿVisualÿStudioÿ2003 1. ClickÿonÿtheÿPDFÿExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.

        ToÿaddÿtheÿPDFÿExportÿcontrolÿusingÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿPDFÿExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿPDF

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿonÿWebForm1.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿWebForm1'sÿPage_Loadÿevent.ÿ AddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿonÿWebForm1.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿWebForm1'sÿPage_Loadÿevent.ÿ AddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic PrivateÿSubÿPage_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿ_ MyBase.Load Dimÿm_streamÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptCustomPDF() rpt.Run() IfÿMe.pdfExport1ÿIsÿNothingÿThen Me.pdfExport1ÿ=ÿNewÿDataDynamics.ActiveReports.Export.Pdf.PdfExport EndÿIf Me.PdfExport1.Export(rpt.Document,ÿm_stream) m_stream.Positionÿ=ÿ0 Response.ContentTypeÿ=ÿ"application/pdf" Response.AddHeader("content-disposition","inline;ÿfilename=MyExport.pdf") Response.BinaryWrite(m_stream.ToArray()) Response.End() EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿm_streamÿ=ÿnewÿSystem.IO.MemoryStream(); rptCustomPDFÿrptÿ=ÿnewÿrptCustomPDF(); rpt.Run(); ifÿ(this.pdfExport1ÿ==ÿnull) { this.pdfExport1ÿ=ÿnewÿDataDynamics.ActiveReports.Export.Pdf.PdfExport(); } this.pdfExport1.Export(rpt.Document,ÿm_stream); m_stream.Positionÿ=ÿ0; Response.ContentTypeÿ=ÿ"application/pdf"; Response.AddHeader("content-disposition","inline;ÿfilename=MyExport.pdf"); Response.BinaryWrite(m_stream.ToArray()); Response.End(); }

        ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ386

        RunÿtheÿprojectÿtoÿseeÿtheÿreportÿdisplayedÿinÿaÿPDFÿviewerÿwithinÿyourÿinternetÿbrowser.

        Walkthrough:ÿCustomÿExportingÿwithÿExcel

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿExcel,ÿTIFFÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿExcelÿ format. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l AddingÿtheÿExcelÿexportÿcontrolÿtoÿtheÿWebÿFormÿ l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿExcelÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserverÿ andÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿ menuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿinÿExcelÿformatÿthatÿlooksÿsimilarÿtoÿtheÿ following.

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ387

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomExcel.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomExcel.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿtheÿBuild button.ÿ 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿ 5. ClickÿOpen onceÿyouÿhaveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 6. ClickÿOK toÿcontinue.ÿ 7. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 8. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptExcel.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿMediumPurple

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Formatting Name Text Location

        Bold lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Bold lblProductName ProductÿNameÿ 1.06,ÿ0ÿ

        Bold lblUnitsInStock UnitsÿInÿStockÿ 3.5,ÿ0ÿ

        Bold lblUnitsOnOrder UnitsÿOnÿOrderÿ 4.56,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ 5.7,ÿ0ÿ

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿLavender

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ388

        theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        DataField Text Location OutputÿFormat

        ProductID ProductÿID 0,ÿ0 NA

        ProductName ProductÿName 1.06,ÿ0 NA

        UnitsInStock UnitsÿInÿStock 3.5,ÿ0 NA

        UnitsOnOrder UnitsÿOnÿOrder 4.56,ÿ0 NA

        UnitPrice UnitÿPrice 5.7,ÿ0 Currency

        AddingÿtheÿExcelÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿExcelÿExportÿcontrolÿusingÿVisualÿStudioÿ2003 1. ClickÿonÿtheÿXlsExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.

        ToÿaddÿtheÿExcelÿExportÿcontrolÿusingÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿXlsExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿExcel

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic ProtectedÿSubÿPage_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMe.Load Dimÿm_streamÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptCustomExcel() rpt.Run() IfÿMe.xlsExport1ÿIsÿNothingÿThen Me.xlsExport1ÿ=ÿNewÿDataDynamics.ActiveReports.Export.Xls.XlsExport EndÿIf Me.xlsExport1.MinColumnWidthÿ=ÿ0.5 Me.xlsExport1.Export(rpt.Document,ÿm_stream) m_stream.Positionÿ=ÿ0 Response.ContentTypeÿ=ÿ"application/vnd.ms-excel" Response.AddHeader("content-disposition",ÿ"inline;ÿfilename=MyExport.xls") Response.BinaryWrite(m_stream.ToArray()) Response.End() EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿm_streamÿ=ÿnewÿSystem.IO.MemoryStream(); rptCustomExcelÿrptÿ=ÿnewÿrptCustomExcel(); rpt.Run(); ifÿ(this.xlsExport1ÿ==ÿnull)ÿ {ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ389

        this.xlsExport1ÿ=ÿnewÿDataDynamics.ActiveReports.Export.Xls.XlsExport();ÿ }ÿ this.xlsExport1.MinColumnWidthÿ=ÿ0.5; this.xlsExport1.Export(rpt.Document,ÿm_stream); m_stream.Positionÿ=ÿ0; Response.ContentTypeÿ=ÿ"application/vnd.ms-excel"; Response.AddHeader("content-disposition","inline;ÿfilename=MyExport.xls"); Response.BinaryWrite(m_stream.ToArray()); Response.End();

        }ÿ ToÿviewÿtheÿresultsÿinÿyourÿWebÿbrowser,ÿrunÿtheÿprojectÿandÿclickÿtheÿOpen buttonÿwhenÿprompted.

        Walkthrough:ÿCustomÿExportingÿwithÿTIFF

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿTIFF,ÿExcelÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿTIFFÿ format. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l AddingÿtheÿTIFFÿexportÿcontrolÿtoÿtheÿWebÿFormÿ

        l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿaÿTIFFÿimageÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserverÿ andÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿ menuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿTIFFÿimageÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ390

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomTiff.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomTiff.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ391

        3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCustomTiff.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿMediumPurple

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Formatting Name Text Location

        Bold lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Bold lblProductName ProductÿNameÿ 1.06,ÿ0ÿ

        Bold lblUnitsInStock UnitsÿInÿStockÿ 3.5,ÿ0ÿ

        Bold lblUnitsOnOrder UnitsÿOnÿOrderÿ 4.56,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ 5.7,ÿ0ÿ

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ ChangeÿtheÿBackColor propertyÿtoÿLavender

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        DataField Text Location OutputÿFormat

        ProductID ProductÿID 0,ÿ0 NA

        ProductName ProductÿName 1.06,ÿ0 NA

        UnitsInStock UnitsÿInÿStock 3.5,ÿ0 NA

        UnitsOnOrder UnitsÿOnÿOrder 4.56,ÿ0 NA

        UnitPrice UnitÿPrice 5.7,ÿ0 Currency

        AddingÿtheÿTIFFÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿTIFFÿExportÿcontrolÿusingÿVisualÿStudioÿ2003 1. ClickÿonÿtheÿTiffExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.

        ToÿaddÿtheÿTIFFÿExportÿcontrolÿusingÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿTiffExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ392

        3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿTIFF

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿonÿtheWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic ProtectedÿSubÿPage_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMe.Load Dimÿm_streamÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptCustomTiff() rpt.Run() IfÿMe.tiffExport1ÿIsÿNothingÿThen Me.tiffExport1ÿ=ÿNewÿDataDynamics.ActiveReports.Export.Tiff.TiffExport EndÿIf Me.tiffExport1.CompressionSchemeÿ=ÿDataDynamics.ActiveReports.Export.Tiff.CompressionScheme.None Me.tiffExport1.Export(rpt.Document,ÿm_stream) m_stream.Positionÿ=ÿ0 Response.ContentTypeÿ=ÿ"image/tiff" Response.AddHeader("content-disposition",ÿ"inline;ÿfilename=MyExport.tiff") Response.BinaryWrite(m_stream.ToArray()) Response.End() EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿm_streamÿ=ÿnewÿSystem.IO.MemoryStream(); rptCustomTiffÿrptÿ=ÿnewÿrptCustomTiff(); rpt.Run(); ifÿ(this.tiffExport1ÿ==ÿnull)ÿ {ÿ this.tiffExport1ÿ=ÿnewÿDataDynamics.ActiveReports.Export.Tiff.TiffExport();ÿ }ÿ this.tiffExport1.CompressionSchemeÿ=ÿDataDynamics.ActiveReports.Export.Tiff.CompressionScheme.None; this.tiffExport1.Export(rpt.Document,ÿm_stream); m_stream.Positionÿ=ÿ0; Response.ContentTypeÿ=ÿ"image/tiff"; Response.AddHeader("content-disposition","inline;ÿfilename=MyExport.tiff"); Response.BinaryWrite(m_stream.ToArray()); Response.End();

        }ÿ ToÿviewÿtheÿresultsÿinÿyourÿWebÿbrowser,ÿrunÿtheÿprojectÿandÿclickÿtheÿOpen buttonÿwhenÿprompted.

        Walkthrough:ÿCustomÿExportingÿwithÿRTF

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿTIFF,ÿExcelÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿRTFÿ format. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ

        l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿRTFÿexportÿcontrolÿtoÿtheÿWebÿFormÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ393

        l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿRTFÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserverÿ andÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿ menuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿinÿRTFÿformatÿthatÿlooksÿsimilarÿtoÿtheÿ following.

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomRtf.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomRtf.ÿ 4. ClickÿAdd. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ394

        5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿtheÿBuild button.ÿ 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. Clickÿtheÿellipsisÿ(...)ÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿ youÿhaveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCustomRtf.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Formatting Name Text Location

        Bold lblProductID ProductÿIDÿ 0,ÿ0ÿ

        Bold lblProductName ProductÿNameÿ 1.06,ÿ0ÿ

        Bold lblUnitsInStock UnitsÿInÿStockÿ 3.5,ÿ0ÿ

        Bold lblUnitsOnOrder UnitsÿOnÿOrderÿ 4.56,ÿ0ÿ

        Bold lblUnitPrice UnitÿPriceÿ 5.7,ÿ0ÿ

        4. Makeÿtheÿfollowingÿchangeÿtoÿtheÿdetailÿsection:ÿ

        ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        DataField Text Location OutputÿFormat

        ProductID ProductÿID 0,ÿ0 NA

        ProductName ProductÿName 1.06,ÿ0 NA

        UnitsInStock UnitsÿInÿStock 3.5,ÿ0 NA

        UnitsOnOrder UnitsÿOnÿOrder 4.56,ÿ0 NA

        UnitPrice UnitÿPrice 5.7,ÿ0 Currency

        AddingÿtheÿRTFÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿExcelÿExportÿcontrolÿusingÿVisualÿStudioÿ2003 1. ClickÿonÿtheÿXlsExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ395

        2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.

        ToÿaddÿtheÿExcelÿExportÿcontrolÿusingÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿXlsExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿRTF

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic ProtectedÿSubÿPage_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMe.Load Dimÿm_streamÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptCustomRtf() rpt.Run() IfÿMe.rtfExport1ÿIsÿNothingÿThen Me.rtfExport1ÿ=ÿNewÿDataDynamics.ActiveReports.Export.Rtf.RtfExport EndÿIf Me.rtfExport1.Export(rpt.Document,ÿm_stream) m_stream.Positionÿ=ÿ0 Response.ContentTypeÿ=ÿ"application/msword" Response.AddHeader("content-disposition",ÿ"inline;ÿfilename=MyExport.rtf") Response.BinaryWrite(m_stream.ToArray()) Response.End() EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿm_streamÿ=ÿnewÿSystem.IO.MemoryStream(); rptCustomRtfÿrptÿ=ÿnewÿrptCustomRtf(); rpt.Run(); ifÿ(this.rtfExport1ÿ==ÿnull)ÿ {ÿ this.rtfExport1ÿ=ÿnewÿDataDynamics.ActiveReports.Export.Rtf.RtfExport();ÿ }ÿ this.rtfExport1.Export(rpt.Document,ÿm_stream); m_stream.Positionÿ=ÿ0; Response.ContentTypeÿ=ÿ"application/msword"; Response.AddHeader("content-disposition","inline;ÿfilename=MyExport.rtf"); Response.BinaryWrite(m_stream.ToArray()); Response.End();

        }ÿ ToÿviewÿtheÿresultsÿinÿyourÿWebÿbrowser,ÿrunÿtheÿprojectÿandÿclickÿtheÿOpen buttonÿwhenÿprompted.

        CustomÿExportingÿwithÿPlainÿText

        ActiveReportsÿprovidesÿcustomÿcomponentsÿforÿseveralÿformats,ÿincludingÿPDF,ÿHTML,ÿRTF,ÿTIFF,ÿExcelÿandÿ plainÿtext.ÿUltimateÿcustomizabilityÿisÿavailableÿbyÿusingÿanyÿASP.NETÿlanguage.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿupÿcustomÿexportingÿinÿplainÿtextÿ format. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ396

        Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿTextÿexportÿcontrolÿtoÿtheÿWebÿFormÿ

        l AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿTextÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserverÿ andÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿ menuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿinÿcomma-delimitedÿtextÿformatÿthatÿlooksÿ similarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomText.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ397

        3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomText.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder. Note: ToÿseeÿtheÿdesignÿviewÿofÿyourÿreportÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿorderÿbyÿcategoryID".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptExcel.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID 3. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Name Text Location

        lblProductID ProductÿIDÿ 0,ÿ0ÿ

        lblProductName ProductÿNameÿ 1.06,ÿ0ÿ

        lblUnitsInStock UnitsÿInÿStockÿ 3.5,ÿ0ÿ

        lblUnitsOnOrder UnitsÿOnÿOrderÿ 4.56,ÿ0ÿ

        lblUnitPrice UnitÿPriceÿ 5.7,ÿ0ÿ

        4. Makeÿtheÿfollowingÿchangesÿtoÿtheÿdetailÿsection:ÿ ¡ ChangeÿtheÿCanShrink propertyÿtoÿTrue 5. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ theÿdetailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        DataField Text Location OutputÿFormat

        ProductID ProductÿID 0,ÿ0 NA

        ProductName ProductÿName 1.06,ÿ0 NA

        UnitsInStock UnitsÿInÿStock 3.5,ÿ0 NA

        UnitsOnOrder UnitsÿOnÿOrder 4.56,ÿ0 NA

        UnitPrice UnitÿPrice 5.7,ÿ0 Currency

        AddingÿtheÿTextÿExportÿcontrolÿtoÿtheÿWebÿForm

        ToÿaddÿtheÿTextÿExportÿcontrolÿusingÿVisualÿStudioÿ2003 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ398

        1. ClickÿonÿtheÿTextExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 2. DragÿtheÿcontrolÿontoÿtheÿWebÿForm.ÿ 3. TheÿcontrolÿappearsÿinÿtheÿtrayÿbeneathÿtheÿWebForm.

        ToÿaddÿtheÿTextÿExportÿcontrolÿusingÿVisualÿStudioÿ2005 1. FromÿtheÿView menu,ÿselectÿComponentÿDesigner toÿgoÿtoÿtheÿdesignÿviewÿofÿtheÿaspxÿfile.ÿ 2. ClickÿonÿtheÿTextExportÿcontrolÿinÿtheÿappropriateÿtoolboxÿtoÿselectÿit.ÿ(SeeÿAddingÿActiveReportsÿ controls forÿhelpÿonÿaddingÿitÿtoÿtheÿtoolbox.)ÿ 3. Dragÿtheÿcontrolÿontoÿtheÿaspxÿdesignÿview.ÿ

        AddingÿcodeÿtoÿtheÿWebÿFormÿtoÿexportÿtoÿText

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿWebÿForm'sÿPage_Loadÿ event.ÿAddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿonÿtheÿWebÿForm.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿWebÿForm'sÿPage_Loadÿevent.ÿ AddÿtheÿfollowingÿcodeÿtoÿtheÿPage_Loadÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'ÿVisualÿBasic ProtectedÿSubÿPage_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿHandlesÿMe.Load Dimÿm_streamÿAsÿNewÿSystem.IO.MemoryStream() DimÿrptÿAsÿNewÿrptCustomText() rpt.Run() IfÿMe.textExport1ÿIsÿNothingÿThen Me.textExport1ÿ=ÿNewÿDataDynamics.ActiveReports.Export.Text.TextExport EndÿIf Me.textExport1.Export(rpt.Document,ÿm_stream) m_stream.Positionÿ=ÿ0 Response.ContentTypeÿ=ÿ"text/plain" Response.BinaryWrite(m_stream.ToArray()) Response.End() EndÿSub //C# privateÿvoidÿPage_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.IO.MemoryStreamÿm_streamÿ=ÿnewÿSystem.IO.MemoryStream(); rptCustomTextÿrptÿ=ÿnewÿrptCustomText(); rpt.Run(); ifÿ(this.textExport1ÿ==ÿnull)ÿ {ÿ this.textExport1ÿ=ÿnewÿDataDynamics.ActiveReports.Export.Text.TextExport();ÿ }ÿ this.textExport1.Export(rpt.Document,ÿm_stream); m_stream.Positionÿ=ÿ0; Response.ContentTypeÿ=ÿ"text/plain"; Response.BinaryWrite(m_stream.ToArray()); Response.End();

        }ÿ ToÿviewÿtheÿresultsÿinÿyourÿWebÿbrowser,ÿrunÿtheÿproject.

        WebÿDeployment

        FollowÿthisÿguideÿtoÿdeployÿActiveReportsÿWebÿprojectsÿtoÿyourÿWebÿserver.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿreferencedÿDLLsÿtoÿyourÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ399

        l Installingÿprerequisitesÿonÿtheÿserverÿ l Copyingÿyourÿprojectÿtoÿtheÿserverÿ

        l Settingÿpermissionsÿonÿtheÿserver Toÿcompleteÿthisÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿMicrosoftÿ.NETÿFrameworkÿversionÿ1.1ÿSPÿ1,ÿorÿ 2.0ÿandÿtheÿcoordinatingÿversionÿofÿASP.NET.ÿYouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿ versionÿ5.1ÿorÿ6.0,ÿandÿyouÿneedÿadministrativeÿaccessÿtoÿtheÿserver.ÿForÿexamplesÿofÿhowÿtoÿcreateÿ ActiveReportsÿWebÿprojects,ÿseeÿtheÿwalkthroughsÿlinkedÿatÿtheÿbottomÿofÿthisÿtopic.ÿ

        AddingÿreferencedÿDLLsÿtoÿyourÿproject

        ToÿaddÿreferencedÿDLLsÿtoÿyourÿVisualÿStudioÿ2003ÿproject 1. OpenÿanÿActiveReportsÿWebÿapplicationÿinÿVisualÿStudio.ÿ 2. InÿtheÿSolutionÿExplorer,ÿexpandÿtheÿReferencesÿandÿselectÿtheÿActiveReportsÿreference.ÿ 3. InÿtheÿPropertiesÿgrid,ÿchangeÿtheÿCopyÿLocalÿpropertyÿtoÿTrue.ÿ(Thisÿensuresÿthatÿtheÿcopyÿofÿtheÿdllÿyouÿ areÿreferencingÿstaysÿwithÿtheÿproject.)ÿ 4. Repeatÿstepsÿ2ÿandÿ3ÿforÿeachÿActiveReportsÿreference.ÿ 5. FromÿtheÿBuildÿmenu,ÿselectÿBuildÿSolutionÿorÿRebuildÿSolution.ÿ(Ifÿyouÿleaveÿoutÿthisÿstep,ÿtheÿDLLsÿareÿ notÿaddedÿtoÿyourÿbinÿfolder.)

        ToÿaddÿreferencedÿDLLsÿtoÿyourÿVisualÿStudioÿ2005ÿproject 1. InÿWindowsÿExplorer,ÿnavigateÿtoÿtheÿActiveReportsÿDLLs.ÿByÿdefault,ÿtheseÿareÿinstalledÿinÿC:\Programÿ Files\CommonÿFiles\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0.ÿÿ 2. CopyÿanyÿDLLsÿusedÿbyÿyourÿproject.ÿ(Ifÿyouÿareÿunsureÿwhichÿareÿnecessary,ÿopenÿtheÿprojectÿandÿlookÿ inÿtheÿClassÿViewÿunderÿtheÿReferences node.)ÿ 3. PasteÿtheÿDLLsÿintoÿtheÿBinÿfolderÿofÿyourÿproject.ÿ 4. FromÿtheÿBuildÿmenu,ÿselectÿBuildÿSolutionÿorÿRebuildÿSolution.ÿ

        Installingÿprerequisitesÿonÿtheÿserver

        Toÿinstallÿprerequisitesÿonÿtheÿserver FollowÿMicrosoft'sÿinstructionsÿtoÿinstallÿeachÿofÿtheÿfollowingÿonÿyourÿWebÿserver:ÿ 1. TheÿMicrosoftÿ.NETÿFrameworkÿversionÿ1.1ÿSP1ÿorÿ2.0ÿ 2. InternetÿInformationÿServicesÿ(IIS)ÿversionÿ5.1ÿorÿ6.0ÿ 3. ASP.NETÿversionÿ1.1ÿSP1,ÿorÿ2.0ÿ(mustÿbeÿtheÿsameÿversionÿasÿtheÿFramework)

        Copyingÿyourÿprojectÿtoÿtheÿserver

        Toÿcopyÿyourÿprojectÿtoÿtheÿserver 1. Copyÿtheÿentireÿdirectoryÿcontainingÿyourÿprojectÿtoÿtheÿserver.ÿ 2. Ifÿyourÿprojectÿisÿinÿaÿvirtualÿdirectoryÿonÿyourÿlocalÿmachineÿ(i.e.ÿC:\Inetpub\wwwroot\YourProject),ÿyouÿ mustÿsetÿupÿaÿvirtualÿdirectoryÿinÿIISÿinÿtheÿserverÿasÿwell.

        Settingÿpermissionsÿonÿtheÿserver Dependingÿonÿyourÿproject,ÿyouÿmayÿneedÿtoÿsetÿpermissionsÿtoÿallowÿActiveReportsÿaccessÿtoÿdataÿorÿfolders.

        Someÿexamplesÿofÿrequiredÿpermissionsÿonÿtheÿserver 1. Ifÿyouÿareÿsavingÿfilesÿ(i.e.ÿPDFÿorÿRDF)ÿtoÿaÿfolderÿonÿWindowsÿXPÿorÿ2000ÿmachines,ÿtheÿASPNETÿuserÿIDÿ needsÿWriteÿaccessÿtoÿthatÿfolder.ÿForÿWindowsÿ2003,ÿit'sÿuserÿconfigurable,ÿsoÿyouÿneedÿtoÿfindÿtheÿnameÿ assignedÿtoÿtheÿASPNETÿuser.ÿ 2. Ifÿyouÿareÿreadingÿanythingÿfromÿanyÿfolder,ÿyouÿneedÿtoÿassignÿReadÿaccessÿtoÿit.ÿ

        3.ÿ Ifÿyourÿreportsÿrunÿonÿanyÿnetworkedÿdataÿsourceÿ(i.e.ÿSQL,ÿAccess,ÿetc.)ÿyouÿneedÿtoÿassignÿReadÿaccessÿ toÿit. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ400

        WebÿServicesÿWalkthroughs

        ActiveReportsÿprovidesÿsupportÿforÿwebÿservicesÿtoÿbeÿusedÿtoÿreturnÿaÿdatasetÿasÿaÿdataÿsourceÿforÿaÿreportÿ orÿtoÿreturnÿanÿActiveReportÿdocumentÿtoÿshowÿinÿaÿWindowsÿFormsÿviewer.ÿTheÿfollowingÿwalkthroughsÿshowÿ howÿtoÿcreateÿaÿsimpleÿwebÿserviceÿforÿeachÿscenarioÿandÿhowÿtoÿcreateÿaÿWindowsÿclientÿapplicationÿforÿeachÿ webÿservice. ÿ datasetÿWebÿService Describesÿhowÿtoÿsetÿupÿaÿsimpleÿwebÿserviceÿthatÿreturnsÿaÿdataset.ÿ datasetÿWindowsÿApplication DescribesÿhowÿtoÿsetÿupÿaÿWindowsÿclientÿapplicationÿforÿtheÿdatasetÿWebÿService.ÿ ÿ ActiveReportsÿDocumentÿWebÿService DescribesÿhowÿtoÿsetÿupÿaÿsimpleÿwebÿserviceÿthatÿreturnsÿanÿActiveReportsÿdocument.ÿ ActiveReportsÿDocumentÿWindowsÿApplication ÿ DescribesÿhowÿtoÿsetÿupÿaÿWindowsÿclientÿapplicationÿforÿtheÿActiveReportsÿDocumentÿWebÿService.ÿ

        DataSetÿWebÿService

        WithÿASP.NET,ÿitÿisÿeasyÿtoÿsetÿupÿaÿWebÿServiceÿthatÿreturnsÿaÿdatasetÿwhichÿyouÿcanÿuseÿasÿaÿdataÿsourceÿ forÿanÿActiveReport.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿServiceÿthatÿreturnsÿaÿdataset. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿanÿASP.NETÿWebÿServiceÿprojectÿ l AddingÿcodeÿtoÿcreateÿtheÿWebÿMethodÿ

        l TestingÿtheÿWebÿServiceÿ l PublishingÿtheÿWebÿService Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿcreatedÿaÿWebÿServiceÿthatÿreturnsÿaÿdatasetÿ whichÿcanÿbeÿusedÿasÿaÿdataÿsourceÿforÿanÿActiveReport.

        CreatingÿanÿASP.NETÿWebÿServiceÿproject

        ToÿcreateÿanÿASP.NETÿWebÿServiceÿprojectÿinÿVisualÿStudioÿ2003 1. FromÿtheÿFileÿmenu,ÿselect Newÿ>ÿProject. 2. InÿtheÿTemplatesÿwindowÿofÿtheÿNewÿProjectÿdialog,ÿselectÿASP.NETÿWebÿService.ÿ 3. ChangeÿtheÿnameÿofÿtheÿprojectÿfromÿWebService1 toÿDataSetWS.ÿ 4. ClickÿOK toÿopenÿtheÿnewÿprojectÿinÿVisualÿStudio.ÿÿ

        ToÿcreateÿanÿASP.NETÿWebÿServiceÿprojectÿinÿVisualÿStudioÿ2005 1. FromÿtheÿFileÿmenu,ÿselect Newÿ>ÿWebÿSite. 2. InÿtheÿTemplatesÿwindowÿofÿtheÿNewÿWebÿSiteÿdialog,ÿselectÿASP.NETÿWebÿService.ÿ 3. ChangeÿtheÿnameÿofÿtheÿprojectÿfromÿWebService1 toÿDataSetWS.ÿ 4. ClickÿOK toÿopenÿtheÿnewÿprojectÿinÿVisualÿStudio.ÿ

        AddingÿcodeÿtoÿcreateÿtheÿWebÿMethod ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ401

        ToÿwriteÿtheÿcodeÿtoÿcreateÿtheÿWebÿMethod l Right-clickÿonÿtheÿService1.asmxÿpageÿandÿselectÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿpage.ÿ(Inÿ VisualÿStudioÿ2005,ÿtheÿcodeÿviewÿdisplaysÿbyÿdefault.)ÿ l AddÿtheÿfollowingÿcodeÿunderÿtheÿWebÿServicesÿDesignerÿGeneratedÿCodeÿsectionÿtoÿcreateÿtheÿWebÿ Service.ÿ(InÿVisualÿStudioÿ2005,ÿjustÿreplaceÿtheÿexistingÿWebMethodÿandÿfunctionÿwithÿthisÿcode.) 'VisualÿBasic PrivateÿconnStringÿAsÿString 'Changeÿyourÿdataÿsourceÿpathÿasÿneeded ÿ_ PublicÿFunctionÿGetProduct()ÿAsÿData.DataSet connStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=C:/Northwind.mdb;ÿ_ PersistÿSecurityÿInfo=False" DimÿadapterÿAsÿNewÿData.OleDb.OleDbDataAdapter("selectÿ*ÿfromÿproducts",ÿconnString) DimÿdsÿAsÿNewÿData.DataSet() adapter.Fill(ds,ÿ"Products") Returnÿds EndÿFunction

        //C# //Changeÿyourÿdataÿsourceÿpathÿasÿneeded privateÿstaticÿstringÿconnStringÿ=ÿ"Provider=Microsoft.Jet.OLEDB.4.0;DataÿSource=ÿ C:/Northwind.mdb;PersistÿSecurityÿInfo=False"; [WebMethod(Description="ReturnsÿaÿDataSetÿcontainingÿallÿProducts")] publicÿData.DataSetÿGetProduct() { Data.OleDb.OleDbDataAdapterÿadapter; Data.DataSetÿds; adapterÿ=ÿnewÿData.OleDb.OleDbDataAdapter("selectÿ*ÿfromÿproducts",ÿconnString); dsÿ=ÿnewÿData.DataSet(); adapter.Fill(ds,ÿ"Products"); returnÿds; }

        TestingÿtheÿWebÿService

        ToÿtestÿtheÿWebÿService 1. PressÿF5 toÿrunÿtheÿproject.ÿÿ 2. Clickÿ"GetProduct"ÿinÿtheÿlistÿofÿsupportedÿoperations.ÿ 3. ClickÿtheÿInvoke buttonÿtoÿtestÿtheÿWebÿServiceÿoperation.ÿ 4. Ifÿtheÿtestÿisÿsuccessful,ÿyouÿwillÿseeÿaÿvalidÿXMLÿschemaÿofÿtheÿNorthwindÿproductsÿtable.ÿ

        PublishingÿtheÿWebÿService

        ToÿpublishÿtheÿWebÿService 1. InÿtheÿSolutionÿExplorer,ÿright-clickÿtheÿprojectÿnameÿandÿselectÿPublishÿWebÿSite.ÿÿ

        2.ÿ ClickÿtheÿOK button.ÿ 3. ThisÿmakesÿtheÿWebÿServiceÿavailableÿforÿconsumptionÿbyÿotherÿprojects.ÿ

        DataSetÿWindowsÿApplication

        InÿActiveReportsÿforÿ.NETÿ3.0,ÿyouÿcanÿuseÿaÿWebÿServiceÿthatÿreturnsÿaÿdatasetÿasÿtheÿdataÿsourceÿforÿyourÿ reports.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿWindowsÿclientÿapplicationÿthatÿusesÿtheÿdatasetÿWebÿServiceÿasÿ theÿdataÿsourceÿforÿanÿActiveReport. ThisÿwalkthroughÿbuildsÿonÿtheÿdatasetÿWebÿServiceÿwalkthroughÿandÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿprojectÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ402

        l Addingÿcontrolsÿtoÿeachÿreportÿtoÿdisplayÿtheÿdataÿ l Addingÿaÿwebÿreferenceÿtoÿtheÿprojectÿÿ

        l Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿreportÿdatasetÿandÿdataÿmemberÿtoÿtheÿdatasetÿandÿdataÿmemberÿ returnedÿbyÿtheÿWebÿServiceÿ

        l Viewingÿtheÿreportÿÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿnewÿprojectÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptProducts.ÿ 4. ClickÿOpen (orÿAdd inÿVisualÿStudioÿ2005).ÿ

        Addingÿcontrolsÿtoÿdisplayÿtheÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreports 1. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿDetailÿsectionÿofÿrptProducts,ÿsettingÿtheirÿpropertiesÿasÿindicated:ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ403

        Control DataField Name Text Miscellaneousÿ Location

        Textbox ProductNameÿ txtProductName Productÿ Sizeÿ=ÿ2.9,ÿ0.19 0,ÿ0ÿ Nameÿ

        Textbox UnitPriceÿ txtUnitPrice UnitÿPriceÿ OutputFormatÿ=ÿ 3,ÿ0ÿ Currencyÿ

        2. SetÿtheÿCanShrink propertyÿofÿtheÿDetailÿsectionÿtoÿTrue.ÿ

        Addingÿaÿwebÿreferenceÿtoÿtheÿproject

        Toÿaddÿaÿwebÿreference 1. FromÿtheÿProjectÿmenu,ÿselect AddÿWebÿReference.ÿ 2. Typeÿinÿtheÿaddressÿofÿtheÿ.asmxÿfileÿforÿtheÿdatasetÿWebÿServiceÿyouÿcreatedÿinÿtheÿpreviousÿ walkthrough.ÿYouÿcanÿgetÿtheÿaddressÿbyÿrunningÿtheÿprojectÿfromÿtheÿpreviousÿwalkthroughÿandÿcopyingÿ theÿurlÿfromÿtheÿaddressÿinÿtheÿbrowser.ÿ(Itÿwillÿlookÿsomethingÿlikeÿ http://localhost:####/DataSetWS/Service.asmxÿ(http://localhost:/) whereÿ####ÿisÿtheÿportÿ number.)ÿÿ 3. ClickÿtheÿGo button,ÿandÿthenÿclickÿtheÿAddÿReference buttonÿwhenÿtheÿWebÿServiceÿisÿrecognized.ÿ

        Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿreport'sÿdataÿsourceÿcontrolÿequalÿtoÿtheÿ datasetÿreturnedÿbyÿDataSetWS

        ToÿwriteÿtheÿcodeÿinÿVisualÿStudioÿ2003

        l Double-clickÿtheÿgrayÿareaÿbelowÿrptProducts.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptProducts'ÿReportStartÿevent.ÿ

        l Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike.ÿ 'VisualÿBasic PrivateÿSubÿrptProducts_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart DimÿrptÿAsÿNewÿrptProducts() DimÿwsÿAsÿNewÿlocalhost.DataSetWS() DimÿdsÿAsÿNewÿDataSet() dsÿ=ÿws.GetProduct() Me.DataSourceÿ=ÿds Me.DataMemberÿ=ÿ"Products" EndÿSub ÿ //C# privateÿvoidÿrptProducts_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptProductsÿrptÿ=ÿnewÿrptProducts(); localhost.DataSetWSÿwsÿ=ÿnewÿlocalhost.DataSetWS(); DataSetÿdsÿ=ÿws.GetProduct();ÿ this.DataSourceÿ=ÿds; this.DataMemberÿ=ÿ"Products"; }

        ToÿwriteÿtheÿcodeÿinÿVisualÿStudioÿ2005 l Double-clickÿtheÿgrayÿareaÿbelowÿrptProducts.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿ rptProducts'ÿReportStartÿevent.ÿ l Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿrptProducts_ReportStart(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.ReportStart DimÿrptÿAsÿNewÿrptProducts() DimÿwsÿAsÿNewÿlocalhost.Service DimÿdsÿAsÿNewÿDataSet() dsÿ=ÿws.GetProduct() Me.DataSourceÿ=ÿds ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ404

        Me.DataMemberÿ=ÿ"Products" EndÿSub ÿ //C# privateÿvoidÿrptProducts_ReportStart(objectÿsender,ÿSystem.EventArgsÿeArgs) { rptProductsÿrptÿ=ÿnewÿrptProducts(); localhost.DataSetWSÿwsÿ=ÿnewÿlocalhost.Service; DataSetÿdsÿ=ÿws.GetProduct();ÿ this.DataSourceÿ=ÿds; this.DataMemberÿ=ÿ"Products"; }

        Viewingÿtheÿreport

        Toÿviewÿtheÿreport 1. AddÿtheÿActiveReportsÿviewerÿcontrolÿtoÿaÿWindowsÿForm.ÿ 2. Addÿtheÿcodeÿneededÿtoÿsetÿtheÿviewerÿdocumentÿequalÿtoÿtheÿreportÿdocument.ÿSeeÿUsingÿtheÿ ActiveReportsÿWinFormÿViewer forÿhelp.ÿ

        Note:ÿ YouÿcanÿquicklyÿviewÿyourÿreportÿatÿdesignÿtimeÿbyÿclickingÿtheÿPreview tabÿatÿtheÿbottomÿofÿtheÿ designer.

        ActiveReportsÿDocumentÿWebÿService

        WithÿASP.NETÿandÿActiveReports,ÿyouÿcanÿsetÿupÿaÿWebÿServiceÿthatÿreturnsÿaÿreportÿdocumentÿwhichÿcanÿ beÿshownÿinÿaÿreportÿviewerÿcontrol.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿWebÿServiceÿthatÿreturnsÿtheÿcontentsÿofÿanÿActiveReportÿasÿaÿ byteÿarray. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿanÿASP.NETÿWebÿServiceÿprojectÿ

        l AddingÿanÿActiveReportÿtoÿtheÿprojectÿ l Connectingÿtheÿdataÿsourceÿtoÿaÿdatabaseÿ l Addingÿcontrolsÿtoÿcontainÿtheÿdataÿ

        l AddingÿcodeÿtoÿcreateÿtheÿWebÿMethodÿ l TestingÿtheÿWebÿServiceÿ

        l PublishingÿtheÿWebÿService Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿwillÿalsoÿneedÿtoÿaddÿaÿreferenceÿtoÿyourÿprojectÿtoÿtheÿSystem.Data.OleDbÿnamespace. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿcreatedÿaÿWebÿServiceÿthatÿreturnsÿtheÿcontentsÿofÿ anÿActiveReportÿasÿaÿbyteÿarray.

        CreatingÿanÿASP.NETÿWebÿServiceÿproject

        ToÿcreateÿanÿASP.NETÿWebÿServiceÿprojectÿinÿVisualÿStudioÿ2003 1. FromÿtheÿFileÿmenu,ÿselect Newÿ>ÿProject. 2. InÿtheÿTemplatesÿwindowÿofÿtheÿNewÿProjectÿdialog,ÿselectÿASP.NETÿWebÿService.ÿ 3. ChangeÿtheÿnameÿofÿtheÿprojectÿfromÿWebService1 toÿARDocumentWS.ÿ 4. ClickÿOK toÿopenÿtheÿnewÿprojectÿinÿVisualÿStudio.ÿÿ

        ToÿcreateÿanÿASP.NETÿWebÿServiceÿprojectÿinÿVisualÿStudioÿ2005 ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ405

        1. FromÿtheÿFileÿmenu,ÿselect Newÿ>ÿWebÿSite. 2. InÿtheÿTemplatesÿwindowÿofÿtheÿNewÿWebÿSiteÿdialog,ÿselectÿASP.NETÿWebÿService.ÿ 3. ChangeÿtheÿnameÿofÿtheÿprojectÿfromÿWebService1 toÿARDocumentWS.ÿ 4. ClickÿOK toÿopenÿtheÿnewÿprojectÿinÿVisualÿStudio.ÿ

        AddingÿanÿActiveReportÿtoÿtheÿVisualÿStudioÿproject

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. FromÿtheÿProject menuÿ(orÿWebsite menuÿinÿVisualÿStudioÿ2005),ÿselectÿAddÿNewÿItem. 2. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptProducts.ÿ 3. ClickÿOpen (orÿAdd inÿVisualÿStudioÿ2005). Note:ÿToÿseeÿtheÿreportÿdesignÿsurfaceÿinÿVisualÿStudioÿ2005,ÿright-clickÿtheÿreportÿinÿtheÿSolutionÿ ExplorerÿandÿselectÿViewÿDesigner.

        Connectingÿtheÿdataÿsourceÿtoÿaÿdatabase

        Toÿconnectÿtheÿdataÿsourceÿtoÿaÿdatabase 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿBuild. 3. Selectÿ"MicrosoftÿJetÿ4.0ÿOLEÿDBÿProvider"ÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. Inÿthe Queryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿinnerÿjoinÿcategoriesÿonÿproducts.categoryidÿ=ÿ categories.categoryidÿorderÿbyÿcategoryname".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptProducts.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿName propertyÿtoÿghCategories ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryName ¡ ChangeÿtheÿBackColor propertyÿtoÿLightGray 3. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿ ghCategoriesÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿ

        Field Text Location Miscellaneous

        CategoryNameÿ CategoryNameÿ 1.75,ÿ0ÿÿ Fontÿsizeÿ=ÿ14;ÿForeColorÿ=ÿDarkGreen

        4. AddÿaÿsecondÿGroupHeader/FooterÿsectionÿtoÿrptProductsÿtoÿcontainÿlabels.ÿ 5. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿName propertyÿtoÿghProductsÿ

        ¡ ChangeÿtheÿBackColor propertyÿtoÿWhiteSmoke ÿ 6. AddÿlabelsÿwithÿtheÿfollowingÿpropertiesÿtoÿghProducts:ÿ

        Name Text Location

        lblProductName ÿ ProductÿNameÿ 0,ÿ0ÿÿ

        lblUnitPrice UnitÿPriceÿ 2.38,ÿ0ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ406

        lblUnitsInStock UnitsÿinÿStockÿ 3.94,ÿ0ÿ

        lblUnitsOnOrder UnitsÿonÿOrderÿ 5.13,ÿ0ÿ

        7. SetÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.ÿ 8. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿpropertiesÿasÿindicated.ÿÿ

        Field Text Miscellaneous Location

        ProductName ProductÿName Sizeÿ=ÿ2.25,ÿ0,19 0,ÿ0

        UnitPrice UnitÿPrice OutputFormatÿ=ÿCurrency 2.38,ÿ0

        UnitsInStock UnitsÿInÿStock Alignmentÿ=ÿRight 3.94,ÿ0

        UnitsOnOrder UnitsÿOnÿOrder Alignmentÿ=ÿRight 5.13,ÿ0

        AddingÿcodeÿtoÿcreateÿtheÿWebÿMethod

        ToÿwriteÿtheÿcodeÿtoÿcreateÿtheÿWebÿMethod

        l Right-clickÿonÿtheÿService1.asmxÿpageÿandÿselectÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿpageÿ (displayedÿbyÿdefaultÿinÿVisualÿStudioÿ2005).ÿ

        l AddÿtheÿfollowingÿcodeÿunderÿtheÿWebÿServicesÿDesignerÿGeneratedÿCodeÿsectionÿtoÿcreateÿtheÿWebÿ Service.ÿ(InÿVisualÿStudioÿ2005,ÿreplaceÿtheÿexistingÿWebMethodÿandÿfunctionÿwithÿthisÿcode.) 'ÿVisualÿBasic

        ÿ_ PublicÿFunctionÿGetProductsReport()ÿAsÿByte() DimÿrptÿAsÿNewÿrptProducts() rpt.Run() Returnÿrpt.Document.Content EndÿFunction //C#

        [WebMethod(Description="Returnsÿaÿproductsÿreportÿgroupedÿbyÿcategory")] publicÿByte[]ÿGetProductsReport() { rptProductsÿrptÿ=ÿnewÿrptProducts(); rpt.Run(); returnÿrpt.Document.Content; }

        TestingÿtheÿWebÿService

        ToÿtestÿtheÿWebÿService 1. PressÿF5 toÿrunÿtheÿproject.ÿÿ 2. Clickÿ"GetProductsReport"ÿinÿtheÿlistÿofÿsupportedÿoperations.ÿ 3. ClickÿtheÿInvoke buttonÿtoÿtestÿtheÿWebÿServiceÿoperation.ÿ 4. Ifÿtheÿtestÿisÿsuccessful,ÿyouÿwillÿseeÿtheÿbinaryÿversionÿofÿtheÿcontentsÿofÿrptProducts.ÿ

        PublishingÿtheÿWebÿService

        ToÿpublishÿtheÿWebÿService 1. InÿtheÿSolutionÿExplorer,ÿright-clickÿtheÿprojectÿnameÿandÿselectÿPublishÿWebÿSite.ÿÿ

        2.ÿ ClickÿtheÿOK button.ÿ 3. ThisÿmakesÿtheÿWebÿServiceÿavailableÿforÿconsumptionÿbyÿotherÿprojects.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ407

        ActiveReportsÿDocumentÿWindowsÿApplication

        InÿActiveReportsÿforÿ.NETÿ3.0,ÿyouÿcanÿuseÿaÿWebÿServiceÿthatÿreturnsÿtheÿcontentÿofÿanÿActiveReportÿtoÿshowÿ inÿtheÿWindowsÿFormsÿviewerÿcontrol.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿWindowsÿclientÿapplicationÿthatÿreturnsÿtheÿcontentÿofÿanÿ ActiveReportÿinÿtheÿWindowsÿFormsÿviewer. ThisÿwalkthroughÿbuildsÿonÿtheÿActiveReportsÿDocumentÿWebÿServiceÿwalkthroughÿandÿisÿsplitÿupÿintoÿtheÿ followingÿactivities:ÿ l CreatingÿaÿVisualÿStudioÿprojectÿ

        l AddingÿtheÿActiveReportsÿWindowsÿFormsÿviewerÿcontrolÿtoÿtheÿprojectÿ

        l Addingÿaÿwebÿreferenceÿtoÿtheÿprojectÿÿ l Addingÿtheÿcodeÿtoÿsetÿtheÿviewer'sÿdocumentÿpropertyÿtoÿtheÿcontentÿreturnedÿbyÿtheÿActiveReportsÿ DocumentÿWebÿServiceÿ l Runningÿtheÿprojectÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        CreatingÿaÿVisualÿStudioÿproject ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ408

        ToÿcreateÿaÿVisualÿStudioÿproject 1. FromÿtheÿFileÿmenu,ÿselect Newÿ>ÿProject. 2. SelectÿWindowsÿApplication inÿtheÿTemplates windowÿofÿtheÿNewÿProject dialog.ÿ 3. ChangeÿtheÿnameÿofÿtheÿapplicationÿtoÿARDocumentClient.ÿ 4. ClickÿOK toÿopenÿtheÿproject.ÿ

        AddingÿtheÿActiveReportsÿviewerÿcontrolÿtoÿtheÿWindowsÿForm

        ToÿaddÿtheÿActiveReportsÿviewerÿcontrol 1. DragÿandÿdropÿtheÿActiveReportsÿviewerÿcontrolÿfromÿtheÿappropriateÿtoolboxÿtoÿtheÿWindowsÿForm.ÿ 2. ChangeÿtheÿDock propertyÿforÿtheÿviewerÿcontrolÿto Fill.ÿ

        Addingÿaÿwebÿreferenceÿtoÿtheÿproject

        Toÿaddÿaÿwebÿreference 1. FromÿtheÿProject menu,ÿselectÿAddÿWebÿReference.ÿ 2. Typeÿinÿtheÿaddressÿofÿtheÿ.asmxÿfileÿforÿtheÿActiveReportsÿDocumentÿWebÿServiceÿyouÿcreatedÿinÿtheÿ previousÿwalkthrough.ÿTheÿaddressÿshouldÿbeÿsimilarÿtoÿhttp://localhost/ARDocumentWS/Service1.asmx.ÿ 3. ClickÿtheÿAddÿReference buttonÿwhenÿtheÿWebÿServiceÿisÿrecognized.ÿ

        Addingÿtheÿcodeÿneededÿtoÿsetÿtheÿviewer'sÿdocumentÿpropertyÿtoÿtheÿcontentÿ returnedÿbyÿtheÿActiveReportsÿDocumentÿWebÿServiceÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿStudioÿ2003 l Double-clickÿonÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿ

        l Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿwsÿAsÿNewÿlocalhost.ARDocumentWS() Me.Viewer1.Document.Contentÿ=ÿws.GetProductsReport() EndÿSub ÿ //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { localhost.ARDocumentWSvbÿwsÿ=ÿnewÿlocalhost.ARDocumentWSvb(); this.viewer1.Document.Contentÿ=ÿws.GetProductsReport(); }

        ToÿwriteÿtheÿcodeÿinÿVisualÿStudioÿ2005 l Double-clickÿonÿForm1ÿtoÿcreateÿanÿevent-handlingÿmethodÿforÿtheÿForm1_Loadÿevent.ÿ

        l Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿForm1_Load(ByValÿsenderÿAsÿSystem.Object,ÿByValÿeÿAsÿSystem.EventArgs)ÿ_ HandlesÿMyBase.Load DimÿwsÿAsÿNewÿlocalhost.Service Me.Viewer1.Document.Contentÿ=ÿws.GetProductsReport() EndÿSub ÿ //C# privateÿvoidÿForm1_Load(objectÿsender,ÿSystem.EventArgsÿe) { localhost.Serviceÿwsÿ=ÿnewÿlocalhost.Service(); this.viewer1.Document.Contentÿ=ÿws.GetProductsReport(); ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ409

        }

        Runningÿtheÿproject

        ÿ Toÿrunÿtheÿproject ¡ PressÿF5 toÿrunÿtheÿproject.ÿ

        ProfessionalÿEditionÿWalkthroughs

        ActiveReportsÿforÿ.NETÿ3.0ÿProfessionalÿEditionÿallowsÿdevelopersÿtoÿcreateÿandÿdeployÿcustomÿreportÿ designersÿandÿcontrolsÿonÿtheÿweb.ÿTheÿfollowingÿwalkthroughsÿdemonstrateÿhowÿeffectivelyÿtoÿuseÿspecificÿ featuresÿofÿtheÿProfessionalÿEdition.

        Inÿthisÿsection CreatingÿanÿEnd-UserÿReportÿDesigner DescribesÿhowÿtoÿcreateÿanÿEnd-UserÿReportÿDesigner.ÿ DeployingÿActiveReportsÿWebÿApplications DescribesÿhowÿtoÿdeployÿActiveReportsÿwebÿapplications.ÿ ConfiguringÿtheÿHTTPÿHandlers DescribesÿhowÿtoÿconfigureÿtheÿHTTPÿHandlers.ÿ HTTPÿHandlers DescribesÿhowÿtoÿuseÿActiveReportsÿHTTPÿHandlers.ÿ ParametersÿandÿHTTPÿHandlers DescribesÿhowÿtoÿuseÿparametersÿwithÿHTTPÿHandlers.ÿ ProÿEditionÿLocalizationÿWalkthroughs Describesÿhowÿtoÿlocalizeÿtheÿdesignerÿandÿwebÿviewerÿcontrols.ÿ WebÿViewerÿControl ÿ DescribesÿhowÿtoÿuseÿtheÿActiveReportsÿwebÿviewerÿcontrol.ÿ

        CreatingÿanÿEnd-UserÿReportÿDesignerÿWalkthroughs

        ActiveReportsÿallowsÿyouÿtoÿhostÿtheÿActiveReportsÿEnd-UserÿReportÿDesigner controlÿinÿyourÿapplicationÿandÿ provideÿend-userÿreportÿeditingÿcapabilities.ÿTheÿcontrol'sÿmethodsÿandÿpropertiesÿprovideÿeasyÿaccessÿtoÿ saveÿandÿloadÿreportÿlayouts,ÿmonitorÿandÿcontrolÿtheÿdesignÿenvironment,ÿandÿcustomizeÿtheÿlookÿandÿfeelÿtoÿ satisfyÿtheÿneedsÿofÿyourÿendÿusers. ÿ CreatingÿtheÿBasicÿLayoutÿforÿanÿEnd-UserÿReportÿDesigner Demonstratesÿhowÿtoÿsetÿupÿaÿbasicÿlayoutÿforÿtheÿend-userÿreportÿdesigner.ÿ AddingÿCodeÿforÿtheÿEnd-UserÿReportÿDesigner ÿ Demonstratesÿhowÿtoÿaddÿcodeÿtoÿcreateÿaÿworkingÿend-userÿreportÿdesigner.ÿ

        Walkthrough:ÿCreatingÿtheÿBasicÿLayoutÿforÿanÿEnd-UserÿReportÿ Designer

        ThisÿwalkthroughÿillustratesÿhowÿtoÿsetÿupÿaÿbasicÿlayoutÿofÿanÿEnd-UserÿReportÿDesigner onÿaÿWindowsÿForm. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿaÿWindowsÿFormÿtoÿaÿVisualÿStudioÿprojectÿ l Addingÿaÿstatusÿbar,ÿpanels,ÿandÿsplittersÿtoÿtheÿformÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ410

        l AddingÿtheÿReportÿExplorerÿtoÿtheÿformÿ l AddingÿtheÿPropertyÿGridÿtoÿtheÿformÿ

        l AddingÿtheÿActiveReportsÿend-userÿreportÿdesignerÿcontrolÿtoÿtheÿformÿ l AddingÿtheÿActiveReportsÿToolboxÿcomponentÿtoÿtheÿformÿ ÿ Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿbasicÿlayoutÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿaÿWindowsÿFormÿtoÿaÿVisualÿStudioÿproject

        ToÿaddÿaÿWindowsÿFormÿtoÿaÿVisualÿStudioÿproject 1. OpenÿaÿVisualÿStudioÿproject.ÿ 2. ClickÿonÿProject >ÿAddÿWindowsÿForm.ÿ 3. NameÿtheÿformÿformDesignerÿandÿclickÿOpen.ÿ 4. ResizeÿformDesignerÿtoÿtheÿdesiredÿheightÿandÿwidth.ÿ 5. ChangeÿtheÿtextÿforÿformDesignerÿtoÿ"ActiveReportsÿforÿ.NETÿ3.0ÿEnd-UserÿReportÿDesigner."ÿ

        Addingÿaÿstatusÿbar,ÿpanels,ÿandÿsplittersÿtoÿtheÿform

        Toÿaddÿaÿstatusÿbar,ÿpanels,ÿandÿsplittersÿtoÿtheÿform 1. Addÿaÿstatusÿbarÿtoÿtheÿform,ÿrenameÿitÿarStatus andÿsetÿtheÿText propertyÿtoÿanÿemptyÿstring.ÿÿ 2. Addÿaÿpanelÿtoÿtheÿform,ÿrenameÿitÿpnlToolbox andÿsetÿtheÿDock propertyÿtoÿLeft.ÿ 3. Addÿaÿsecondÿpanelÿtoÿtheÿform,ÿrenameÿitÿpnlProperties andÿsetÿtheÿDock propertyÿtoÿRight.ÿÿ

        ¡ AddÿaÿpanelÿtoÿpnlProperties,ÿrenameÿitÿpnlExplorer andÿsetÿtheÿDock propertyÿtoÿTop .ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ411

        ¡ AddÿaÿsecondÿpanelÿtoÿpnlProperties,ÿrenameÿitÿpnlPropertyGrid andÿsetÿtheÿDock propertyÿtoÿFill.ÿ 4. Addÿaÿsplitterÿtoÿtheÿform,ÿrenameÿitÿsplitterToolbox,ÿsetÿtheÿBorderStyle propertyÿtoÿ Fixed3D, andÿtheÿDock propertyÿto Left.ÿ 5. Addÿaÿsecondÿsplitterÿtoÿtheÿform,ÿrenameÿitÿtoÿsplitterProperties,ÿsetÿtheÿBorderStyle propertyÿtoÿ Fixed3D,ÿandÿtheÿDock propertyÿto Right.

        AddingÿtheÿReportÿExplorerÿtoÿtheÿform

        ToÿaddÿtheÿReportÿExplorer 1. SelectÿtheÿReportExplorerÿcontrolÿfromÿtheÿActiveReportsÿtoolboxÿtabÿandÿdragÿitÿontoÿpnlExplorer.ÿ 2. ChangeÿtheÿName propertyÿtoÿarReportExplorer.ÿ 3. SetÿtheÿDock propertyÿtoÿFill.ÿÿ

        AddingÿtheÿPropertyÿGridÿtoÿtheÿform

        ToÿaddÿtheÿPropertyÿGrid 1. Right-clickÿonÿtheÿtoolboxÿwhereÿyouÿwishÿtoÿaddÿtheÿPropertyÿGridÿcontrol.ÿ 2. ClickÿonÿAdd/RemoveÿItems. InÿVisualÿStudioÿ2005ÿclickÿonÿChooseÿItems.ÿ 3. SelectÿtheÿPropertyGridÿcontrolÿfromÿtheÿ.NETÿFrameworkÿComponentsÿtabÿandÿclickÿOK .ÿ 4. DragÿtheÿPropertyGridÿcontrolÿfromÿtheÿtoolboxÿontoÿpnlPropertyGrid.ÿ 5. ChangeÿtheÿName propertyÿtoÿarPropertyGrid.ÿ 6. SetÿtheÿDock propertyÿtoÿFill.ÿ

        AddingÿtheÿActiveReportsÿend-userÿreportÿdesignerÿcontrolÿtoÿtheÿform

        Toÿaddÿtheÿcontrol 1. SelectÿtheÿDesignerÿcontrolÿfromÿtheÿActiveReportsÿtoolboxÿtabÿandÿdragÿitÿontoÿformDesigner.ÿ 2. ChangeÿtheÿName propertyÿtoÿarDesigner.ÿ 3. SetÿtheÿDock propertyÿtoÿFill.ÿ 4. SetÿtheÿPropertyGrid propertyÿtoÿarPropertyGrid.ÿ 5. ClickÿonÿarReportExplorerÿtoÿselectÿit.ÿSetÿthe ReportDesigner propertyÿtoÿarDesigner.

        AddingÿtheÿActiveReportsÿtoolboxÿcomponentÿtoÿtheÿform

        Toÿaddÿtheÿtoolboxÿcomponent 1. Right-clickÿonÿtheÿActiveReportsÿtabÿinÿtheÿtoolbox.ÿ 2. ClickÿonÿAdd/RemoveÿItems. InÿVisualÿStudioÿ2005ÿclickÿonÿChooseÿItems.ÿ 3. SelectÿtheÿToolboxÿcomponentÿcontrolÿfromÿtheÿ.NETÿFrameworkÿComponentsÿtabÿandÿclickÿOK.ÿ 4. DragÿtheÿToolboxÿcomponentÿfromÿtheÿActiveReportsÿtoolboxÿtabÿandÿdragÿitÿontoÿpnlToolbox.ÿ 5. ChangeÿtheÿName propertyÿtoÿarToolbox.ÿ 6. SetÿtheÿDock propertyÿtoÿFill.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ412

        ToÿcontinueÿcreatingÿtheÿEndÿ -UserÿReportÿDesigner,ÿpleaseÿseeÿtheÿnextÿwalkthrough,ÿAddingÿCodeÿforÿtheÿ End-UserÿReportÿDesigner.

        Walkthrough:ÿAddingÿCodeÿforÿtheÿEnd-UserÿReportÿDesigner

        Thisÿwalkthroughÿbuildsÿonÿtheÿstepsÿcompletedÿinÿtheÿpreviousÿwalkthrough,ÿCreatingÿtheÿBasicÿLayoutÿ forÿanÿEnd-UserÿReportÿDesigner,ÿandÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿImports/usingÿstatementsÿ l AddingÿcodeÿtoÿtheÿformDesigner_Loadÿeventÿtoÿsetÿtheÿdesigner'sÿtoolbox,ÿsetÿtheÿdesigner'sÿ CommandBarManager,ÿaddÿanÿExitÿcommandÿtoÿtheÿCommandBarManager,ÿandÿsetÿupÿtheÿstatusÿbar.ÿÿ l AddingÿcodeÿtoÿenableÿshortcutÿkeysÿtoÿworkÿwithÿtheÿCommandBarManagerÿÿ

        l AddingÿcodeÿtoÿcreateÿtheÿarDesigner_SelectionChangedÿeventÿtoÿdisplayÿtheÿcurrentÿobjectÿselectionÿinÿ theÿstatusÿbarÿ

        l Addingÿcodeÿtoÿcreateÿaÿdataÿtoolboxÿcategoryÿ l AddingÿcodeÿtoÿcloseÿtheÿEnd-UserÿReportÿDesignerÿwhenÿtheÿExitÿcommandÿisÿclickedÿonÿtheÿFileÿmenu Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿworkingÿend-userÿreportÿdesignerÿthatÿlooksÿlikeÿ theÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ413

        AddingÿImports/usingÿstatementsÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿImportsÿstatements.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿusingÿstatements.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿlooksÿlike. 'VisualÿBasic 'AddÿtheÿfollowingÿImportsÿstatements ImportsÿDataDynamics.ActiveReports ImportsÿDataDynamics.ActiveReports.Design ImportsÿDataDynamics.ActiveReports.Design.Toolbox

        //C# //Addÿtheÿfollowingÿusingÿstatementsÿ usingÿDataDynamics.ActiveReports; usingÿDataDynamics.ActiveReports.Design; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ414

        usingÿDataDynamics.ActiveReports.Design.Toolbox;

        AddingÿcodeÿtoÿtheÿformDesigner_Loadÿeventÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿtheÿtitleÿbarÿofÿtheÿformDesigner.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ formDesigner_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿÿ l Setÿtheÿdesigner'sÿtoolboxÿ

        l Setÿtheÿdesigner'sÿCommandBarManagerÿ l AddÿanÿExitÿcommandÿtoÿtheÿCommandBarManagerÿ

        l Setÿupÿtheÿdesigner'sÿstatusÿbar

        ToÿwriteÿtheÿcodeÿinÿC#

        l Double-clickÿtheÿtitleÿbarÿofÿtheÿformDesigner.ÿThisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿ formDesigner_Loadÿevent.ÿAddÿcodeÿtoÿtheÿhandlerÿto:ÿÿ

        l Setÿtheÿdesigner'sÿtoolboxÿ l Setÿtheÿdesigner'sÿCommandBarManagerÿ l AddÿanÿExitÿcommandÿtoÿtheÿCommandBarManagerÿ

        l Setÿupÿtheÿdesigner'sÿstatusÿbar Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic PrivateÿcommandBarManagerÿAsÿCommandBarManager PrivateÿSubÿformDesigner_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs) 'Setÿtheÿdesigner'sÿtoolboxÿtoÿarDesigner Me.arDesigner.Toolboxÿ=ÿMe.arToolbox ÿ 'SetÿtheÿCommandBarManagerÿofÿarDesignerÿtoÿcommandBarManager commandBarManagerÿ=ÿMe.arDesigner.CommandBarManager Me.Controls.Add(commandBarManager)ÿ

        'AddÿanÿExitÿcommandÿtoÿtheÿFileÿmenuÿofÿtheÿfirstÿcommandÿbarÿofÿtheÿCommandBarManager DimÿmenuÿAsÿCommandBarMenuÿ=ÿCType(Me.commandBarManager.CommandBars(0).Items(0),ÿCommandBarMenu) menu.Items.AddButton("Exit",ÿNewÿEventHandler(AddressOfÿOnExit)

        'Setÿupÿtheÿstatusÿbar Me.arStatus.Panels.Add(NewÿStatusBarPanel) Me.arStatus.Panels.Add(NewÿStatusBarPanel) Me.arStatus.Panels(0).AutoSizeÿ=ÿStatusBarPanelAutoSize.Spring Me.arStatus.Panels(1).AutoSizeÿ=ÿStatusBarPanelAutoSize.Spring Me.arStatus.ShowPanelsÿ=ÿTrue EndÿSubÿ

        //C# privateÿCommandBarManagerÿcommandBarManager; privateÿvoidÿformDesigner_Load(objectÿsender,ÿSystem.EventArgsÿe) { //Setÿtheÿdesigner'sÿtoolboxÿtoÿarToolbox this.arDesigner.Toolboxÿ=ÿthis.arToolbox;

        //SetÿtheÿCommandBarManagerÿofÿarDesignerÿtoÿcommandBarManager commandBarManagerÿ=ÿthis.arDesigner.CommandBarManager; this.Controls.Add(commandBarManager);

        //ÿAddÿanÿexitÿcommandÿtoÿtheÿFileÿmenuÿofÿtheÿfirstÿcommandÿbarÿofÿtheÿCommandBarManager CommandBarMenuÿmenuÿ=ÿthis.commandBarManager.CommandBars[0].Items[0]ÿasÿCommandBarMenu; menu.Items.AddButton("Exit",ÿnewÿEventHandler(OnExit),ÿ0);

        //SetÿupÿtheÿStatusÿBar this.arStatus.Panels.Add(newÿStatusBarPanel()); this.arStatus.Panels.Add(newÿStatusBarPanel()); this.arStatus.Panels[0].AutoSizeÿ=ÿStatusBarPanelAutoSize.Spring; ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ415

        this.arStatus.Panels[1].AutoSizeÿ=ÿStatusBarPanelAutoSize.Spring; this.arStatus.ShowPanelsÿ=ÿtrue; }

        AddingÿcodeÿtoÿenableÿshortcutÿkeysÿtoÿworkÿwithÿtheÿCommandBarManager

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿ formDesigner.ÿAddÿtheÿfollowingÿcode.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿ formDesigner.ÿAddÿtheÿfollowingÿcode.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿlooksÿlike. 'VisualÿBasic ProtectedÿOverridesÿFunctionÿProcessCmdKey(ByRefÿmsgÿAsÿMessage,ÿByValÿkeyDataÿAsÿKeys)ÿAsÿBoolean IfÿMe.arDesigner.FocusedÿThenÿ IfÿMe.arDesigner.CommandBarManager.PreProcessMessage(msg)ÿThen ReturnÿTrue EndÿIf EndÿIf ReturnÿMyBase.ProcessCmdKey(msg,ÿkeyData) EndÿFunction

        //C# protectedÿoverrideÿboolÿProcessCmdKey(refÿMessageÿmsg,ÿKeysÿkeyData) { if(this.arDesigner.CommandBarManager.PreProcessMessage(refÿmsg)); returnÿtrue; returnÿbase.ProcessCmdKey(refÿmsg,ÿkeyData); }

        AddingÿcodeÿtoÿtheÿDesigner1_SelectionChangedÿevent

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAtÿtheÿtopÿleftÿofÿtheÿcodeÿviewÿforÿformDesigner,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿ arDesigner.ÿAtÿtheÿtopÿrightÿofÿtheÿcodeÿwindow,ÿclickÿtheÿdrop-downÿarrowÿandÿselectÿSelectionChanged.ÿ Thisÿcreatesÿanÿevent-handlingÿmethodÿforÿtheÿarDesigner_SelectionChangedÿevent.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l ClickÿinÿtheÿdesignerÿwindowÿofÿformDesignerÿtoÿselectÿarDesigner.ÿClickÿonÿtheÿeventsÿiconÿinÿtheÿ Properties windowÿtoÿdisplayÿavailableÿeventsÿforÿtheÿsection.ÿDouble-clickÿSelectionChanged.ÿThisÿ createsÿanÿevent-handlingÿmethodÿforÿtheÿarDesigner_SelectionChangedÿevent.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿforÿtheÿmethodÿlooksÿlike. 'VisualÿBasic 'Thisÿwillÿdisplayÿtheÿcurrentÿselectionÿinÿtheÿdesigner'sÿstatusÿbar PrivateÿSubÿarDesigner_SelectionChanged()ÿHandlesÿarDesigner.SelectionChanged DimÿcurSelectionÿAsÿStringÿ=ÿ"" DimÿselectionEnumÿAsÿIEnumeratorÿ=ÿNothing IfÿNotÿ(arDesigner.SelectionÿIsÿNothing)ÿThen selectionEnumÿ=ÿarDesigner.Selection.GetEnumerator() EndÿIf WhileÿNotÿ(selectionEnumÿIsÿNothing)ÿAndAlsoÿselectionEnum.MoveNext() IfÿTypeOfÿselectionEnum.CurrentÿIsÿSectionÿThen curSelectionÿ=ÿcurSelectionÿ+ÿ(CType(selectionEnum.Current,ÿSection)).Nameÿ+ÿ",ÿ" EndÿIf IfÿTypeOfÿselectionEnum.CurrentÿIsÿARControlÿThen curSelectionÿ=ÿcurSelectionÿ+ÿ(CType(selectionEnum.Current,ÿARControl)).Nameÿ+ÿ",ÿ" EndÿIf IfÿTypeOfÿselectionEnum.CurrentÿIsÿFieldÿThen curSelectionÿ=ÿcurSelectionÿ+ÿ(CType(selectionEnum.Current,ÿField)).Nameÿ+ÿ",ÿ" ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ416

        EndÿIf IfÿTypeOfÿselectionEnum.CurrentÿIsÿParameterÿThen curSelectionÿ=ÿcurSelectionÿ+ÿ(CType(selectionEnum.Current,ÿParameter)).Keyÿ+ÿ",ÿ" EndÿIf IfÿTypeOfÿselectionEnum.CurrentÿIsÿActiveReport3ÿThen curSelectionÿ=ÿcurSelectionÿ+ÿ(CType(selectionEnum.Current,ÿActiveReport3)).Document.Nameÿ+ÿ",ÿ" EndÿIf EndÿWhile IfÿMe.arStatus.CreatedÿAndAlsoÿNotÿ(Me.arStatus.Panels(1)ÿIsÿNothing)ÿThen IfÿNotÿ(curSelectionÿ=ÿ"")ÿThen Me.arStatus.Panels(1).Textÿ=ÿ"CurrentÿSelection:ÿ"ÿ+ÿcurSelection.Substring(0,ÿcurSelection.Lengthÿ Else Me.arStatus.Panels(1).Textÿ=ÿ"NoÿSelection" EndÿIf EndÿIf EndÿSub ÿ //C# //Thisÿwillÿdisplayÿtheÿcurrentÿselectionÿinÿtheÿdesigner'sÿstatusÿbar privateÿvoidÿarDesigner_SelectionChanged() { stringÿcurSelectionÿ=ÿ""; IEnumeratorÿselectionEnumÿ=ÿnull; if(arDesigner.Selectionÿ!=ÿnull) selectionEnumÿ=ÿarDesigner.Selection.GetEnumerator(); while(selectionEnumÿ!=ÿnullÿ&&ÿselectionEnum.MoveNext()) { if(selectionEnum.CurrentÿisÿSection) curSelectionÿ=ÿcurSelectionÿ+ÿ(selectionEnum.CurrentÿasÿSection).Nameÿ+ÿ",ÿ"; if(selectionEnum.CurrentÿisÿARControl) curSelectionÿ=ÿcurSelectionÿ+ÿ(selectionEnum.CurrentÿasÿARControl).Nameÿ+ÿ",ÿ"; if(selectionEnum.CurrentÿisÿField) curSelectionÿ=ÿcurSelectionÿ+ÿ(selectionEnum.CurrentÿasÿField).Nameÿ+ÿ",ÿ"; if(selectionEnum.CurrentÿisÿParameter) curSelectionÿ=ÿcurSelectionÿ+ÿ(selectionEnum.CurrentÿasÿParameter).Keyÿ+ÿ",ÿ"; if(selectionEnum.CurrentÿisÿActiveReport3) curSelectionÿ=ÿcurSelectionÿ+ÿ(selectionEnum.CurrentÿasÿActiveReport3).Document.Nameÿ+ÿ",ÿ"; } if(this.arStatus.Createdÿ&&ÿthis.arStatus.Panels[1]ÿ!=ÿnull) { if(curSelectionÿ!=ÿ"") this.arStatus.Panels[1].Textÿ=ÿ"CurrentÿSelection:ÿ"ÿ+ÿcurSelection.Substring(0,ÿcurSelection.Lengthÿ else this.arStatus.Panels[1].Textÿ=ÿ"NoÿSelection"; } }

        Addingÿcodeÿtoÿcreateÿaÿdataÿtoolboxÿcategory

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic l Double-clickÿtheÿtitleÿbarÿofÿformDesignerÿtoÿgoÿtoÿtheÿloadÿeventÿofÿtheÿform.ÿAddÿtheÿfollowingÿcode.ÿ

        ToÿwriteÿtheÿcodeÿinÿC# l Double-clickÿtheÿtitleÿbarÿofÿformDesignerÿtoÿgoÿtoÿtheÿloadÿeventÿofÿtheÿform.ÿAddÿtheÿfollowingÿcode.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿformDesigner_Load(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs) Me.Close() EndÿSub

        //C# privateÿvoidÿformDesigner_Load(objectÿsender,ÿSystem.EventArgsÿe) { System.Drawing.Design.ToolboxItemÿtbItemDSÿ=ÿnewÿSystem.Drawing.Design.ToolboxItem(typeof(System.Data.DataSet)); System.Drawing.Design.ToolboxItemÿtbItemDAÿ=ÿnewÿSystem.Drawing.Design.ToolboxItem(typeof(System.Data.OleDb.OleDbDataReader)); this.arToolbox.AddToolboxItem(tbItemDS,ÿ"Data"); ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ417

        this.arToolbox.AddToolboxItem(tbItemDA,ÿ"Data"); }

        AddingÿcodeÿtoÿcloseÿtheÿEnd-UserÿReportÿDesignerÿwhenÿtheÿExitÿcommandÿisÿ clickedÿonÿtheÿFileÿmenuÿÿ

        ToÿwriteÿtheÿcodeÿinÿVisualÿBasic

        l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿcode.ÿ

        ToÿwriteÿtheÿcodeÿinÿC#

        l Right-clickÿinÿanyÿsectionÿofÿformDesigner,ÿandÿclickÿonÿViewÿCode toÿdisplayÿtheÿcodeÿviewÿforÿtheÿ WindowsÿForm.ÿAddÿtheÿfollowingÿcode.ÿ Theÿfollowingÿexampleÿshowsÿwhatÿtheÿcodeÿlooksÿlike. 'VisualÿBasic PrivateÿSubÿOnExit(ByValÿsenderÿAsÿObject,ÿByValÿeÿAsÿSystem.EventArgs) Me.Close() EndÿSub

        //C# privateÿvoidÿOnExit(objectÿsender,ÿSystem.EventArgsÿe) { ÿ this.Close(); }

        Walkthrough:ÿDeployingÿActiveReportsÿWebÿApplications

        WithÿActiveReportsÿforÿ.NETÿ3.0ÿProfessionalÿEdition,ÿWebÿapplicationsÿcanÿbeÿsetÿupÿforÿdeploymentÿbyÿ includingÿtheÿActiveReportsÿdeploymentÿ.msmÿfileÿinÿyourÿVisualÿStudioÿdeploymentÿproject.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿdeploymentÿprojectÿinÿActiveReportsÿforÿaÿWebÿapplication.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿinstallerÿprojectÿtoÿanÿexistingÿActiveReportsÿwebÿsolutionÿ

        l AddingÿtheÿActiveReportsÿ.msmÿfileÿ l AddingÿtheÿActiveReportsÿapplicationÿtoÿtheÿinstallerÿ l DeployingÿtheÿinstallerÿapplicationÿtoÿaÿWebÿserverÿÿ Note: InÿorderÿtoÿsuccessfullyÿdeployÿanÿActiveReportsÿWebÿproject,ÿtheÿserverÿmustÿhaveÿtheÿfollowingÿ installed.

        l Microsoftÿ.NETÿFrameworkÿVersionÿ1.1ÿSP1,ÿorÿ2.0ÿ l IISÿ(InternetÿInformationÿServices)ÿVersionÿ5.1ÿorÿ6.0ÿ

        l ASP.NETÿVersionÿ1.1ÿSP1,ÿorÿ2.0ÿ(mustÿbeÿtheÿsameÿversionÿasÿtheÿFramework)

        AddingÿanÿinstallerÿprojectÿtoÿanÿexistingÿActiveReportsÿproject

        Toÿaddÿtheÿinstallerÿproject 1. OpenÿanÿexistingÿActiveReportsÿWebÿprojectÿorÿcreateÿaÿnewÿone.ÿ 2. FromÿtheÿBuild menu,ÿselectÿBuildÿSolution toÿbuildÿyourÿreportÿproject.ÿ 3. Fromÿthe File menu,ÿselectÿAddÿ>ÿNewÿProject. 4. UnderÿProjectÿTypes inÿtheÿAddÿNewÿProject dialog,ÿexpandÿOtherÿProjectÿTypes andÿselectÿSetupÿ andÿDeploymentÿProjects.ÿ 5. InÿtheÿTemplatesÿwindow,ÿselectÿWebÿSetupÿProject,ÿrenameÿtheÿfileÿandÿclickÿOK.ÿ 6. FromÿtheÿSolutionÿExplorer,ÿselectÿtheÿInstallerÿproject.ÿInÿtheÿPropertiesÿwindow,ÿselectÿtheÿ ProductName propertyÿandÿtypeÿinÿtheÿnameÿofÿyourÿfile.ÿ Note: TheÿProductName propertyÿdeterminesÿtheÿnameÿthatÿisÿdisplayedÿforÿtheÿapplicationÿinÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ418

        folderÿnamesÿandÿinÿtheÿAdd/RemoveÿPrograms dialogÿbox.

        AddingÿtheÿActiveReportsÿ.msmÿfile

        ToÿaddÿtheÿActiveReportsÿ.msmÿfile 1. Right-clickÿonÿtheÿInstallerÿprojectÿinÿSolutionÿExplorer.ÿ 2. ClickÿonÿAdd andÿthenÿclickÿMergeÿModule. 3. OpenÿtheÿDeploymentÿfolderÿwhereÿActiveReportsÿforÿ.NETÿ3.0ÿisÿinstalledÿ(e.g.ÿC:\\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Deployment).ÿ 4. Clickÿonÿ"ActiveReportsDistrib.msm"ÿtoÿselectÿitÿandÿclickÿOpen.ÿ 5. ThisÿaddsÿallÿofÿtheÿActiveReportsÿdistributedÿassembliesÿtoÿyourÿwebÿproject.ÿ Note: SinceÿtheÿSetupÿandÿDeploymentÿprojectÿwillÿautomaticallyÿdetectÿandÿaddÿanyÿassemblyÿ dependenciesÿtoÿyourÿprojectÿandÿtheÿ.msmÿfileÿaddsÿallÿActiveReportsÿassemblies,ÿinÿVisualÿStudioÿ 2003ÿyouÿmustÿexcludeÿanyÿduplicateÿActiveReportsÿDLLsÿfromÿtheÿ"DetectedÿDependencies"ÿfolderÿinÿ theÿSolutionÿExplorerÿwindow.

        AddingÿtheÿActiveReportsÿapplicationÿtoÿtheÿinstaller

        ToÿaddÿtheÿActiveReportsÿapplication 1. SelectÿtheÿInstallerÿprojectÿinÿSolutionÿExplorer.ÿ 2. InÿtheÿFileÿSystemÿEditor,ÿchooseÿtheÿWebÿApplicationÿFolder.ÿ 3. FromÿtheÿAction menu,ÿselectÿAddÿ>ÿProjectÿOutput. 4. InÿtheÿAddÿProjectÿOutputÿGroup dialog,ÿchooseÿyourÿActiveReportsÿprojectÿnameÿfromÿtheÿdrop-downÿ list.ÿ 5. SelectÿPrimaryÿOutput andÿContentÿFiles fromÿtheÿlistÿandÿclickÿOK .ÿ(InÿVisualÿStudioÿ2005,ÿthereÿisÿnoÿ PrimaryÿOutput.)ÿ 6. InÿtheÿFileÿSystemÿEditor,ÿselectÿtheÿWebÿApplicationÿFolder.ÿInÿtheÿProperties window,ÿsetÿtheÿ VirtualDirectory propertyÿtoÿ"xyz".ÿ 7. InÿtheÿProperties window,ÿsetÿtheÿDefaultDocument propertyÿtoÿ"WebForm1.aspx".ÿÿ(Thisÿstepÿisÿ unnecessaryÿinÿVisualÿStudioÿ2005ÿasÿdefault.aspxÿisÿalreadyÿsetÿasÿtheÿdefaultÿdocument.)ÿ 8. OnÿtheÿBuild menu,ÿclickÿ"Buildÿ[yourÿInstallerÿprojectÿname]"ÿtoÿbuildÿyourÿInstallerÿproject.ÿ

        DeployingÿtheÿinstallerÿapplicationÿtoÿaÿWebÿserver

        Toÿdeployÿtheÿinstallerÿapplication 1. InÿSolutionÿExplorer,ÿselectÿtheÿWebÿInstallerÿproject.ÿ 2. FromÿtheÿProject menu,ÿselectÿInstallÿandÿfollowÿtheÿwizard'sÿstepsÿtoÿinstallÿit.ÿ 3. ToÿaccessÿtheÿWebÿapplicationÿthatÿwasÿdeployed,ÿstartÿInternetÿExplorerÿandÿenterÿtheÿURL:ÿ http://localhost/ÿ(http://localhost/xyz)xyz.ÿ(InÿVisualÿStudioÿ2005,ÿtheÿURLÿisÿ http://localhost:####/xyzÿ(http://localhost:/) whereÿ####ÿisÿtheÿportÿnumber.)ÿÿ

        ÿ Note: IfÿyouÿareÿusingÿtheÿWebViewerÿcontrolÿinÿyourÿapplication,ÿyouÿmustÿalsoÿsetÿupÿtheÿHTTPÿ Handlers.

        ConfiguringÿtheÿHTTPÿHandlers

        ThisÿtopicÿwillÿtakeÿyouÿthroughÿtheÿstepsÿofÿconfiguringÿtheÿActiveReportsÿHTTPHandlersÿforÿuseÿonÿtheÿWebÿ withÿASP.NET.

        ConfiguringÿtheÿActiveReportsÿHTTPHandlers

        ToÿconfigureÿtheÿHTTPHandler ÿ 1. InÿtheÿControlÿPanel,ÿdouble-clickÿ"AdministrativeÿTools."ÿDouble-clickÿ"InternetÿInformationÿServices"ÿtoÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ419

        openÿitsÿdialogÿwindow.ÿ 2. Right-clickÿonÿtheÿWebÿsiteÿthatÿyouÿneedÿtoÿconfigureÿtheÿHTTPHandlersÿfor,ÿthenÿclickÿProperties.ÿ 3. Clickÿonÿtheÿ"HomeÿDirectory"ÿtabÿofÿtheÿ"DefaultÿWebÿSiteÿProperties"ÿdialog.ÿ 4. ClickÿonÿtheÿConfigurationÿbutton.ÿ

        5. Inÿtheÿ"ApplicationÿMappings"ÿwindowÿofÿtheÿApplicationÿConfigurationÿdialog,ÿselectÿtheÿlistÿitemÿ withÿ.aspxÿinÿtheÿextensionÿcolumnÿandÿclickÿEdit.ÿNoteÿthatÿifÿyourÿmachineÿdoesÿnotÿhaveÿtheÿASP.NETÿ serverÿcomponentsÿinstalled,ÿtheÿ.aspxÿhandlerÿwillÿnotÿshowÿupÿinÿtheÿApplicationÿMappingsÿlist.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ420

        6. Selectÿandÿcopyÿallÿofÿtheÿtextÿinÿtheÿ"Executable"ÿfield.ÿClickÿCancel toÿreturnÿtoÿtheÿApplicationÿ Configurationÿdialog.ÿ 7. ClickÿAdd inÿtheÿApplicationÿConfigurationÿdialogÿtoÿaddÿaÿnewÿApplicationÿMapping.ÿ 8. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿandÿenterÿ".rpx"inÿtheÿExtensionÿfield.ÿ

        9. ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ ÿ

        Toÿconfigureÿtheÿcompiledÿreportÿhandler (continuingÿfromÿStepÿ9ÿinÿ"ToÿConfigureÿtheÿHTTPHandler)ÿ 1. InÿtheÿApplicationÿConfigurationÿdialog,ÿclickÿAdd toÿaddÿaÿnewÿApplicationÿMapping.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ421

        2. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿabove.ÿ 3. Enterÿ.ActiveReportÿinÿtheÿExtensionÿfield.ÿ 4. Makeÿsureÿtheÿ"Checkÿthatÿfileÿexists"ÿpermissionÿisÿunchecked.ÿ 5. ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ ÿ

        ToÿconfigureÿtheÿWebCacheAccessHandlerÿ(continuingÿfromÿStepÿ9ÿinÿ"ToÿConfigureÿtheÿHTTPHandler)ÿÿÿ 1. InÿtheÿApplicationÿConfigurationÿdialog,ÿclickÿAdd toÿaddÿaÿnewÿApplicationÿMapping.ÿ 2. InÿtheÿExecutableÿfield,ÿpasteÿtheÿvalueÿcopiedÿfromÿStepÿ6ÿabove.ÿ 3. Enterÿ.ArCacheItemÿinÿtheÿExtensionÿfield.ÿ 4. Makeÿsureÿtheÿ"Checkÿthatÿfileÿexists"ÿpermissionÿisÿunchecked.ÿ

        5.ÿ ClickÿOK toÿaddÿtheÿmappingÿandÿreturnÿtoÿtheÿApplicationÿConfigurationÿdialog.ÿ 6. ClickÿOK onÿtheÿremainingÿopenÿdialogsÿtoÿexitÿtheÿIISÿAdministrativeÿtool.ÿ

        Walkthrough:ÿHTTPÿHandlers

        ActiveReportsÿprovidesÿHTTPHandlerÿcomponentsÿthat,ÿuponÿconfiguration,ÿallowÿASP.NETÿtoÿautomaticallyÿ processÿreportsÿthatÿhaveÿbeenÿplacedÿintoÿanÿASP.NETÿwebÿsiteÿfolder.ÿActiveReportsÿHTTPHandlerÿ componentsÿenableÿreportsÿtoÿbeÿeasilyÿdeployedÿinÿbothÿHTMLÿandÿPDF.ÿActiveReportsÿincludesÿaÿsimpleÿ configurationÿutilityÿtoÿproperlyÿregisterÿtheÿHTTPHandlerÿcomponentsÿwithÿIISÿandÿASP.NET.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿtheÿHTTPHandlerÿtoÿoutputÿreportÿ informationÿinÿPDFÿformat. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l Savingÿtheÿreportÿlayoutÿtoÿrpxÿformatÿ l AddingÿcodeÿtoÿtheÿWeb.configÿfileÿtoÿenableÿHTTPÿHandlers

        l AddingÿaÿlinkÿtoÿtheÿWebÿFormÿtoÿenableÿviewingÿinÿPDFÿformatÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿYouÿmustÿalsoÿhaveÿaccessÿ toÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserver.ÿYouÿmustÿalsoÿrunÿtheÿ "ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿprogramÿmenuÿfromÿyourÿ WindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ422

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2003 1. CreateÿaÿnewÿASP.NETÿWebÿapplication.ÿÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptHttpHandlers.ÿ 4. ClickÿOpen.ÿ

        ToÿaddÿanÿActiveReportÿtoÿyourÿprojectÿusingÿVisualÿStudioÿ2005 1. CreateÿaÿnewÿASP.NETÿWebÿsite.ÿÿ 2. FromÿtheÿWebsite menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptHttpHandlers.ÿ 4. ClickÿAdd. 5. ClickÿYes whenÿaÿmessageÿboxÿasksÿwhetherÿyouÿwouldÿlikeÿtoÿplaceÿtheÿclassÿinÿtheÿ'App_Code'ÿfolder.

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿtheÿBuild button.ÿ 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ423

        4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthwindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿORDERÿBYÿcategoryID,ÿproductname".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptHTTPHandlers.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ

        ¡ ChangeÿtheÿnameÿtoÿghProducts

        ¡ ChangeÿtheÿDataField propertyÿtoÿCategoryID ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿFirstDetail

        ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿlabelsÿtoÿghProducts,ÿsettingÿtheÿpropertiesÿasÿindicatedÿinÿtheÿtableÿbelow:ÿ

        Name Text Location

        lblProductName ProductÿNameÿ 0,ÿ0ÿ

        lblQuantityPerUnit QuantityÿPerÿUnitÿ 1.19,ÿ0ÿ

        lblInStock InÿStockÿ 2.5,ÿ0ÿ

        lblUnitPrice UnitÿPriceÿ 4,ÿ0ÿ

        4. DragÿtheÿfollowingÿfieldsÿfromÿtheÿReportÿExplorerÿontoÿtheÿdetailÿsection,ÿsettingÿtheÿpropertiesÿasÿ indicatedÿinÿtheÿtableÿbelow.ÿÿ Field Text Location OutputFormat ProductName ProductÿName 0,ÿ0 NA QuantityPerUnit QuantityÿPerÿUnit 1.19,ÿ0 NA UnitsInStock UnitsÿInÿStock 2.5,ÿ0 NAÿ UnitPrice UnitÿPrice 4,ÿ0 Currency 5. ChangeÿtheÿCanShrink propertyÿofÿtheÿdetailÿsectionÿtoÿTrue.

        Savingÿtheÿreportÿlayoutÿtoÿrpxÿformat

        Toÿsaveÿtheÿreportÿlayouÿtoÿrpxÿformat 1. FromÿtheÿReport menu,ÿselectÿSaveÿLayout.ÿ 2. Navigateÿtoÿtheÿproject'sÿmainÿfolder,ÿnameÿtheÿfileÿrptHTTPHandlersÿandÿsaveÿitÿasÿtypeÿRuntimeÿ Formatÿ(*rpx).

        AddingÿcodeÿtoÿtheÿWeb.configÿfileÿtoÿenableÿHTTPHandler

        ToÿaddÿcodeÿtoÿtheÿWeb.configÿfile 1. Double-clickÿtheÿWeb.configÿfileÿinÿtheÿSolutionÿExplorerÿwindow.ÿ 2. InÿtheÿXMLÿview,ÿaddÿtheÿfollowingÿcodeÿimmediatelyÿbeforeÿtheÿclosingÿsystem.webÿtagÿnearÿtheÿbottomÿ ofÿtheÿpage. ÿ ÿ ÿ ÿ

        ÿ ActiveReports.Web,ÿVersion=5.0.0.101,ÿCulture=neutral,ÿPublicKeyToken=cc4967777c49a3ff"ÿ/> 3. Removeÿlineÿbreaksÿfromÿtheÿverbsÿifÿyouÿcopyÿandÿpasteÿthemÿsoÿthatÿeachÿofÿtheÿthreeÿisÿcompletedÿonÿ aÿsingleÿline. Note: Theÿversionÿnumberÿmustÿbeÿupdatedÿtoÿreflectÿtheÿinformationÿforÿtheÿcurrentÿversionÿofÿ ActiveReportsÿinstalledÿonÿyourÿcomputer.ÿ

        AddingÿaÿlinkÿtoÿtheÿWebÿForm

        ToÿaddÿaÿlinkÿtoÿtheÿWebÿFormÿandÿenableÿviewingÿinÿPDFÿformat 1. InÿtheÿHTMLÿviewÿofÿtheÿWebÿFormÿ(.aspx),ÿaddÿtheÿfollowingÿHTMLÿcode.ÿ WebApp.rpx/OutputFormat=pdf

        2.ÿ PressÿF5 toÿrunÿtheÿprogram.ÿ 3. ClickÿtheÿlinkÿonÿtheÿwebÿformÿtoÿconvertÿtheÿreportÿpreviewÿtoÿPDF.ÿ

        ParametersÿAndÿHTTPÿHandlers

        ActiveReportsÿprovidesÿHTTPHandlerÿcomponentsÿthat,ÿuponÿconfiguration,ÿallowÿASP.NETÿtoÿautomaticallyÿ processÿreportsÿthatÿhaveÿbeenÿplacedÿintoÿanÿASP.NETÿwebÿsiteÿfolder.ÿActiveReportsÿHTTPHandlerÿ componentsÿenableÿreportsÿtoÿbeÿeasilyÿdeployedÿinÿbothÿHTMLÿandÿPDF.ÿActiveReportsÿincludesÿaÿsimpleÿ configurationÿutilityÿtoÿproperlyÿregisterÿtheÿHTTPHandlerÿcomponentsÿwithÿIISÿandÿASP.NET.ÿ ThisÿwalkthroughÿillustratesÿhowÿtoÿcreateÿaÿsimpleÿWebÿapplicationÿandÿsetÿtheÿHTTPHandlerÿtoÿoutputÿreportÿ informationÿinÿHTMLÿformat. Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿparametersÿtoÿtheÿreport'sÿParametersÿcollectionÿ l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ

        l AddingÿcodeÿtoÿtheÿWeb.configÿfileÿtoÿenableÿHTTPÿhandlersÿ

        l AddingÿaÿlinkÿtoÿtheÿWebÿFormÿtoÿenableÿviewingÿinÿHTMLÿformatÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserver.ÿ Youÿmustÿalsoÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ3.0ÿ programÿmenuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ425

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿASP.NETÿWebÿapplicationÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptCustomers.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsourceÿandÿaddÿaÿparameterÿtoÿtheÿreport'sÿParametersÿcollection: 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNext. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿCustomersÿWHEREÿCountryÿ=ÿ<%Country%>ÿ".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ 8. InÿtheÿVisualÿStudioÿpropertyÿgrid,ÿselectÿActiveReportÿfromÿtheÿcomboÿbox.ÿ 9. ChangeÿtheÿvalueÿofÿtheÿShowParameterUI propertyÿfromÿitsÿdefaultÿvalueÿofÿTrueÿtoÿFalseÿtoÿturnÿoffÿ theÿparameterÿdialog.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ426

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptCustomersÿbyÿright-clickingÿtheÿreportÿandÿchoosingÿInsert.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿnameÿtoÿghCountryÿ ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿCountry

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿAll ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrueÿ 3. FromÿtheÿpopulatedÿFieldsÿlist,ÿdragÿtheÿCountryÿfieldÿontoÿtheÿGroupHeaderÿsection,ÿandÿsetÿitsÿfontÿsizeÿ toÿ14.ÿ 4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿ

        Field Text Location

        CompanyName CustomerÿName 0,ÿ0

        ContactName ContactÿName 3,ÿ0

        Phone Phone 5,ÿ0

        AddingÿcodeÿtoÿtheÿWeb.configÿfileÿtoÿenableÿHTTPHandler

        ToÿaddÿcodeÿtoÿtheÿWeb.configÿfile 1. Double-clickÿtheÿWeb.configÿfileÿinÿtheÿSolutionÿExplorerÿwindow.ÿ 2. InÿtheÿXMLÿview,ÿaddÿtheÿfollowingÿcodeÿinÿtheÿGlobalizationÿsectionÿatÿtheÿend.ÿ ÿ ÿ ÿ ÿ Note TheÿversionÿnumberÿandÿPublicKeyTokenÿwillÿneedÿtoÿbeÿupdatedÿtoÿreflectÿtheÿinformationÿforÿ theÿcurrentÿversionÿofÿActiveReportsÿinstalledÿonÿyourÿcomputer.ÿ

        AddingÿaÿlinkÿtoÿtheÿWebÿForm

        ToÿaddÿaÿlinkÿtoÿtheÿWebÿForm 1. InÿtheÿHTMLÿviewÿofÿtheÿWebÿForm,ÿaddÿtheÿfollowingÿHTMLÿcode.ÿ CustomerÿPhoneÿListÿforÿUSA ÿ

        2.ÿ PressÿF5 toÿrunÿtheÿprogram.ÿ 3. ClickÿtheÿlinkÿonÿtheÿwebÿformÿtoÿshowÿtheÿreportÿinÿitsÿdefaultÿHTMLÿformat.ÿ

        ProÿEditionÿLocalizationÿWalkthroughs

        ActiveReportsÿprovidesÿsupportÿforÿtheÿActiveReportsÿrunÿtimeÿdialogsÿtoÿbeÿlocalized.ÿTheÿfollowingÿ walkthroughsÿexplainÿhowÿtoÿlocalizeÿtheÿActiveReportsÿWebViewerÿcontrolÿandÿEndÿUserÿDesignerÿcontrol. ÿ LocalizingÿtheÿWebViewerÿControl DescribesÿhowÿtoÿsetÿupÿlocalizationÿforÿtheÿActiveReportsÿWebViewerÿcontrol.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ427

        LocalizingÿtheÿDesigner DescribesÿhowÿtoÿsetÿupÿlocalizationÿforÿtheÿActiveReportsÿreportÿDesignerÿcontrol.ÿ ÿ ÿ

        LocalizingÿtheÿActiveReportsÿDesigner

        InÿActiveReports,ÿtheÿreportÿdesignerÿcontrolÿandÿassociatedÿdialogsÿcanÿbeÿlocalized. ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿlocalizedÿstringsÿforÿtheÿActiveReportsÿreportÿdesignerÿ control. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ

        l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ l Creatingÿaÿdirectoryÿ l UsingÿtheÿWindowsÿResourceÿLocalizationÿEditorÿforÿtheÿresourceÿfilesÿ

        l RunningÿtheÿSatelliteÿAssemblyÿUtilityÿtoÿcreateÿaÿsatelliteÿassemblyÿ l AddingÿtheÿActiveReportsÿReportÿDesignerÿcontrolÿtoÿtheÿprojectÿ

        l Addingÿcodeÿtoÿchangeÿtheÿcultureÿinformationÿforÿtheÿprojectÿ(optionalÿstep)ÿ

        l Runningÿtheÿproject Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿtheÿfollowingÿfiles:

        l DataSourceForm.resxÿ l GoToLine.resxÿ l DDColorDropDown.resxÿ l GridSettingsSheet.resxÿ l ScriptEditor.resxÿ l DDColorPopup.resxÿ l NewStyleDialog.resxÿ l Strings.txtÿ

        l DDColorWell.resxÿ l OutputFormatDialog.resxÿ l StyleSettingsSheet.resxÿ l Descriptions.txtÿ l PageSettingSheet.resxÿ l PublicKey.snkÿ

        l DesignerTabArea.resxÿ l PrinterSettingsSheet.resxÿ l SatelliteAssembly.exeÿ

        l FindReplace.resxÿ l ReportSettingsDlg.resxÿ l ActiveReports.Design3.dll l FormatBorderDialog.resx l RichEditInsertFieldDlg.resxÿ YouÿcanÿfindÿtheseÿfilesÿinÿyourÿProgramÿFiles/DataÿDynamics/ActiveReportsÿforÿ.NETÿ 3.0/Localization folderÿ(mostÿareÿinÿtheÿDesigner folder).ÿYouÿcanÿfindÿtheÿcurrentÿ ActiveReports.Design3.dllÿinstalledÿonÿyourÿmachineÿinÿtheÿProgramÿFiles/CommonÿFiles/Dataÿ Dynamics/ActiveReportsÿforÿ.NETÿ3.0 folder. ThisÿwalkthroughÿshouldÿbeÿcompletedÿinÿconjunctionÿwithÿtheÿLocalizingÿtheÿActiveReportsÿReportÿ Engine walkthrough. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿlocalizedÿActiveReportsÿdesignerÿthatÿlooksÿsimilarÿ toÿtheÿfollowing.ÿForÿpurposesÿofÿthisÿscreenÿshot,ÿJapaneseÿwasÿusedÿtoÿlocalizeÿtheÿdesigner. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ428

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject. 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿWindowsÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.

        CreatingÿaÿDirectory

        Toÿcreateÿaÿdirectory 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿproject'sÿEXEÿfileÿwillÿbeÿcontainedÿwhenÿ theÿreportÿisÿrun.ÿForÿVisualÿBasicÿ.NET,ÿthisÿwillÿbeÿtheÿbin folder.ÿForÿC#,ÿthisÿwillÿbeÿtheÿbin/Debug folder.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject..ÿ 3. NameÿtheÿfolderÿaccordingÿtoÿtheÿCultureInfoÿthatÿyouÿwillÿuseÿtoÿlocalizeÿyourÿproject.ÿForÿexample,ÿyouÿ wouldÿuseÿ"ja"ÿforÿJapanese.ÿ Note:ÿBeÿsureÿtoÿbeÿconsistentÿwithÿthisÿname.ÿLocalizationÿwillÿnotÿworkÿifÿyouÿnameÿtheÿfolderÿ"ja"ÿbutÿ createÿaÿlocalizationÿfileÿbasedÿonÿ"Japaneseÿ(Japan)"ÿratherÿthanÿ"Japanese"ÿbecauseÿitÿwillÿbeÿlookingÿforÿ aÿfolderÿnamedÿ"ja-ja-JP." 4. Copyÿtheÿrequiredÿfilesÿtoÿthisÿnewÿfolder.ÿÿ

        l DataSourceForm.resxÿ l GoToLine.resxÿ

        l DDColorDropDown.resxÿ l GridSettingsSheet.resxÿ l ScriptEditor.resxÿ l DDColorPopup.resxÿ l NewStyleDialog.resxÿ l Strings.txtÿ

        l DDColorWell.resxÿ l OutputFormatDialog.resxÿ l StyleSettingsSheet.resxÿ

        l Descriptions.txtÿ l PageSettingSheet.resxÿ l PublicKey.snkÿ l DesignerTabArea.resxÿ l PrinterSettingsSheet.resxÿ l SatelliteAssembly.exeÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ429

        l FindReplace.resxÿ l ReportSettingsDlg.resxÿ l ActiveReports.Design3.dll

        l FormatBorderDialog.resx l RichEditInsertFieldDlg.resxÿ

        UsingÿtheÿWindowsÿResourceÿLocalizationÿEditor

        ToÿuseÿtheÿWindowsÿResourceÿLocalizationÿEditor 1. OpenÿaÿVisualÿStudioÿ.NETÿ2003ÿorÿ2005ÿcommandÿprompt.ÿ 2. RunÿtheÿWindowsÿResourceÿLocalizationÿEditorÿbyÿtypingÿ"winres"ÿandÿhittingÿEnter.ÿThisÿeditorÿallowsÿ youÿtoÿeditÿdialogÿ.resxÿfilesÿforÿaÿcertainÿlocale.ÿTheÿutilityÿisÿincludedÿasÿpartÿofÿtheÿ.NETÿframework.ÿ 3. ClickÿonÿFileÿ>ÿOpen onÿtheÿLocalizationÿEditor'sÿmenuÿbar.ÿ 4. Changeÿtheÿfileÿtypeÿtoÿ"ResXÿFile(*.resx)".ÿ 5. Navigateÿtoÿtheÿdirectoryÿthatÿyouÿcreatedÿandÿcopiedÿtheÿrequiredÿfilesÿinto,ÿchooseÿtheÿ DataSourceForm.resxÿfile,ÿandÿclickÿOpen toÿopenÿtheÿfileÿinÿtheÿEditor.ÿ 6. Onÿtheÿmenuÿbar,ÿclickÿFileÿ>ÿSave,ÿselectÿyourÿlocalizationÿcultureÿfromÿtheÿlist,ÿandÿthenÿpressÿOK .ÿ 7. RepeatÿStepsÿ3-6ÿforÿtheÿrestÿofÿtheÿ.resxÿfilesÿinÿtheÿdirectoryÿyouÿcreated.ÿ 8. CloseÿtheÿWindowsÿResourceÿLocalizationÿEditor.ÿ 9. CloseÿtheÿVisualÿStudioÿ.NETÿcommandÿpromptÿwindow.ÿ 10. InÿWindowsÿExplorer,ÿbrowseÿtoÿtheÿfolderÿcontainingÿtheÿrequiredÿfilesÿandÿrenameÿtheÿ.txtÿfilesÿ (Strings.txtÿandÿDescriptions.txt)ÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿForÿexample,ÿyouÿ wouldÿchangeÿ"Strings.txt"ÿtoÿ"Strings.ja.txt"ÿforÿJapanese. Note: Ifÿanyÿ.resxÿfilesÿcontainÿcomboÿboxÿitemsÿthenÿtheÿ.resxÿfilesÿneedÿtoÿbeÿmodifiedÿafterÿtheyÿareÿ saved.ÿ

        RunningÿtheÿSatelliteÿAssemblyÿUtility

        ToÿrunÿtheÿSatelliteÿAssemblyÿUtility 1. Double-clickÿtheÿSatelliteAssembly.exeÿfileÿtoÿrunÿtheÿutility.ÿ 2. Onÿtheÿmenuÿbar,ÿselectÿFileÿ>ÿNew.ÿThisÿcreatesÿaÿprojectÿwindowÿforÿtheÿSatelliteÿassembly.ÿ 3. Onÿtheÿmenuÿbar,ÿselectÿEditÿ>ÿProperties. 4. OnÿtheÿBuildÿtabÿofÿtheÿPropertiesÿdialog:ÿ

        ¡ Selectÿtheÿcorrectÿlocalizationÿculture.ÿ ¡ Setÿtheÿinputÿandÿoutputÿdirectoriesÿtoÿtheÿdirectoryÿyouÿcreatedÿthatÿcontainsÿtheÿ.resxÿandÿ.txtÿfiles.ÿ

        ¡ Setÿtheÿoutputÿfileÿnameÿtoÿ"ActiveReports.Design3.resources.dll".ÿ ¡ SelectÿorÿtypeÿinÿtheÿproperÿFrameworkÿVersion. 5. OnÿtheÿAssemblyÿtabÿofÿtheÿPropertiesÿdialog:ÿ

        ¡ InÿtheÿAssemblyÿAttributesÿsection,ÿsetÿtheÿVersionÿnumberÿtoÿmatchÿtheÿversionÿofÿtheÿ ActiveReports.Design2.dllÿfileÿlocatedÿinÿtheÿdirectoryÿyouÿcreated.ÿ

        ¡ InÿtheÿDelayedÿSigningÿsection,ÿsetÿtheÿStrongÿNameÿKeyFileÿtoÿtheÿpublickey.snkÿkeyÿfileÿinÿtheÿ directoryÿyouÿcreated.ÿ

        ¡ InÿtheÿUseÿTemplateÿFileÿsection,ÿbrowseÿtoÿtheÿActiveReports.Design3.dllÿfileÿlocatedÿinÿtheÿdirectoryÿ youÿcreated.ÿClickÿOK toÿcontinue. 6. Right-clickÿonÿtheÿResourceÿfileÿlistÿviewÿandÿselectÿAdd.ÿ 7. WithÿtheÿFileÿTypeÿsetÿtoÿ"Resx",ÿaddÿtheÿ.resxÿfilesÿthatÿhaveÿtheÿcultureÿinformationÿaddedÿtoÿtheÿfileÿ names.ÿForÿexample,ÿforÿJapanese,ÿyouÿwouldÿchooseÿ"DataSourceForm.ja.resx",ÿ "RichEditInsertFieldDlg.ja.resx",ÿetc.ÿClickÿOpen toÿaddÿtheÿfilesÿtoÿtheÿlist.ÿ 8. Right-clickÿonÿtheÿlistÿviewÿandÿselectÿAdd again.ÿChangeÿtheÿFileÿTypeÿtoÿ"StringsÿFile"ÿandÿselectÿtheÿ twoÿ.txtÿfilesÿthatÿyouÿrenamedÿaccordingÿtoÿtheÿcultureÿyouÿhaveÿchosen.ÿClickÿOpen toÿaddÿtheÿfilesÿtoÿ theÿlist.ÿ 9. Selectÿallÿofÿtheÿfilesÿinÿtheÿlistÿview,ÿthenÿright-clickÿandÿselectÿEdit toÿopenÿtheÿEditÿdialogÿforÿeachÿfile.ÿ 10. Changeÿtheÿnamespaceÿforÿeachÿculture-localizedÿfileÿaccordingÿtoÿtheÿlistÿbelow.ÿClickÿOK afterÿeachÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ430

        changeÿtoÿsaveÿtheÿnamespaceÿchanges.ÿ

        Resourceÿfile Resourceÿfileÿnamespace

        DataSourceForm.ja.resx DataDynamics.ActiveReports

        DDColorDropDown.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        DDColorPopup.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        DDColorWell.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        DesignerTabArea.ja.resx DataDynamics.ActiveReports.Design

        FindReplace.ja.resx Compona.Windows.Forms.SyntaxBox.FindReplaceForm

        FormatBorderDialog.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        GoToLine.ja.resx Compona.Windows.Forms.SyntaxBox.GotoLineForm

        GridSettingsSheet.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        NewStyleDialog.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        OutputFormatDialog.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        PageSettingSheet DataDynamics.ActiveReports.Design.Dialogs

        PrinterSettingsSheet.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        ReportSettingsDlg.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        RichEditInsertFieldDlg.ja.resxÿ DataDynamics.ActiveReports.Design

        ScriptEditor.ja.resx DataDynamics.ActiveReports.Design.InternalC

        StyleSettingsSheet.ja.resx DataDynamics.ActiveReports.Design.Dialogs

        Strings.ja.txt DataDynamics.ActiveReports.Design.Res

        Descriptions.ja.txt DataDynamics.ActiveReports.Design.Res

        11. SelectÿSaveÿAs. fromÿtheÿFileÿmenu.ÿClickÿtheÿSave button.ÿThisÿwillÿcreateÿaÿ.locÿfileÿforÿtheÿcultureÿyouÿ haveÿchosenÿwhichÿcontainsÿallÿofÿtheÿproject-relatedÿinformation.ÿ 12. Double-clickÿonÿeachÿitemÿinÿtheÿlistÿview,ÿselectÿEditor.,ÿandÿeditÿeachÿfileÿforÿtheÿlanguageÿyouÿhaveÿ chosenÿtoÿlocalize.ÿBelowÿisÿanÿimageÿofÿpartÿofÿtheÿ"Strings.ja.txt"ÿfileÿusedÿforÿthisÿproject.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ431

        13. Whenÿallÿofÿtheÿresourcesÿhaveÿbeenÿlocalized,ÿyouÿcanÿbuildÿtheÿSatelliteÿassemblyÿ (ActiveReports.Design3.resources.dll)ÿbyÿselectingÿBuildÿAssemblyÿfromÿtheÿBuildÿmenu. Note: Ifÿyouÿareÿunableÿtoÿeditÿtheÿ.txtÿfilesÿusingÿtheÿSatelliteÿAssemblyÿutility,ÿyouÿcanÿopenÿtheÿfilesÿ usingÿNotepadÿandÿsaveÿthemÿwithÿUnicodeÿencodingÿinsteadÿofÿANSI.ÿ

        AddingÿtheÿActiveReportsÿDesignerÿcontrol

        Toÿaddÿtheÿdesignerÿcontrol 1. DragÿtheÿActiveReportsÿDesignerÿcontrolÿfromÿtheÿappropriateÿtoolboxÿontoÿtheÿWindowsÿForm.ÿ 2. SetÿtheÿDock propertyÿforÿtheÿDesignerÿtoÿFill.

        AddingÿcodeÿtoÿChangeÿtheÿCultureÿInformationÿ(OptionalÿStep) Note: Thisÿstepÿisÿonlyÿnecessaryÿifÿyouÿareÿdevelopingÿonÿaÿmachineÿwithÿcultureÿinformationÿdifferentÿ fromÿthatÿinÿtheÿprojectÿyouÿareÿlocalizing.

        Toÿaddÿcodeÿtoÿchangeÿtheÿcultureÿinformation l Addÿtheÿfollowingÿcodeÿinÿtheÿform'sÿconstructorÿjustÿbeforeÿtheÿInitializeComponentÿmethodÿisÿcalled.ÿ Makeÿsureÿyouÿreplaceÿtheÿ"ja"ÿshownÿinÿtheÿexampleÿcodeÿwithÿtheÿappropriateÿcultureÿinformationÿforÿ yourÿproject.ÿÿ 'ÿVisualÿBasic System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿNewÿSystem.Globalization.CultureInfo("ja") //C# System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿnewÿSystem.Globalization.CultureInfo("ja");

        RunningÿtheÿProject

        Toÿrunÿtheÿproject ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ432

        1. PressÿF5 toÿrunÿtheÿapplication.ÿ 2. IfÿtheÿsatelliteÿassemblyÿinÿtheÿdirectoryÿyouÿcreatedÿhasÿonlyÿbeenÿsignedÿwithÿtheÿDataÿDynamicsÿpublicÿ key,ÿyouÿwillÿneedÿtoÿturnÿoffÿsnÿsecurityÿforÿtheÿassembly.ÿYouÿcanÿdoÿthisÿbyÿgoingÿtoÿtheÿVisualÿ Studioÿ.NETÿ2003ÿorÿ2005ÿcommandÿprompt,ÿbrowsingÿtoÿtheÿdirectoryÿinÿwhichÿtheÿfileÿisÿlocatedÿandÿ typingÿinÿtheÿfollowingÿline:ÿ"snÿ-VrÿActiveReports.Design3.resources.dll". Note: Priorÿtoÿdeployingÿtheÿproject,ÿyouÿcanÿsendÿtheÿActiveReports.Design3.resources.dllÿfileÿtoÿ [email protected]ÿ toÿhaveÿitÿsigned.ÿWhenÿyouÿdeployÿtheÿproject,ÿifÿyourÿotherÿ DLLsÿareÿbeingÿsentÿtoÿtheÿGlobalÿAssemblyÿCache,ÿthisÿfileÿwillÿalsoÿneedÿtoÿbeÿsentÿthere.

        LocalizingÿtheÿActiveÿReportsÿWebÿViewerÿControl

        InÿActiveReports,ÿtheÿWebViewerÿcontrol'sÿlabelsÿandÿtoolÿtipÿtextÿcanÿbeÿlocalizedÿforÿtheÿHtmlViewerÿ ViewerType.ÿ ThisÿwalkthroughÿillustratesÿtheÿbasicsÿofÿsettingÿupÿlocalizedÿstringsÿforÿtheÿActiveReportsÿWebViewerÿcontrol. Theÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l CreatingÿaÿnewÿVisualÿStudioÿprojectÿ

        l Creatingÿaÿdirectoryÿ l Localizingÿtheÿresourceÿfilesÿÿ l CompilingÿtheÿActiveReports.Web.resources.dllÿsatelliteÿassemblyÿusingÿtheÿBuildSatelliteAssembly.batÿfileÿ

        l AddingÿtheÿActiveReportsÿWebViewerÿcontrolÿtoÿtheÿprojectÿÿ l Addingÿcodeÿtoÿchangeÿtheÿcultureÿinformationÿforÿtestingÿtheÿprojectÿ(optionalÿstep)ÿ

        l Runningÿtheÿprojectÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿtheÿfollowingÿfiles:ÿstrings.en.resx,ÿ BuildSatelliteAssembly.bat,ÿandÿDataDynamicsPublicKey.snk.ÿYouÿcanÿfindÿtheseÿfilesÿinÿyourÿProgramÿ Files\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0\Localization\WebÿViewerÿfolder.ÿYouÿwillÿalsoÿneedÿaccessÿtoÿ theÿcurrentÿactivereports.web.dllÿinstalledÿonÿyourÿmachineÿwhichÿyouÿcanÿfindÿinÿtheÿProgramÿFiles\Commonÿ Files\DataÿDynamics\ActiveReportsÿforÿ.NETÿ3.0ÿfolder. Whenÿyouÿhaveÿfinishedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿlocalizedÿActiveReportsÿWebViewerÿcontrolÿthatÿ looksÿsimilarÿtoÿtheÿfollowing.ÿForÿpurposesÿofÿthisÿscreenshot,ÿFrenchÿwasÿusedÿtoÿlocalizeÿtheÿWebViewerÿ control. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ433

        CreatingÿaÿnewÿVisualÿStudioÿproject

        ToÿcreateÿaÿnewÿVisualÿStudioÿproject 1. OpenÿVisualÿStudio.ÿ 2. FromÿtheÿFile menu,ÿselectÿNew >ÿProject.ÿ 3. SelectÿtheÿprojectÿtypeÿandÿclickÿonÿASP.NETÿWebÿApplication.ÿ 4. ChangeÿtheÿnameÿofÿyourÿprojectÿandÿclickÿOK.ÿ

        CreatingÿaÿDirectory

        Toÿcreateÿaÿdirectory 1. OpenÿWindowsÿExplorerÿandÿbrowseÿtoÿtheÿfolderÿinÿwhichÿyourÿproject'sÿDLLÿfileÿwillÿbeÿcontainedÿwhenÿ theÿreportÿisÿrun.ÿForÿVisualÿBasicÿ.NET,ÿthisÿwillÿbeÿtheÿ"bin"ÿfolder.ÿForÿC#,ÿthisÿwillÿbeÿtheÿ"bin/Debug"ÿ folder.ÿ 2. OnÿtheÿFile menu,ÿclickÿNewÿ>ÿFolder.ÿ 3. NameÿtheÿfolderÿaccordingÿtoÿtheÿCultureInfoÿthatÿyouÿwillÿuseÿtoÿlocalizeÿyourÿproject.ÿForÿexample,ÿyouÿ wouldÿuseÿ"ja"ÿforÿJapanese.ÿ 4. Copyÿtheÿrequiredÿfilesÿ(strings.en.resx,ÿBuildSatelliteAssembly.bat,ÿandÿDataDynamicsPublicKey.snk)ÿtoÿ thisÿnewÿfolder.ÿ

        LocalizingÿtheÿStringsÿinÿVisualÿStudioÿ.NET

        ToÿlocalizeÿtheÿstringsÿinÿVisualÿStudioÿ.NET 1. Double-clickÿstrings.en.resxÿtoÿopenÿitÿinÿVisualÿStudioÿ.NET.ÿÿ 2. Theÿ.resxÿfileÿcontainsÿthreeÿrelevantÿcolumns:ÿ

        ¡ Nameÿ- Itÿisÿimportantÿthatÿtheÿnameÿcolumnÿdoesÿnotÿchange;ÿthisÿisÿhowÿtheÿWebViewerÿcontrolÿ findsÿtheÿlocalizedÿresources.ÿ ¡ Valueÿ- Toÿlocalizeÿtheÿstrings,ÿchangeÿtheÿstringÿinÿtheÿValueÿcolumnÿforÿeachÿitemÿyouÿwishÿtoÿ localize.ÿ ¡ Commentÿ- Theÿcommentÿcolumnÿdescribesÿexactlyÿwhatÿeachÿstringÿisÿusedÿfor,ÿhelpingÿyouÿtoÿ determineÿhowÿtoÿsetÿtheÿvalueÿcolumn.ÿ 3. FromÿtheÿFileÿmenu,ÿchooseÿSaveÿstrings.en.resxÿAs,ÿsetÿyourÿlocalizationÿculture,ÿandÿthenÿpressÿOK.ÿÿ Toÿsetÿyourÿlocalizationÿculture:ÿ ¡ Changeÿtheÿen portionÿofÿtheÿstrings.en.resxÿfileÿtoÿtheÿcultureÿnameÿforÿwhichÿyouÿareÿcreatingÿtheÿ localizedÿresourcesÿ(forÿFrench,ÿthisÿisÿfr).ÿ ¡ Aÿlistÿofÿtheÿvalidÿcultureÿnamesÿcanÿbeÿfoundÿinÿtheÿ.NETÿFrameworkÿClassÿLibraryÿdocumentationÿ underÿtheÿ"aboutÿCultureInfoÿclassÿ(http://msdn.microsoft.com/library/default.asp? url=/library/en-us/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.asp)"ÿtopic.ÿ ¡ Theÿcultureÿnameÿcanÿbeÿneutralÿorÿspecific.ÿForÿexample,ÿ"en"ÿisÿaÿneutralÿcultureÿname,ÿwhereasÿ "en-US"ÿisÿaÿspecificÿcultureÿname.ÿ 4. CloseÿtheÿVisualÿStudioÿ.NETÿIDE.ÿ

        CompilingÿtheÿActiveReports.Web.resources.dllÿsatelliteÿassemblyÿusingÿtheÿ BuildSatelliteAssembly.batÿfile

        ToÿcompileÿtheÿSatelliteÿAssembly 1. Openÿaÿcommandÿprompt,ÿandÿinÿDOS,ÿnavigateÿtoÿyourÿlocalizationÿfolder,ÿÿi.e.ÿcdÿ C:\Inetpub\wwwroot\MyWebViewerProject\bin\fr.ÿ 2. Youÿwillÿthenÿneedÿtoÿrunÿtheÿ.batÿfileÿandÿpassÿitÿyourÿCultureNameÿandÿtheÿVersionÿofÿyourÿ ActiveReportsÿbuild.ÿÿi.e.ÿBuildSatelliteAssembly.batÿes-mxÿ4.0.0.1009ÿ(TheÿVersionÿofÿyourÿActiveReportsÿ buildÿcanÿbeÿfoundÿbyÿright-clickingÿtheÿActiveReports.dllÿfoundÿinÿC:\ProgramÿFiles\CommonÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0ÿandÿchoosingÿProperties.ÿÿTheÿFileÿVersionÿisÿonÿtheÿVersionÿtab.)ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ434

        3. YouÿshouldÿseeÿaÿSuccess!ÿmessageÿwhenÿitÿhasÿfinished,ÿandÿtwoÿnewÿfilesÿwillÿbeÿcreated.ÿÿOneÿisÿ DataDynamics.ActiveReports.Web.strings.fr.resources,ÿandÿtheÿotherÿisÿActiveReports.Web.resources.dll.ÿ 4. SendÿtheÿcompiledÿActiveReports.Web.resources.dllÿsatelliteÿassemblyÿyouÿjustÿcreatedÿtoÿtheÿ ActiveReportsÿsupportÿstaffÿ(mailto:[email protected]) andÿtheyÿwillÿgetÿ itÿsignedÿforÿyouÿsoÿthatÿtheÿsigningÿkeyÿforÿtheÿsatelliteÿ.dllÿmatchesÿtheÿkeyÿusedÿtoÿsignÿtheÿ ActiveReports.Web.dllÿassembly.ÿ(Ifÿtheÿsigningÿkeyÿdoesÿnotÿmatch,ÿtheÿlocalizationÿwillÿbeÿignored.)ÿ

        AddingÿtheÿActiveReportsÿWebViewerÿcontrol

        ToÿaddÿtheÿWebViewerÿcontrol 1. DragÿandÿdropÿtheÿActiveReportsÿWebViewerÿcontrolÿfromÿtheÿappropriateÿtoolboxÿtoÿWebForm1.ÿ 2. LocalizationÿwillÿonlyÿaffectÿtheÿWebViewerÿwithÿtheÿdefaultÿvalueÿofÿtheÿViewerTypeÿproperty,ÿwhichÿisÿ theÿHtmlViewer.ÿ

        AddingÿCodeÿtoÿChangeÿtheÿCultureÿInformationÿ(OptionalÿStep) Note: Thisÿstepÿisÿonlyÿnecessaryÿifÿyouÿareÿdevelopingÿonÿaÿmachineÿwithÿcultureÿinformationÿdifferentÿ fromÿthatÿinÿtheÿprojectÿyouÿareÿlocalizing.ÿ

        Toÿaddÿcodeÿtoÿchangeÿtheÿcultureÿinformation l Toÿtestÿyourÿlocalization,ÿaddÿtheÿfollowingÿcodeÿinÿtheÿwebform'sÿconstructorÿjustÿbeforeÿtheÿ InitializeComponentÿmethodÿisÿcalled.ÿÿThisÿisÿinÿtheÿ"WebÿFormÿDesignerÿGeneratedÿCode"ÿregion.ÿÿMakeÿ sureÿyouÿreplaceÿtheÿ"fr"ÿshownÿinÿtheÿexampleÿcodeÿwithÿtheÿappropriateÿcultureÿinformationÿforÿyourÿ project.ÿÿ 'ÿVisualÿBasic System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿNewÿSystem.Globalization.CultureInfo("fr") //C# System.Threading.Thread.CurrentThread.CurrentUICultureÿ=ÿnewÿSystem.Globalization.CultureInfo("fr");

        RunningÿtheÿProject

        Toÿrunÿtheÿproject 1. PressÿF5ÿtoÿrunÿtheÿapplication.ÿ 2. IfÿtheÿsatelliteÿassemblyÿinÿtheÿdirectoryÿyouÿcreatedÿhasÿnotÿbeenÿsignedÿbyÿDataÿDynamics'ÿdevelopmentÿ

        ÿ staff,ÿtheÿlocalizationÿwillÿbeÿignored.ÿÿ Note:ÿWeÿhaveÿplansÿtoÿsimplifyÿthisÿprocessÿinÿaÿfutureÿversionÿofÿActiveReportsÿforÿ.NET.

        Walkthrough:ÿWebÿViewerÿControl

        TheÿActiveReportsÿWebViewerÿcontrolÿallowsÿyouÿtoÿeasilyÿpublishÿsimpleÿreportsÿtoÿtheÿwebÿforÿviewingÿinÿtheÿ browser.ÿTheÿclientÿmachineÿwillÿnotÿrequireÿActiveReportsÿorÿASP.NETÿtoÿbeÿinstalled.ÿTheÿWebViewerÿalsoÿ takesÿadvantageÿofÿaÿreportÿqueueingÿtechnologyÿtoÿensureÿtheÿreportsÿareÿexecutedÿandÿoutputtedÿ efficiently.ÿToÿuseÿtheÿWebViewerÿyouÿwillÿselectÿanÿActiveReportÿusingÿtheÿReportÿpropertyÿofÿtheÿWebViewerÿ inÿtheÿpropertyÿlistÿandÿsetÿtheÿViewerTypeÿpropertyÿtoÿtheÿviewerÿofÿyourÿchoice.ÿAlternatively,ÿyouÿcanÿsetÿ theÿReportÿpropertyÿprogrammaticallyÿtoÿaÿnewÿinstanceÿofÿanÿActiveReportÿclass.ÿ Thisÿwalkthroughÿisÿsplitÿupÿintoÿtheÿfollowingÿactivities:ÿ l AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplicationÿ l Connectingÿtheÿreportÿtoÿaÿdataÿsourceÿ

        l Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdataÿ l AddingÿtheÿActiveReportsÿWebViewerÿcontrolÿtoÿtheÿWebÿFormÿ Toÿcompleteÿtheÿwalkthrough,ÿyouÿmustÿhaveÿaccessÿtoÿtheÿNorthwindÿdatabase.ÿForÿyourÿconvenience,ÿaÿ copyÿisÿincludedÿwithÿActiveReportsÿatÿtheÿfollowingÿdefaultÿlocation:ÿC:\ProgramÿFiles\Dataÿ Dynamics\ActiveReportsÿforÿ.NETÿ3.0\Data\NWIND.MDB.ÿ YouÿmustÿalsoÿhaveÿaccessÿtoÿInternetÿInformationÿServicesÿeitherÿfromÿyourÿcomputerÿorÿfromÿtheÿserver.ÿ Youÿmustÿalsoÿrunÿtheÿ"ConfigureÿWebÿSample"ÿoptionÿfromÿtheÿDataÿDynamicsÿActiveReportsÿforÿ.NETÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ435

        3.0ÿprogramÿmenuÿfromÿyourÿWindowsÿStartÿbutton. Whenÿyouÿhaveÿcompletedÿthisÿwalkthrough,ÿyouÿwillÿhaveÿaÿreportÿthatÿlooksÿsimilarÿtoÿtheÿfollowing.

        AddingÿanÿActiveReportÿtoÿanÿASP.NETÿWebÿapplication

        ToÿaddÿanÿActiveReportÿtoÿyourÿproject 1. OpenÿaÿnewÿASP.NETÿWebÿapplicationÿinÿVisualÿStudio.ÿ 2. FromÿtheÿProject menu,ÿselectÿAddÿNewÿItem.ÿ 3. SelectÿActiveReportsÿ3.0ÿFile andÿrenameÿtheÿfileÿrptWebView.ÿ 4. ClickÿOpen.ÿ

        Connectingÿtheÿreportÿtoÿaÿdataÿsource

        Toÿconnectÿtheÿreportÿtoÿaÿdataÿsource 1. ClickÿonÿtheÿgrayÿreportÿDataSourceÿiconÿinÿtheÿDetailÿsectionÿtoÿopenÿtheÿreportÿDataSourceÿdialog.ÿ 2. ClickÿonÿBuild. 3. SelectÿMicrosoftÿJetÿ4.0ÿOLEÿDBÿProviderÿandÿclickÿNextÿ. 4. ClickÿtheÿellipsisÿbuttonÿtoÿbrowseÿforÿtheÿaccessÿpathÿtoÿtheÿNorthWindÿdatabase.ÿClickÿOpen onceÿyouÿ haveÿselectedÿtheÿappropriateÿaccessÿpath.ÿ 5. ClickÿOK toÿcontinue.ÿ 6. InÿtheÿQueryÿfield,ÿtypeÿ"Selectÿ*ÿfromÿproductsÿORDERÿBYÿcategoryID,ÿproductname".ÿ 7. ClickÿOK toÿreturnÿtoÿtheÿreportÿdesignÿsurface.ÿ

        Addingÿcontrolsÿtoÿtheÿreportÿtoÿcontainÿdata ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ436

        Toÿaddÿcontrolsÿtoÿtheÿreport 1. AddÿaÿGroupHeader/FooterÿsectionÿtoÿrptWebView.ÿ 2. Makeÿtheÿfollowingÿchangesÿtoÿtheÿgroupÿheader:ÿ ¡ ChangeÿtheÿnameÿtoÿghProductsÿ ¡ ChangeÿtheÿDataFieldÿpropertyÿtoÿCategoryIDÿ

        ¡ ChangeÿtheÿGroupKeepTogether propertyÿtoÿFirstDetail ¡ ChangeÿtheÿKeepTogether propertyÿtoÿTrue 3. AddÿtheÿfollowingÿcontrolsÿtoÿtheÿGroupHeaderÿsection:ÿ

        Control Name Text Location

        Label lblProductName ProductÿNameÿ 0,ÿ0ÿ

        Label lblQuantityPerUnit QuantityÿPerÿUnitÿ 1.1875,ÿ0ÿ

        Label lblInStock InÿStockÿ 2.5625,ÿ0ÿ

        Label lblUnitPrice UnitÿPriceÿ 4,ÿ0ÿ

        4. InÿtheÿReportÿExplorer,ÿexpandÿtheÿFields node,ÿthenÿtheÿBound node.ÿDragÿtheÿfollowingÿfieldsÿontoÿtheÿ detailÿsectionÿandÿsetÿtheÿfollowing propertiesÿofÿeachÿtextboxÿasÿindicated.ÿÿ 4,ÿ0 Field Text Location OutputFormat

        ProductName ProductÿName 0,ÿ0 NA

        QuantityPerUnit QuantityÿPerÿUnit 1.1875,ÿ0 NA

        UnitsInStock UnitsÿInÿStock 2.5625,ÿ0 NA

        UnitPrice UnitÿPrice Currency

        AddingÿtheÿActiveReportsÿWebViewerÿcontrolÿtoÿtheÿWebÿForm 1. ClickÿonÿtheÿActiveReportÿWebViewerÿcontrolÿinÿtheÿappropriateÿtoolboxÿandÿdragÿitÿontoÿtheÿWebÿForm.ÿ 2. Adjustÿtheÿsizeÿaccordingÿtoÿyourÿneeds.ÿ 3. ChangeÿtheÿReport propertyÿtoÿrptWebView.ÿ 4. MakeÿsureÿtheÿViewerTypeÿpropertyÿisÿsetÿtoÿHtmlViewer.ÿ Note:ÿToÿviewÿtheÿreportÿinÿPDFÿformat,ÿchangeÿtheÿViewerTypeÿpropertyÿtoÿAcrobatReader.ÿToÿuseÿtheÿ ÿ ActiveXÿViewer,ÿchangeÿtheÿViewerTypeÿpropertyÿtoÿActiveXViewerÿandÿpasteÿtheÿActiveXÿviewerÿ.cabÿ fileÿinÿyourÿprojectÿfolderÿ(forÿhelpÿwithÿthis,ÿseeÿ"ÿUsingÿActiveXÿViewerÿControlÿonÿtheÿWeb").ÿ

        Troubleshooting

        l TheÿActiveReportsÿiconÿisÿnotÿshowingÿupÿinÿtheÿVisualÿStudio.NETÿIDE l TheÿCopyÿiconÿisÿmissingÿfromÿtheÿViewer l TheÿevaluationÿmessageÿisÿshowingÿthatÿActiveReportsÿisÿnotÿlicensed

        l Exportedÿreportsÿareÿnotÿshowingÿupÿcorrectly l MemoryÿissuesÿappearÿwhenÿusingÿActiveReports l Parametersÿareÿnotÿworkingÿcorrectly

        l Reportsÿareÿnotÿprintingÿcorrectly,ÿorÿareÿprintingÿslowly l ReportsÿareÿnotÿshowingÿupÿinÿtheÿWebViewer

        l WhenÿconvertingÿWebÿprojectsÿtoÿVisualÿStudioÿ2005,ÿtheÿReportAssemblyÿprojectÿdoesÿnotÿ convert ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ437

        l Reportsÿcopiedÿfromÿoneÿprojectÿtoÿanotherÿdisplayÿwithÿallÿcontrolsÿstackedÿatÿ0,ÿ0

        ÿ l Errorsÿandÿwarningsÿshowÿupÿinÿoldÿprojectsÿafterÿinstallingÿaÿnewÿbuild

        l Controlsÿareÿnotÿshowingÿupÿatÿrunÿtimeÿinÿnestedÿsubreports

        ActiveReportsÿIconÿnotÿShowing

        Symptoms: YouÿrecentlyÿupgradedÿorÿreinstalledÿActiveReportsÿonÿyourÿmachineÿandÿyourÿreportsÿareÿnowÿ showingÿupÿasÿXMLÿinsteadÿofÿshowingÿproperlyÿinÿtheÿdesigner,ÿandÿtheÿActiveReportsÿiconÿisÿnotÿshowingÿ whenÿyouÿopenÿVisualÿStudio.NET.ÿ Cause:ÿActiveReportsÿisÿnotÿregisteredÿonÿyourÿmachine.ÿTheÿmostÿcommonÿreasonÿforÿthisÿisÿAntiVirusÿ softwareÿwhichÿstopsÿtheÿtheÿinstallationÿscriptsÿfromÿrunning.ÿ Solution: UninstallÿActiveReports,ÿtemporarilyÿturnÿoffÿscriptÿblockingÿandÿre-installÿActiveReportsÿforÿ.NETÿ 3.0.ÿ Ifÿtheÿsymptomsÿpersist: YouÿcanÿmanuallyÿregisterÿActiveReportsÿforÿ.NETÿ3.0ÿbyÿenteringÿtheÿfollowingÿ commandsÿatÿtheÿcommandÿprompt:ÿ l C:\WINDOWS\system32\regsvr32.exeÿ/uÿC:\ProgramFiles\CommonÿFiles\DataDynamics\ActiveReportsÿ forÿ.NETÿ3.0\ARVSPackage.dllÿ l RunÿVisualÿStudio.NETÿandÿthenÿcloseÿit.ÿ

        l C:\WINDOWS\system32\regsvr32.exeÿ/vÿC:\ProgramFiles\CommonÿFiles\DataDynamics\ActiveReportsÿ

        ÿ forÿ.NETÿ3.0\ARVSPackage.dllÿ

        l RunÿVisualÿStudio.ÿYouÿshouldÿnowÿbeÿableÿtoÿaccessÿRPXÿfiles.ÿ

        CopyÿIconÿMissingÿfromÿtheÿViewer

        Symptoms: Theÿcopyÿiconÿisÿnotÿshowingÿinÿtheÿviewer. Cause: TheÿActiveReportsÿRTFÿandÿTextÿexportÿfiltersÿareÿnotÿreferencedÿinÿtheÿproject.ÿTheÿviewerÿhasÿ intentionallyÿbeenÿdesignedÿnotÿtoÿrequireÿtheÿexportÿfiltersÿsoÿnoÿextraÿfilesÿareÿrequiredÿinÿdistribution.ÿ Solution: 1. InÿtheÿSolutionÿExplorer,ÿrightÿclickÿReferencesÿandÿchooseÿAddÿReference.ÿ

        2.ÿ SelectÿDataÿDynamicsÿActiveReportsÿRichÿTextÿFormatÿ(RTF)ÿExportÿComponentÿandÿDataÿDynamicsÿ ActiveReportsÿTextÿExportÿComponentÿandÿclickÿOK.ÿ

        EvaluationÿMessageÿShowing

        Symptoms: TheÿevaluationÿbannerÿstillÿappearsÿafterÿrunningÿtheÿStandardÿEditionÿLicenseStd3.exeÿorÿ UpgradeStd3.exeÿ(orÿProfessionalÿEditionÿLicensePro3.exeÿorÿUpgradePro3.exe)ÿfileÿandÿfollowingÿtheÿstepsÿ toÿlicenseÿapplications. Causes:ÿ

        l Runningÿtheÿ.exeÿwillÿlicenseÿyourÿmachineÿforÿnewÿWindowsÿFormsÿprojectsÿonly.ÿAdditionalÿstepsÿareÿ requiredÿforÿASP.NETÿprojectsÿandÿforÿexistingÿWindowsÿFormsÿprojects.ÿ

        l Allÿlicensingÿinÿ.NETÿisÿdoneÿatÿtheÿrootÿEXEÿlevel.ÿForÿexample,ÿifÿyouÿhaveÿaÿreportÿthatÿneedsÿtoÿbeÿ licensedÿwithinÿaÿDLL,ÿtheÿcallingÿEXEÿtoÿthatÿDLLÿneedsÿtoÿbeÿlicensed.ÿ l Theÿnameÿofÿyourÿexecutableÿhasÿbeenÿchangedÿwithoutÿchangingÿtheÿassemblyÿnameÿinÿtheÿproject'sÿ references.ÿ l Noÿlicenses.licxÿfileÿwasÿgeneratedÿinÿtheÿproject.ÿ l YouÿhaveÿLicenseStd3.exeÿorÿUpgradeStd3.exeÿ(StandardÿEdition)ÿratherÿthanÿLicensPro3.exeÿorÿ UpgradePro3.exeÿ(ProfessionalÿEdition)ÿandÿareÿusingÿProfessionalÿEditionÿfeaturesÿsuchÿasÿtheÿHttpÿ Handlers,ÿtheÿWebViewerÿcontrol,ÿorÿtheÿEndÿUserÿDesignerÿcontrol.ÿAlthoughÿStandardÿEditionÿusersÿareÿ welcomeÿtoÿtryÿoutÿtheÿProfessionalÿEditionÿfeatures,ÿtheÿonlyÿwayÿtoÿremoveÿtheÿevaluationÿbannerÿfromÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ438

        themÿisÿtoÿupgradeÿtoÿtheÿProfessionalÿEdition.ÿ Solutions:ÿ

        l ForÿexistingÿWindowsÿFormsÿprojects:ÿAfterÿlicensingÿtheÿmachine,ÿreopenÿtheÿproject,ÿopenÿtheÿBuildÿ menu,ÿandÿchooseÿRebuildÿSolution.ÿInÿmostÿcases,ÿthisÿwillÿupdateÿtheÿlicenseÿinformation.ÿ

        l ForÿASP.NETÿprojects: 1. GoÿtoÿtheÿStartÿmenu,ÿselectÿAllÿPrograms,ÿDataÿDynamics,ÿActiveReportsÿforÿ.NETÿ3.0,ÿandÿclickÿ CreateÿWeb.Configÿkey.ÿ 2. Enterÿtheÿsameÿinformationÿyouÿusedÿinÿlicense.exeÿandÿclickÿtheÿCreateÿWeb.Configÿbutton.ÿ(Ifÿyourÿ machineÿhasÿbeenÿproperlyÿlicensed,ÿtheÿfirstÿtwoÿfieldsÿshouldÿalreadyÿbeÿfilledÿinÿbyÿdefault.)ÿ 3. CopyÿtheÿgeneratedÿXMLÿstringÿandÿpasteÿitÿinÿyourÿASP.NETÿproject'sÿweb.configÿfile.ÿIfÿyourÿ web.configÿfileÿalreadyÿhasÿÿtags,ÿplaceÿtheÿXMLÿstringÿinsideÿtheseÿtags,ÿandÿdeleteÿ theÿextraÿÿtagsÿinÿtheÿXMLÿstring.ÿ 4. Caution: DoÿnotÿplaceÿtheÿXMLÿstringÿinsideÿtheÿÿtags,ÿorÿtheÿprojectÿwillÿerrorÿoutÿ whenÿyouÿattemptÿtoÿrunÿit.ÿ 5. OpenÿtheÿBuildÿmenu,ÿandÿchooseÿRebuildÿSolution.ÿ

        l ForÿEndÿUserÿReportÿDesignerÿprojects: 1. AddÿaÿnewÿEndÿUserÿReportÿDesignerÿtoÿyourÿsolution.ÿThisÿisÿtemporary,ÿsoÿanywhereÿonÿtheÿmainÿ formÿwillÿdo.ÿ 2. FromÿtheÿBuildÿmenu,ÿchooseÿRebuildÿSolution.ÿ 3. Openÿtheÿproject'sÿlicenses.licxÿfileÿandÿverifyÿthatÿitÿcontainsÿtheÿlineÿ "DataDynamics.ActiveReports.Designer.Designer,ÿActiverReports.Design."ÿ 4. DeleteÿtheÿtemporaryÿEndÿUserÿReportÿDesigner.ÿ l ForÿreportsÿcontainedÿinÿaÿDLLÿratherÿthanÿanÿEXE: Afterÿlicensingÿtheÿmachine,ÿtheÿrootÿlevelÿcallingÿ EXEÿwillÿneedÿtoÿhaveÿActiveReportsÿlicensingÿembedded.ÿÿToÿdoÿthis,ÿaddÿaÿtemporaryÿActiveReportÿtoÿ theÿstartupÿEXEÿproject,ÿopenÿtheÿBuildÿmenu,ÿandÿchooseÿRebuildÿSolution.ÿAfterÿverifyingÿthatÿlicensingÿ hasÿbeenÿaddedÿinÿtheÿlicenses.licxÿfile,ÿtheÿtemporaryÿreportÿmayÿbeÿdeleted.ÿ

        l Forÿrun-timeÿlicensing: 1. CreateÿaÿWeb.ConfigÿkeyÿasÿdirectedÿinÿtheÿASP.NETÿsolutionÿabove.ÿ 2. Inÿtheÿapplicationÿclass,ÿcreateÿaÿreportÿinstanceÿandÿcallÿtheÿSetLicense()ÿmethodÿwithÿtheÿkeyÿyouÿ createdÿaboveÿasÿtheÿparameters.ÿTheÿstringÿvalueÿforÿtheÿgeneratedÿkeyÿshouldÿbeÿ"[Name],ÿ [CompanyÿName],ÿ[SerialÿNumber],ÿ[HashÿCode]."ÿ 3. UseÿtheÿRunÿmethodÿtoÿgenerateÿtheÿreportÿobject.ÿ

        l Forÿreportsÿinÿanÿexecutableÿforÿwhichÿtheÿnameÿhasÿbeenÿchanged:ÿChangeÿtheÿassemblyÿnameÿinÿ theÿproject'sÿreferencesÿtoÿmatchÿtheÿnewÿnameÿofÿtheÿexecutable. Ifÿtheÿsymptomsÿpersist: ÿ l ForÿexistingÿWindowsÿFormsÿprojects:ÿIfÿsimplyÿrebuildingÿtheÿprojectÿdoesn'tÿwork,ÿyouÿcanÿmanuallyÿ setÿupÿtheÿapplicationÿforÿlicensing.ÿ 1. InÿtheÿSolutionÿExplorerÿforÿtheÿproject,ÿright-clickÿtheÿStartUpÿproject,ÿandÿchooseÿSetÿAsÿStartUpÿ Projectÿ 2. FromÿtheÿProjectÿmenu,ÿchooseÿAddÿNewÿItem.ÿ 3. InÿtheÿTemplatesÿpane,ÿchooseÿTextÿFile,ÿandÿnameÿitÿ"licenses.licx"ÿ 4. Double-clickÿtheÿlicenses.licxÿfileÿtoÿopenÿitÿ 5. Addÿ"DataDynamics.ActiveReports.ActiveReport3,ÿActiveReports"ÿtoÿtheÿtextÿfileÿ 6. FromÿtheÿBuildÿmenu,ÿchooseÿRebuildÿSolutionÿ l ForÿASP.NETÿprojects: Sinceÿtheÿwebÿkeyÿisÿcommaÿdelimited,ÿthereÿcanÿbeÿnoÿcommasÿinÿtheÿ usernameÿorÿcompanyÿnameÿfields.ÿIfÿthereÿareÿanyÿcommasÿinÿtheÿfields,ÿrerunÿtheÿlicense.exeÿorÿ licensepro.exeÿonÿyourÿCDÿorÿoriginalÿdownloadÿwithoutÿusingÿanyÿcommas.ÿThenÿrerunÿtheÿwebÿconfigÿ keyÿgenerator.ÿ

        l ForÿEndÿUserÿReportÿDesignerÿprojects: 1. Addÿtheÿlineÿ"DataDynamics.ActiveReports.Designer.Designer,ÿActiverReports.Design"ÿtoÿtheÿ licenses.licxÿfileÿmanually.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ439

        2. FromÿtheÿBuildÿmenu,ÿchooseÿRebuildÿSolution.ÿ l ForÿreportsÿcontainedÿinÿaÿDLLÿratherÿthanÿanÿEXE: AnotherÿwayÿtoÿembedÿlicensingÿinÿtheÿEXEÿisÿtoÿ copyÿtheÿlicenses.licxÿfileÿfromÿtheÿDLLÿintoÿtheÿstartupÿproject.ÿ 1. Copyÿtheÿfileÿintoÿtheÿprojectÿfolder.ÿ 2. OpenÿtheÿprojectÿandÿchooseÿtoÿviewÿallÿfilesÿinÿtheÿSolutionÿExplorer.ÿ 3. Rightÿclickÿtheÿfile,ÿandÿchooseÿtoÿincludeÿitÿinÿtheÿproject.ÿ

        ÿ 4. InÿtheÿPropertiesÿwindowÿforÿtheÿfile,ÿsetÿtheÿBuildÿActionÿtoÿEmbeddedÿResource.ÿ 5. FromÿtheÿBuildÿmenu,ÿchooseÿRebuildÿSolution.ÿ

        TroubleshootingÿExports

        Theÿfollowingÿtopicsÿexplainÿcausesÿandÿsolutionsÿforÿincorrectlyÿexportedÿreports:

        l ExcelÿExportÿTroubleshooting l HTMLÿExportÿTroubleshooting l PDFÿExportÿTroubleshooting ÿ

        l RTFÿExportÿTroubleshooting ÿ

        ÿ l TextÿExportÿTroubleshooting

        l TIFFÿExportÿTroubleshooting

        ExcelÿExportÿTroubleshooting

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms: ExtraÿcolumnsÿareÿshowingÿupÿinÿtheÿExcelÿexport. Cause: Controlsÿdon'tÿhaveÿtheÿsameÿTopÿandÿHeightÿproperties.ÿWhenÿtheÿExcelÿexportÿruns,ÿitÿdividesÿtheÿ reportÿintoÿrowsÿandÿcolumnsÿbasedÿonÿtheÿbordersÿofÿtheÿcontrols,ÿmuchÿlikeÿaÿgrid.ÿControlsÿthatÿareÿnotÿ alignedÿacrossÿtheÿreportÿcauseÿtheÿExcelÿexportÿtoÿproduceÿmoreÿcolumnsÿtoÿaccommodateÿthem.ÿ Solution: Toÿremedyÿtheÿsituation,ÿsetÿasÿmanyÿcontrolsÿwithÿtheÿsameÿLeftÿpropertyÿvaluesÿandÿtheÿsameÿ Topÿpropertyÿvaluesÿasÿyouÿcan,ÿaligningÿthemÿasÿifÿtheyÿwereÿinÿaÿgrid.ÿThisÿreducesÿtheÿnumberÿofÿcolumnsÿ exported.ÿAlso,ÿsettingÿtheÿRemoveVerticalSpaceÿorÿUseCellMergingÿpropertyÿtoÿTrue,ÿorÿsettingÿtheÿ MinColumnWidthÿpropertyÿequalÿtoÿtheÿwidthÿofÿtheÿnarrowestÿcellÿmayÿhelp.

        Symptoms: Extremelyÿlongÿreportsÿdon'tÿexportÿtoÿExcel. Cause: TheÿmaximumÿnumberÿofÿrowsÿwhichÿcanÿbeÿexportedÿtoÿMSÿExcelÿversionÿ8.0ÿorÿ9.0ÿisÿ65,536,ÿwhileÿ olderÿversionsÿofÿExcelÿ(4.0,ÿ5.0ÿandÿ7.0)ÿhadÿaÿlimitÿofÿ16,384ÿrows.ÿ HereÿareÿotherÿspecificationsÿforÿExcelÿversionÿ9.0ÿwhichÿmayÿaffectÿyourÿexport:ÿ

        l Maximumÿworksheetÿsize:ÿ65,536ÿrowsÿbyÿ256ÿcolumnsÿÿ

        l Maximumÿcolumnÿwidth:ÿ255ÿcharactersÿ l Maximumÿrowÿheight:ÿ409ÿpointsÿ

        l Maximumÿlengthÿofÿcellÿcontentsÿ(text):ÿ32,767ÿcharacters.ÿOnlyÿ1,024ÿdisplayÿinÿaÿcell;ÿallÿ32,767ÿ displayÿinÿtheÿformulaÿbar.ÿÿ Solution: UseÿtheÿExport(document,filePath,pageRange)ÿorÿExport ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ440

        (document,outputStream,pageRange)ÿmethodÿtoÿexportÿrangesÿofÿpagesÿintoÿseparateÿExcelÿdocuments.

        Symptoms: Whenÿusingÿaÿmemoryÿstream,ÿtheÿExcelÿexportÿsporadicallyÿfails. Cause: InternetÿExplorerÿrequiresÿaÿ"content-disposition"ÿheaderÿinÿtheÿresponse. Solution: Useÿcodeÿlikeÿtheÿfollowingÿbeforeÿcreatingÿtheÿexport. Response.ContentTypeÿ=ÿ"application/x-msexcel"; Response.AddHeader("content-disposition","attachment;ÿfilename=MyXLS.XLS"); Response.AddHeader("content-disposition","inline;ÿfilename=MyXLS.xls");

        Symptoms: TheÿexportedÿExcelÿfileÿdoesÿnotÿlookÿexactlyÿlikeÿtheÿoriginalÿreport. Cause: TheÿExcelÿexportÿisÿnotÿWYSIWYG.ÿItÿdoesÿnotÿsupportÿtheÿfollowingÿitems:

        l Lineÿcontrolÿ l Bordersÿonÿcontrolsÿwithÿangledÿtextÿ

        l Shapesÿ(otherÿthanÿfilledÿrects)ÿ

        ÿ l Overlappingÿcontrolsÿ Solution: TryÿtoÿavoidÿusingÿtheÿaboveÿitemsÿinÿreportsÿwhichÿwillÿbeÿexportedÿtoÿHTML.

        HTMLÿExportÿTroubleshooting

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms: TheÿexportedÿHTMLÿfileÿdoesÿnotÿlookÿexactlyÿlikeÿtheÿoriginalÿreport. Cause: TheÿHTMLÿexportÿisÿnotÿWYSIWYG.ÿItÿdoesÿnotÿsupportÿtheÿfollowingÿitems: l Lineÿcontrolÿ l Controlÿbordersÿ

        l Shapesÿ(otherÿthanÿfilledÿrects)ÿ l Overlappingÿcontrolsÿ Solution: TryÿtoÿavoidÿusingÿtheÿaboveÿitemsÿinÿreportsÿwhichÿwillÿbeÿexportedÿtoÿHTML.

        Symptoms: InternetÿExplorerÿdisplaysÿ"Invalidÿsyntaxÿerror"ÿonÿtheÿtitleÿbar,ÿ"Theÿpageÿcannotÿbeÿdisplayed"ÿ inÿtheÿbodyÿandÿtheÿurlÿisÿprependedÿwithÿ":"ÿinÿtheÿaddressÿbar.ÿ Cause: Thisÿisÿcausedÿbyÿ MicrosoftÿHotfixÿQ330994ÿ(http://support.microsoft.com/default.aspx? kbid=330994).ÿMicrosoftÿaddressedÿanÿOutlookÿsecurityÿflawÿthatÿusedÿtheÿMHTÿextensionÿandÿbrokeÿtheÿ streamingÿHTMLÿfunctionality.ÿ Solution: Appendÿtheÿ'mht'ÿextensionÿtoÿtheÿfileÿwhenÿyouÿlinkÿtoÿit.ÿForÿexample, SortSample.aspx?RunReport=true

        Wouldÿbeÿchangedÿtoÿtheÿfollowing.ÿ SortSample.aspx?RunReport=trueÿf=temp.mht

        PDFÿExportÿTroubleshooting ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ441

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms: BarcodesÿinÿprintedÿPDFÿexportsÿdoÿnotÿscanÿandÿtheÿpageÿmarginsÿappearÿlargerÿthanÿtheÿonesÿ inÿtheÿoriginalÿreport. Cause: TheÿAdobeÿAcrobatÿreaderÿhasÿaÿdefaultÿsettingÿinÿtheÿPrintÿdialogÿwhichÿtellsÿitÿtoÿscaleÿdownÿlargeÿ pages.ÿÿTheÿreaderÿviewsÿActiveReportsÿmarginsÿasÿpartÿofÿtheÿdocument,ÿandÿrendersÿthemÿinsideÿtheÿnewÿ marginsÿitÿcreates.ÿThisÿisÿnormallyÿnotÿnoticeableÿunlessÿbarcodesÿareÿusedÿorÿtheÿPDFÿprintoutÿisÿheldÿupÿ nextÿtoÿaÿprintoutÿofÿtheÿoriginalÿreport. Solution: ÿ ForÿAcrobatÿ6,ÿchangeÿtheÿfollowingÿoptionsÿinÿtheÿPrintÿdialogÿunderÿPageÿHandling: 1. SetÿPageÿscalingÿtoÿNoneÿ(theÿdefaultÿisÿShrinkÿlargeÿpages).ÿ 2. UncheckÿAuto-RotateÿandÿCenter.ÿ ForÿAcrobatÿ5,ÿuncheckÿtheÿfollowingÿoptionsÿinÿtheÿPrintÿdialog: 1. Shrinkÿoversizedÿpagesÿtoÿpaperÿsizeÿ 2. Expandÿsmallÿpagesÿtoÿpaperÿsizeÿ 3. Auto-rotateÿandÿcenterÿpagesÿ

        Symptoms: InÿtheÿWebViewer,ÿreportsÿrenderÿcorrectlyÿwithÿtheÿHTMLÿviewerÿtypeÿbutÿtheyÿshowÿupÿblankÿ withÿtheÿAcrobatReaderÿviewerÿtypeÿonÿtheÿproductionÿwebÿserver. Cause:ÿ.ArCacheItemÿisÿnotÿsetÿupÿinÿyourÿIISÿextensionÿmappings.ÿ Solution: 1. FromÿtheÿStartÿmenu,ÿchooseÿAllÿPrograms,ÿAdministrativeÿTools,ÿInternetÿInformationÿServices.ÿ 2. Right-clickÿyourÿDefaultÿWebÿSiteÿandÿchooseÿProperties.ÿ 3. OnÿtheÿHomeÿDirectoryÿtab,ÿclickÿtheÿConfiguration.ÿbutton.ÿ 4. OnÿtheÿMappingÿtab,ÿcheckÿtheÿExtensionÿcolumnÿtoÿseeÿwhetherÿ.ArCacheItemÿappearsÿthere.ÿ 5. Ifÿ.ArCacheItemÿdoesÿnotÿappearÿclickÿtheÿAddÿbutton.ÿ 6. BrowseÿtoÿC:\WINDOWS\Microsoft.NET\Framework\v1.1.4322ÿorÿ C:\WINNT\Microsoft.NET\Framework\v1.1.4322.ÿ 7. ChangeÿFilesÿofÿtype:ÿtoÿDynamicÿLinkÿlibrariesÿ(*.dll).ÿ 8. Chooseÿtheÿaspnet_isapi.dllÿandÿclickÿOpen.ÿ 9. InÿtheÿExtensionÿtextboxÿtypeÿ".ArCacheItem".ÿ 10. ClickÿtheÿLimitÿto:ÿradioÿbuttonÿandÿtypeÿ"GET,HEAD,POST,DEBUG".ÿ 11. Makeÿsureÿthatÿtheÿ"Scriptÿengine"ÿcheckboxÿisÿcheckedÿandÿtheÿ"Checkÿthatÿfileÿexists"ÿcheckboxÿisÿnotÿ checked.ÿ

        12.ÿ ClickÿOK.ÿ ÿ

        RTFÿExportÿTroubleshooting

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ442

        Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms: TheÿexportedÿRTFÿfileÿdoesÿnotÿlookÿexactlyÿlikeÿtheÿoriginalÿreport. Cause: TheÿRTFÿexportÿisÿnotÿWYSIWYG,ÿandÿisÿbasedÿonÿWordPadÿratherÿthanÿWord,ÿsoÿthereÿareÿaÿnumberÿ ofÿlimitations.ÿÿTheÿfollowingÿitemsÿareÿnotÿsupportedÿinÿtheÿRTFÿexport. l Lineÿcontrolsÿ

        l Backcolorÿ

        l Shapeÿcontrolsÿ l Overlappingÿcontrolsÿ

        l Controlÿbordersÿ(exceptÿforÿbordersÿonÿtheÿRichTextBoxÿcontrol,ÿwhichÿareÿsupported)ÿ

        ÿ l Angledÿtextÿ Solution: TryÿtoÿavoidÿusingÿtheÿaboveÿitemsÿinÿreportsÿwhichÿwillÿbeÿexportedÿtoÿRTF.

        TextÿExportÿTroubleshooting

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms: Theÿexportedÿtextÿfileÿdoesÿnotÿlookÿexactlyÿlikeÿtheÿoriginalÿreport. Cause: TheÿtextÿexportÿisÿnotÿWYSIWYG.ÿItÿisÿlimitedÿtoÿplainÿtext,ÿorÿplainÿtextÿwithÿencodingÿforÿforeignÿ

        languageÿsupport.ÿÿ Solution: OnlyÿuseÿtheÿTextÿexportÿwhenÿtheÿoutputÿshouldÿbeÿplainÿtext.

        TIFFÿExportÿTroubleshooting

        Symptoms: Theÿ"SpecifiedÿCastÿIsÿNotÿValid"ÿexceptionÿfires. Cause: Thereÿisÿaÿmixÿofÿoldÿandÿnewÿdllsÿinÿtheÿreferences. Solution: 1. RemoveÿallÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿfromÿtheÿproject.ÿ 2. AddÿtheÿActiveReportsÿforÿ.NETÿ3.0ÿreferencesÿnecessaryÿtoÿyourÿproject,ÿmakingÿsureÿtoÿuseÿonlyÿ referencesÿtoÿassembliesÿfromÿtheÿlatestÿbuildÿinstalledÿonÿyourÿmachine.ÿ

        Symptoms:ÿReportsÿexportedÿtoÿTIFFÿformatÿwithÿtheÿRLEÿorÿCCITT3ÿcompressionÿschemeÿareÿrenderingÿ black. Cause: TheÿsectionsÿinÿtheÿreportsÿhaveÿaÿBackColorÿandÿareÿnotÿbeingÿdithered. Solution: SetÿtheÿDitherÿpropertyÿforÿtheÿexportÿobjectÿtoÿTrue,ÿorÿsetÿtheÿBackColorÿpropertyÿofÿeachÿsectionÿ toÿTransparent. ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ443

        Symptoms: SomeÿreportsÿareÿexportedÿtoÿTIFFÿwithÿextraÿwhiteÿspaceÿatÿtheÿbottomÿofÿtheÿpage. Cause: TheÿdefaultÿvalueÿforÿCompressionSchemeÿisÿCCITT3.ÿÿAccordingÿtoÿCCITT3ÿstandards,ÿtheÿpageÿsizeÿ isÿ1728ÿxÿ2376ÿpixelsÿandÿtheÿresolutionÿisÿ200ÿxÿ196ÿDPI,ÿasÿrequiredÿbyÿsomeÿfaxÿmachines.ÿIfÿtheÿpageÿisÿ smallerÿthanÿthisÿstandard,ÿthenÿitÿisÿscaledÿupÿtoÿCCITT3ÿstandards,ÿwhichÿcanÿcauseÿextraÿwhiteÿspaceÿatÿ theÿbottom.

        Solution:ÿ ToÿgetÿanÿaccurateÿpageÿsizeÿsetÿtheÿCompressionSchemeÿtoÿCompressionScheme.Rleÿ(Runÿlengthÿ encoding).

        TroubleshootingÿMemoryÿIssues

        Symptoms: ActiveReportsÿisÿconsumingÿtooÿmuchÿmemoryÿandÿtheÿCPUÿusageÿisÿatÿ100%. NOTE: TheÿCPUÿusageÿwillÿalwaysÿgoÿtoÿ100%ÿwhenÿusingÿActiveReports. Thereÿareÿseveralÿreasonsÿwhyÿtooÿmuchÿmemoryÿmayÿbeÿconsumed:

        Cause:ÿTheÿreportÿisÿnotÿbeingÿdisposedÿofÿproperly.ÿTheÿincorrectÿsyntaxÿisÿasÿfollows.ÿ [VisualÿBasic.NET] rpt.Dispose() rpt=Nothing [C#] rpt.Dispose(); rpt=null; Solution:ÿTheÿcorrectÿsyntaxÿforÿdisposingÿofÿaÿreportÿproperlyÿisÿasÿfollows.ÿ [VisualÿBasic.NET] rpt.Document.Dispose() rpt.Dispose() rpt=Nothing [C#] rpt.Document.Dispose(); rpt.Dispose(); rpt=null;

        Cause:ÿLargeÿreportsÿinÿanÿASP.NETÿapplicationÿcanÿeasilyÿuseÿupÿtheÿ60%ÿofÿmemoryÿallocatedÿtoÿtheÿ ASP.NETÿworkerÿprocessÿbyÿdefault,ÿwhichÿproducesÿanÿerror.ÿInÿMachine.Config,ÿMemoryLimitÿspecifiesÿtheÿ maximumÿallowedÿmemoryÿsize,ÿasÿaÿpercentageÿofÿtotalÿsystemÿmemory,ÿthatÿtheÿworkerÿprocessÿcanÿ consumeÿbeforeÿASP.NETÿlaunchesÿaÿnewÿprocessÿandÿreassignsÿexistingÿrequests.ÿ Solution:ÿSetÿtheÿCacheToDiskÿpropertyÿofÿtheÿdocumentÿtoÿTrue.ÿÿThisÿwillÿcacheÿtheÿreportÿtoÿdiskÿinsteadÿ ofÿholdingÿitÿinÿmemory.ÿThisÿsettingÿisÿalsoÿdetectedÿbyÿtheÿPDFÿExport,ÿwhichÿwillÿfollowÿsuit,ÿbutÿanyÿotherÿ exportsÿwillÿstillÿconsumeÿmemory.ÿAlthoughÿitÿisÿnotÿadvised,ÿtheÿASP.NETÿworkerÿprocessÿmemoryÿallocationÿ canÿalsoÿbeÿchangedÿinÿyourÿMachine.Configÿfile,ÿwhichÿisÿlocatedÿinÿaÿpathÿlike:ÿ C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\.ÿÿSearchÿtheÿMachine.Configÿfileÿ forÿmemoryLimitÿwhichÿisÿlocatedÿinÿtheÿprocessModel.ÿ

        Cause:ÿInÿsomeÿcases,ÿveryÿlargeÿreportsÿcanÿconsumeÿsoÿmuchÿmemoryÿthatÿtheÿreportÿneverÿfinishesÿ processing.ÿSomeÿofÿtheÿthingsÿthatÿcanÿcauseÿthisÿinclude:ÿ 1. Theÿuseÿofÿmanyÿnon-repeatingÿimages,ÿorÿaÿhighÿresolutionÿrepeatingÿimageÿ 2. Instantiatingÿaÿnewÿinstanceÿofÿaÿsubreportÿeachÿtimeÿtheÿformatÿeventÿofÿaÿsectionÿfiresÿ 3. UsingÿaÿlotÿofÿsubreportsÿinsteadÿofÿgroupingÿbyÿdoingÿjoinsÿinÿtheÿSQLÿqueryÿ 4. Pullingÿinÿallÿofÿtheÿdataÿwhenÿonlyÿaÿfewÿfieldsÿareÿneeded,ÿi.e.ÿSelectÿ*ÿfromÿdbÿinsteadÿofÿSelectÿFirst,ÿ Last,ÿAddressÿfromÿdbÿ Solution:ÿInÿcasesÿwhereÿtheÿreportÿisÿtooÿlargeÿtoÿrunÿanyÿotherÿway,ÿtheÿCacheToDiskÿpropertyÿmayÿbeÿsetÿ toÿTrue.ÿThisÿpropertyÿshouldÿonlyÿbeÿusedÿwhenÿthereÿisÿnoÿotherÿwayÿtoÿrunÿtheÿreportÿtoÿcompletion.ÿBeforeÿ resortingÿtoÿthisÿmethod,ÿpleaseÿseeÿtheÿOptimizingÿActiveReports topic.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ444

        Cause:ÿIfÿinflatedÿmemoryÿusageÿisÿseenÿinÿtheÿTaskÿManagerÿitÿisÿnotÿnecessarilyÿinÿuseÿbyÿtheÿcode.ÿTaskÿ managerÿindicatesÿtheÿcurrentÿ"workingÿset"ÿofÿtheÿprocessÿand,ÿuponÿrequest,ÿotherÿprocessesÿcanÿgainÿ accessÿtoÿthatÿmemory.ÿItÿisÿmanagedÿbyÿtheÿOS.ÿ Solution:ÿForÿanÿexampleÿofÿsomeÿworkingÿsetÿbehaviorÿanomaliesÿ(whichÿareÿconsideredÿnormal),ÿcreateÿaÿ WinFormsÿapplicationÿandÿrunÿit.ÿLookÿinÿTaskÿManagerÿatÿtheÿworkingÿsetÿforÿthatÿprocessÿ(itÿshouldÿbeÿ severalÿmegabytes),ÿthenÿminimizeÿandÿmaximizeÿtheÿformÿandÿnoticeÿthatÿtheÿworkingÿsetÿreclaimsÿtoÿ<1MB.ÿ Obviously,ÿtheÿcodeÿwasÿnotÿusingÿallÿthatÿmemoryÿevenÿthoughÿTaskÿManagerÿshowedÿthatÿitÿwasÿallocatedÿ toÿthatÿprocess.ÿSimilarly,ÿyou'llÿseeÿASP.NETÿandÿotherÿmanagedÿserviceÿprocessesÿcontinueÿtoÿgraduallyÿ growÿtheirÿworkingÿsetÿevenÿthoughÿtheÿmanagedÿcodeÿinÿthatÿprocessÿisÿnotÿusingÿallÿofÿit.ÿToÿseeÿwhetherÿ thisÿisÿtheÿcase,ÿtryÿusingÿtheÿtwoÿlinesÿofÿcodeÿbelowÿunderÿaÿbuttonÿafterÿrunningÿtheÿproject. System.Diagnostics.Processÿpcÿ=ÿSystem.Diagnostics.Process.GetCurrentProcess(); pc.MaxWorkingSetÿ=ÿpc.MinWorkingSet; IfÿthatÿreclaimsÿtheÿmemoryÿthenÿtheÿOSÿtrimmedÿtheÿworkingÿsetÿdownÿtoÿtheÿminimumÿamountÿnecessaryÿ andÿthisÿindicatesÿthatÿtheÿextraÿmemoryÿwasÿnotÿactuallyÿinÿuse.

        Note:ÿAccordingÿtoÿMicrosoftÿitÿisÿnotÿnecessaryÿtoÿcallÿGC.Collectÿandÿitÿshouldÿbeÿavoided.ÿHowever,ÿifÿ callingÿGC.Collectÿreducesÿtheÿmemoryÿleak,ÿthenÿthisÿindicatesÿthatÿitÿisÿnotÿaÿleakÿafterÿall.ÿAÿleakÿinÿ ÿ managedÿcodeÿisÿcausedÿbyÿholdingÿaÿreferenceÿtoÿanÿobjectÿindefinitely.ÿIfÿActiveReportsÿisÿholdingÿaÿ referenceÿtoÿanÿobject,ÿthenÿtheÿobjectÿcannotÿbeÿcollectedÿbyÿtheÿgarbageÿcollector.ÿ

        TroubleshootingÿParameters

        Symptoms: AnÿerrorÿmessageÿisÿdisplayedÿinÿtheÿFieldsÿlistÿinÿtheÿReportÿExplorerÿinsteadÿofÿtheÿfields.ÿ Cause: Thisÿisÿanÿexpectedÿerrorÿifÿnoÿdefaultÿvalueÿisÿgiven.ÿIfÿtheÿfieldÿisÿaÿdataÿtypeÿotherÿthanÿtext,ÿ memo,ÿorÿdate/timeÿinÿAccess,ÿtheÿreportÿwillÿrunÿnormally.ÿ Solution: ToÿdisplayÿtheÿfieldsÿinÿtheÿFieldsÿlistÿinÿtheÿReportÿExplorer,ÿsupplyÿaÿdefaultÿvalueÿforÿtheÿ parameter,ÿi.e.ÿ <%FieldNameÿ|ÿPromptStringÿ|ÿDefaultValue |ÿType%>

        Symptoms: Whenÿtheÿreportÿisÿrun,ÿanÿexceptionÿlikeÿtheÿfollowingÿoccurs:ÿ"Anÿunhandledÿexceptionÿofÿtypeÿ 'System.Data.OleDb.OleDbException'ÿoccurredÿinÿsystem.data.dll"ÿ Cause:ÿIfÿtheÿfieldÿisÿaÿtext,ÿmemo,ÿorÿdate/timeÿdataÿtypeÿinÿAccess,ÿtheÿparameterÿsyntaxÿrequiresÿsingleÿ quotesÿforÿtextÿorÿmemoÿfields,ÿorÿpoundÿsignsÿforÿdate/timeÿfields.ÿPleaseÿnoteÿthatÿforÿdifferentÿdataÿ sources,ÿtheseÿrequirementsÿmayÿdiffer.ÿ Solution: ToÿavoidÿtheÿexceptionÿwhenÿtheÿreportÿisÿrunÿagainstÿanÿAccessÿdatabase,ÿuseÿpoundÿsignsÿforÿ date/timeÿvalues,ÿorÿsingleÿquotesÿforÿstringÿvalues,ÿi.e.ÿ #<%InvoiceDateÿ|ÿChooseÿinvoiceÿdate:ÿ|ÿ11/2/04ÿ|ÿD%># orÿ '<%Countryÿ|ÿCountry:ÿ|ÿGermanyÿ|ÿS%>'ÿ

        Symptoms: Theÿparameterÿuserÿinterfaceÿpopsÿupÿatÿrunÿtimeÿaskingÿforÿaÿvalueÿevenÿthoughÿtheÿmainÿ reportÿisÿsupplyingÿtheÿparameterÿvaluesÿforÿtheÿsubreports.ÿ Cause:ÿTheÿdefaultÿvalueÿofÿtheÿShowParameterUIÿpropertyÿofÿtheÿreportÿisÿTrue.ÿ

        Solution:ÿÿ SetÿtheÿShowParameterUIÿpropertyÿofÿtheÿreportÿtoÿFalse.ÿThisÿcanÿbeÿdoneÿinÿtheÿpropertyÿgridÿorÿ inÿcodeÿinÿtheÿReportStartÿevent.ÿ

        TroubleshootingÿPrinting

        Symptoms: Inÿtheÿviewer,ÿtheÿreportÿisÿrenderingÿtoÿaÿdifferentÿpaperÿsizeÿthanÿtheÿoneÿspecified.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ445

        Cause:ÿActiveReportsÿpollsÿtheÿprinterÿdriverÿassignedÿtoÿtheÿreportÿtoÿcheckÿforÿclipping,ÿmargins,ÿandÿpaperÿ sizesÿsupportedÿbyÿtheÿprinter.ÿÿIfÿtheÿpaperÿsizeÿspecifiedÿforÿtheÿreportÿisÿnotÿsupportedÿbyÿtheÿprinter,ÿ ActiveReportsÿwillÿuseÿtheÿprinter'sÿdefaultÿpaperÿsizeÿtoÿrenderÿtheÿreport.ÿ Solution:ÿIfÿtheÿreportÿisÿtoÿbeÿprinted,ÿtheÿprinterÿassignedÿtoÿtheÿreportÿmustÿsupportÿtheÿpaperÿsizeÿandÿ margins.ÿPleaseÿnoteÿthatÿanyÿchangesÿtoÿtheÿprintÿsettingsÿinÿcodeÿmustÿbeÿmadeÿinÿorÿbeforeÿtheÿ ReportStartÿevent.ÿToÿuseÿcustomÿpaperÿsizesÿnotÿsupportedÿbyÿtheÿdriver,ÿsetÿtheÿPrinterNameÿtoÿanÿemptyÿ stringÿtoÿuseÿtheÿActiveReportsÿvirtualÿprintÿdriver.ÿThisÿwillÿnotÿallowÿprinting,ÿbutÿisÿrecommendedÿforÿ reportsÿthatÿareÿonlyÿexportedÿorÿviewed.ÿThisÿwillÿpreventÿActivereportsÿfromÿmakingÿaÿcallÿtoÿtheÿdefaultÿ printerÿdriver.ÿUseÿtheÿfollowingÿcodeÿinÿtheÿReportStartÿevent,ÿorÿjustÿbeforeÿ.Runÿisÿcalled.ÿ Me.Document.Printer.PrinterNameÿ=ÿ""ÿ TheÿPaperHeightÿandÿPaperWidthÿproperties,ÿwhichÿtakeÿaÿfloatÿvalueÿdefinedÿinÿinches,ÿwillÿhaveÿnoÿeffectÿ unlessÿyouÿsetÿtheÿPaperKindÿpropertyÿtoÿCustom.ÿHereÿisÿsomeÿsampleÿcodeÿwhichÿcanÿbeÿplacedÿinÿtheÿ ReportStartÿevent,ÿorÿjustÿbeforeÿ.Run. Me.PageSettings.PaperKindÿ=ÿDrawing.Printing.PaperKind.Custom Me.PageSettings.PaperHeightÿ=ÿ2 'setsÿtheÿheightÿtoÿtwoÿinches Me.PageSettings.PaperWidthÿ=ÿ4 'setsÿtheÿwidthÿtoÿfourÿinches

        Symptoms: Customÿpaperÿsizesÿdoÿnotÿwork.ÿ Cause:ÿThereÿcanÿbeÿseveralÿcustomÿpaperÿsizes,ÿsoÿsettingÿonlyÿtheÿPaperKindÿpropertyÿisÿnotÿenoughÿ toÿcreateÿaÿcustomÿpaperÿsize.ÿ Solution:ÿInÿadditionÿtoÿsettingÿtheÿPaperKindÿpropertyÿtoÿCustom,ÿyouÿmustÿalsoÿsetÿtheÿPaperNameÿ propertyÿtoÿaÿuniqueÿstring.

        Symptoms: Blankÿpagesÿareÿprintedÿbetweenÿpagesÿofÿtheÿreport.ÿ Cause:ÿThisÿproblemÿoccursÿwhenÿtheÿPrintWidthÿplusÿtheÿleftÿandÿrightÿmarginsÿexceedsÿtheÿpaperÿwidth.ÿForÿ example,ÿifÿtheÿpaperÿsizeÿwereÿsetÿtoÿA4,ÿtheÿPrintWidthÿplusÿtheÿleftÿandÿrightÿmarginsÿshouldÿnotÿexceedÿ 8.27";ÿotherwiseÿblankÿpagesÿwillÿbeÿprinted.ÿAtÿrunÿtime,ÿActiveReportsÿmarksÿaÿpageÿoverflowÿbyÿdisplayingÿ aÿredÿlineÿinÿtheÿviewerÿatÿtheÿpositionÿinÿwhichÿtheÿbreachÿhasÿoccurred.ÿ Solution:ÿTheÿPrintWidthÿcanÿbeÿadjustedÿinÿtheÿreportÿdesignerÿusingÿeitherÿtheÿpropertyÿgridÿorÿbyÿdraggingÿ theÿrightÿedgeÿofÿtheÿreport.ÿPageÿmargins,ÿheight,ÿandÿwidthÿcanÿbeÿadjustedÿeitherÿthroughÿtheÿprintÿ propertiesÿdialogÿboxÿinÿtheÿReportÿmenuÿunderÿSettings.ÿorÿprogrammaticallyÿinÿtheÿReport_Startÿevent.

        Symptoms: TheÿWebViewerÿwillÿnotÿautomaticallyÿprintÿaÿreportÿwithoutÿdisplayingÿit.ÿ Cause:ÿTheÿWebViewerÿprovidesÿconvenienceÿinÿautomatingÿmanyÿofÿtheÿstepsÿinvolvedÿinÿprovidingÿaÿ reportingÿsolution,ÿbutÿtheÿcostÿofÿthisÿautomationÿisÿaÿlossÿofÿcontrolÿofÿtheseÿsteps.ÿ Solution:ÿInÿorderÿtoÿprovideÿnoÿtouchÿprintingÿinÿASP.NET,ÿstreamÿtheÿfileÿtoÿtheÿActiveXÿviewerÿcontrolÿandÿ thenÿprintÿusingÿvbscriptÿinÿtheÿHTMLÿviewÿofÿtheÿASPÿratherÿthanÿtheÿASPÿcodeÿbehind.ÿ 1. PlaceÿtheÿActiveXÿControlÿonÿtheÿpageÿasÿanÿobject.ÿSettingÿtheÿversionÿtoÿ-1,-1,-1,-1ÿforcesÿInternetÿ Explorerÿtoÿcheckÿforÿupdatesÿeachÿtimeÿtheÿpageÿisÿrendered.ÿSettingÿtheÿheightÿandÿwidthÿtoÿ0ÿallowsÿ youÿtoÿprintÿtheÿreportÿwithoutÿdisplayingÿit.ÿHereÿisÿtheÿcodeÿthatÿgoesÿinÿtheÿHTMLÿviewÿofÿtheÿASPXÿ page. 2. Loadÿtheÿdataÿintoÿtheÿreport.ÿSetÿtheÿDataPathÿofÿtheÿviewerÿobject.ÿThisÿcanÿbeÿanythingÿfromÿaÿbyteÿ arrayÿtoÿaÿhardÿcodedÿpath.ÿ ÿ ÿ

        TroubleshootingÿtheÿWebViewer

        Symptoms: InÿtheÿWebViewer,ÿreportsÿrenderÿcorrectlyÿwithÿtheÿHTMLÿviewerÿtypeÿbutÿtheyÿshowÿupÿblankÿ withÿtheÿAcrobatReaderÿviewerÿtypeÿonÿtheÿproductionÿwebÿserver. Cause:ÿ.ArCacheItemÿisÿnotÿsetÿupÿinÿyourÿIISÿextensionÿmappings.ÿ Solution: 1. FromÿtheÿStartÿmenu,ÿchooseÿControlÿPanel> AdministrativeÿTools> InternetÿInformationÿ Services.ÿ 2. Right-clickÿyourÿDefaultÿWebÿSiteÿandÿchooseÿProperties.ÿ 3. OnÿtheÿHomeÿDirectoryÿtab,ÿclickÿtheÿConfiguration button.ÿ 4. OnÿtheÿMappingÿtab,ÿcheckÿtheÿExtensionÿcolumnÿtoÿseeÿwhetherÿ.ArCacheItemÿappears.ÿ 5. Ifÿ.ArCacheItemÿdoesÿnotÿappearÿclickÿtheÿAdd button.ÿ 6. Browseÿtoÿ\Microsoft.NET\Framework\v1.1.4322ÿorÿv2.0.50727.ÿ 7. ChangeÿFilesÿofÿtype:ÿtoÿDynamicÿLinkÿlibrariesÿ(*.dll).ÿ 8. Chooseÿtheÿaspnet_isapi.dllÿandÿclickÿOpen.ÿ 9. InÿtheÿExtensionÿtextboxÿtypeÿ".ArCacheItem".ÿ 10. ClickÿtheÿLimitÿto:ÿradioÿbuttonÿandÿtypeÿ"GET,HEAD,POST,DEBUG".ÿ 11. Makeÿsureÿthatÿtheÿ"Scriptÿengine"ÿcheckÿboxÿisÿselectedÿandÿtheÿ"Checkÿthatÿfileÿexists"ÿcheckÿboxÿisÿnot.ÿ 12. ClickÿOK.ÿ

        Symptoms:ÿ"ErrorÿCreatingÿControlÿ- Webviewer"ÿappearsÿonÿtheÿWebFormÿinÿplaceÿofÿtheÿWebViewerÿ control. Cause: Thereÿisÿaÿversionÿconflictÿwithinÿtheÿproject. Solution:ÿ 1. OpenÿtheÿWebFormÿandÿlookÿinÿtheÿHTMLÿviewÿforÿaÿlineÿthatÿlooksÿsimilarÿtoÿtheÿfollowingÿandÿremoveÿit.ÿ <%@ÿRegisterÿTagPrefix="activereportsweb"ÿNamespace="DataDynamics.ActiveReports.Web"ÿ Assembly="ActiveReports.Web,ÿVersion=5.0.0.84,ÿCulture=neutral,ÿ PublicKeyToken=cc4967777c49a3ff"%> 2. GoÿtoÿtheÿcodeÿbehindÿtheÿWebFormÿandÿremoveÿtheÿfollowingÿlineÿfromÿtheÿWebÿFormÿDesignerÿ GeneratedÿCode.ÿ ProtectedÿWithEventsÿWebViewer1ÿAsÿDataDynamics.ActiveReports.Web.WebViewerÿ 3. InÿtheÿSolutionÿExplorer,ÿunderÿReferences,ÿrightÿclickÿandÿRemoveÿtheÿActiveReports.Viewerÿandÿ ActiveReports.Webÿreferences.ÿ 4. DeleteÿtheÿcontrolÿfromÿtheÿWebForm.ÿ 5. AddÿbackÿtheÿreferencesÿforÿActiveReports.ViewerÿandÿActiveReports.Web,ÿmakingÿcertainÿthatÿtheÿ Versionÿnumberÿisÿtheÿsameÿasÿtheÿcurrentlyÿinstalledÿversion.ÿ 6. AddÿtheÿWebViewerÿbackÿtoÿtheÿWebForm.ÿ 7. OpenÿtheÿWeb.configÿfileÿinÿtheÿsolution,ÿandÿscrollÿdownÿtoÿtheÿhttpHandlersÿtagÿnearÿtheÿbottom.ÿThereÿ areÿthreeÿaddÿverbÿtagsÿonÿthatÿlineÿwhichÿindicateÿtheÿVersion.ÿTheseÿneedÿtoÿbeÿupdatedÿwithÿtheÿ versionÿnumberÿofÿtheÿcurrentlyÿinstalledÿversion.ÿ ActiveReportsÿforÿ.NETÿ3ÿUserÿGuideÿ|ÿ447

        Symptoms: l TheÿiconsÿareÿmissingÿonÿmyÿWebViewerÿcontrol.ÿ l UsingÿtheÿActiveXÿViewerType,ÿthisÿerrorÿoccurs:ÿ"Errorÿ5013ÿ:ÿInvalidÿDataPath.ÿCannotÿloadÿdata."ÿ Cause:ÿTheÿhttpHandlersÿinÿtheÿWeb.configÿfileÿareÿmissingÿorÿreferencingÿtheÿwrongÿversion. Solution:ÿMakeÿsureÿthatÿtheÿfollowingÿHTTPÿHandlerÿcodeÿisÿinÿtheÿWeb.configÿfileÿandÿthatÿtheÿversionÿisÿ current.ÿ

        Symptoms: TheÿreportÿinÿtheÿHTMLÿviewerÿtypeÿdoesÿnotÿlookÿexactlyÿlikeÿtheÿotherÿviewerÿtypes. Cause: TheÿHTMLÿformatÿisÿnotÿWYSIWYG.ÿItÿdoesÿnotÿsupportÿtheÿfollowingÿitems: l Lineÿcontrolÿ

        l Controlÿbordersÿ

        l Shapesÿ(otherÿthanÿfilledÿrects)ÿ l Overlappingÿcontrolsÿ Solution: TryÿtoÿavoidÿusingÿtheÿaboveÿitemsÿinÿreportsÿwhichÿwillÿbeÿshownÿinÿHTMLÿformat.

        Symptoms:

        l TheÿWebViewerÿstaysÿonÿtheÿpageÿnumberÿlastÿviewedÿinÿtheÿpreviousÿreportÿwhenÿaÿuserÿselectsÿaÿnewÿ reportÿorÿrefreshesÿtheÿcurrentÿreport.ÿÿ

        l Theÿreportÿisÿnotÿgettingÿupdatedÿwithÿnewÿdata.ÿ Cause: Ifÿtheÿcontrolÿisÿbeingÿloadedÿinÿresponseÿtoÿaÿclientÿpostback,ÿtheÿReportÿpropertyÿwillÿnotÿrunÿtheÿ specifiedÿreport.ÿInsteadÿitÿusesÿaÿpreviouslyÿcachedÿcopyÿofÿtheÿreport'sÿDocumentÿinÿtheÿWebCacheÿserviceÿ toÿsupplyÿspeedyÿresponsesÿtoÿclients.ÿÿ Solution: Toÿforceÿtheÿclientÿtoÿuseÿaÿnewÿinstance,ÿcallÿtheÿClearCachedReport methodÿbeforeÿsettingÿtheÿ Reportÿproperty.

        Symptoms: TheÿWebViewerÿwillÿnotÿautomaticallyÿprintÿaÿreportÿwithoutÿdisplayingÿit.ÿ Cause:ÿTheÿWebViewerÿprovidesÿconvenienceÿinÿautomatingÿmanyÿofÿtheÿstepsÿinvolvedÿinÿprovidingÿaÿ reportingÿsolution,ÿbutÿtheÿcostÿofÿthisÿautomationÿisÿaÿlossÿofÿcontrolÿofÿtheseÿsteps.ÿ Solution:ÿInÿorderÿtoÿprovideÿnoÿtouchÿprintingÿinÿASP.NET,ÿstreamÿtheÿfileÿtoÿtheÿActiveXÿviewerÿcontrolÿandÿ thenÿprintÿusingÿvbscriptÿinÿtheÿASPÿcodeÿ(notÿtheÿASPÿcodeÿbehind).ÿ 1. PlaceÿtheÿActiveXÿControlÿonÿtheÿpageÿasÿanÿobject.ÿSettingÿtheÿversionÿtoÿ-1,-1,-1,-1ÿforcesÿInternetÿ Explorerÿtoÿcheckÿforÿupdatesÿeachÿtimeÿtheÿpageÿisÿrendered.ÿSettingÿtheÿheightÿandÿwidthÿtoÿ0ÿallowsÿ youÿtoÿprintÿtheÿreportÿwithoutÿdisplayingÿit.ÿHereÿisÿtheÿcodeÿthatÿgoesÿinÿtheÿASPXÿpage.ÿ 2. Loadÿtheÿdataÿintoÿtheÿreport.ÿSetÿtheÿDataPathÿofÿtheÿviewerÿobject.ÿThisÿcanÿbeÿanythingÿfromÿaÿbyteÿ arrayÿtoÿaÿhardÿcodedÿpath.ÿ

        VisualÿStudioÿ2005ÿWebÿProjectÿConversion

        Symptoms:ÿTheÿReportAssemblyÿprojectÿdoesÿnotÿconvertÿtoÿVisualÿStudioÿ2005. Cause: Theÿ*.csÿorÿ*.vbÿfileÿnameÿisÿnotÿcorrectÿinÿtheÿCodeFileÿattributeÿinÿtheÿ*.rpxÿfile. Solution: EnsureÿthatÿtheÿCodeFileÿattributeÿofÿtheÿActiveReportsLayoutÿisÿtheÿsameÿasÿtheÿactualÿfileÿ containingÿcodeÿforÿtheÿreport.ÿ

        CopyingÿReportsÿResultsÿinÿStackedÿControls

        Symptoms: Aÿreportÿfileÿcopiedÿintoÿaÿnewÿprojectÿhasÿallÿofÿitsÿcontrolsÿpiledÿupÿatÿlocationÿ0,ÿ0.ÿ Cause:ÿTheÿreportÿhasÿbecomeÿdisconnectedÿfromÿitsÿresourceÿfile.ÿ Solution:ÿWhenÿyouÿcopyÿaÿreport'sÿ*.vbÿfileÿfromÿoneÿproject'sÿApp_CodeÿfolderÿintoÿtheÿApp_Codeÿfolderÿofÿ aÿnewÿproject,ÿyouÿneedÿtoÿalsoÿcopyÿitsÿ*.resxÿfileÿfromÿtheÿoriginalÿproject'sÿApp_GlobalResourcesÿfolderÿÿ intoÿtheÿnewÿproject'sÿApp_GlobalResourcesÿfolder.

        TroubleshootingÿErrorsÿAfterÿNewÿBuildÿInstallation

        Symptoms: WhenÿyouÿopenÿaÿprojectÿcreatedÿwithÿaÿpreviousÿbuildÿofÿActiveReportsÿafterÿinstallingÿaÿnewÿ build,ÿthereÿareÿerrorsÿrelatedÿtoÿbeingÿunableÿtoÿfindÿtheÿpreviousÿbuild.ÿ Cause:ÿVisualÿStudioÿ2005ÿhasÿaÿnewÿpropertyÿonÿreferencesÿcalledÿSpecificÿVersion.ÿIfÿthisÿpropertyÿisÿsetÿtoÿ True,ÿtheÿprojectÿlookosÿforÿtheÿspecificÿversionÿandÿthrowsÿerrorsÿwhenÿitÿcannotÿfindÿit.ÿ Solution:ÿDeleteÿtheÿActiveReportsÿreferencesÿandÿre-addÿthem.ÿ(InÿWebÿprojects,ÿdoÿthisÿfromÿtheÿWebsiteÿ menu,ÿStartÿOptions,ÿReferencesÿtab.ÿÿInÿWinFormsÿprojects,ÿdoÿthisÿfromÿtheÿProjectÿmenu,ÿÿ ProjectName Properties,ÿReferencesÿtab.)

        TroubleshootingÿControlsÿinÿSubreports

        Symptoms: Whenÿyouÿrunÿaÿprojectÿwithÿnestedÿsubreports,ÿsomeÿofÿtheÿcontrolsÿdoÿnotÿdisplay.ÿ Cause:ÿControlsÿcouldÿbeÿoverlappingÿorÿtheÿsectionÿfollowingÿaÿheaderÿwithÿtheÿUnderlayNextÿpropertyÿsetÿtoÿ Trueÿmightÿhaveÿaÿnon-transparentÿBackColor.ÿ Solution:ÿTemporarilyÿuseÿtheÿBackColorÿpropertiesÿofÿsectionsÿorÿcontrolsÿtoÿmoreÿeasilyÿspotÿtheirÿlocationsÿ atÿrunÿtime,ÿthenÿrearrangeÿthemÿasÿneeded.ÿTakeÿcareÿtoÿleaveÿtheÿBackColorÿpropertyÿTransparentÿforÿanyÿÿ sectionÿfollowingÿaÿheaderÿwithÿtheÿUnderlayNextÿpropertyÿsetÿtoÿTrue.