Annotations can be placed on the report view via the Annotations button on the toolbar of the viewer control. 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 and accompanying annotations as an RDF.
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 viewer's toolbar or at run time through the Annotations collection.
To add annotations from the viewer
- Click the Annotations button on the ActiveReports for .NET 3.0 Viewer toolbar.
- Select the type of annotation you want to add from the annotation menu and drag it onto the viewer.
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.
- 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 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"); }