You or your users can add notes, special instructions, even images, directly to the ActiveReport, making team collaboration, feedback, and support an easier task. Annotations are added in two ways: via the viewer's toolbar, or in code.
Annotations added via the viewer's toolbar are temporary. They reside on the Page object in which they are placed, and are destroyed when the report closes. In order to save annotations you must save the report data and accompanying annotations to RDF format.
Each annotation type allows you to change the colors, transparency, border, font, and alignment, plus other properties specific to the type of annotation. Available annotations include:
- AnnotationText A rectangular box in which you can enter text.
- AnnotationCircle A circle without text. You can change the shape to an oval.
- AnnotationRectangle A rectangular box without text.
- AnnotationArrow A 2D arrow in which you can enter text. You can change the arrow direction.
- AnnotationBalloon A balloon caption in which you can enter text. You can point the balloon's tail in any direction.
- AnnotationLine A line with text above or below it. You can add arrow caps to one or both ends and select different dash styles.
- AnnotationImage A rectangle with a background image and text. You can select an image and its position, and place text on the image.
To add annotations using the viewer
- Load a report into the viewer and click the Annotations button on the toolbar.
-
Click the annotation you want to add and drag it onto the report.
-
Drag the corners to resize the annotation as needed, or drag the center to relocate it.
To change the properties of an annotation in the viewer
- Right-click the annotation and select Properties.

- In the Annotation Properties window that appears, add text, change the alignment, set colors, and use any other special properties to make the annotation appear the way you want it.
To save annotations
You can save annotations along with report data into an RDF file. The following example shows how to add a Save Annotated Report button to the viewer.
- From the Visual Studio toolbox, drag a Button control onto the viewer.
- Set the Text property of the button to Save Annotated Report.
- Double-click the button. This creates an event-handling method for the button Click event.
- Add code to the click handler to save the document to an RDF file.

Tip: See Save and Load Report Files (RDF) for more information on loading the saved RDF file into the viewer.
To write the code in Visual Basic.NET
| Visual Basic.NET code. Paste INSIDE the button Click event. | Copy Code |
|---|---|
| Me.Viewer1.Document.Save("C:\\UserAnnotations.rdf") | |
| C# code. Paste INSIDE the button Click event. | Copy Code |
|---|---|
| this.viewer1.Document.Save("C:\\UserAnnotations.rdf"); | |
To add annotations in code
The following example shows how to add annotations at run time and save the report data and annotations to an RDF file.
- Double-click the title bar of the form in which you host the viewer. This creates an event-handling method for the form Load event.
- Add code to the handler to run the report, add annotations, display the report in the viewer, and save it into an RDF file.
To write the code in Visual Basic.NET
| Visual Basic.NET code. Paste ABOVE the class. | Copy Code |
|---|---|
| Imports DataDynamics.ActiveReports.Document.Annotations | |
| Visual Basic.NET code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
Dim rpt As New NewActiveReport1
'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 with the report in an RDF file
rpt.Document.Save("C:\\AnnotatedReport.rdf")
| |
| C# code. Paste ABOVE the class. | Copy Code |
|---|---|
| using DataDynamics.ActiveReports.Document.Annotations; | |
| C# code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
NewActiveReport1 rpt = new NewActiveReport1();
//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 with the report in an RDF file
rpt.Document.Save("C:\\AnnotatedReport.rdf");
| |
Related Sections
Getting Started

