Table of Contents

Class DesignerDocument

Namespace
ReportWright.Design
Assembly
ReportWright.Design.dll

The open report as the designer sees it: the definition tree, the undo stack, the selection, and every mutation the surface and the chrome can ask for, each a reversible command. The designer is the only writer; nothing mutates the tree except through Execute(IDesignCommand).

public sealed class DesignerDocument
Inheritance
DesignerDocument
Inherited Members

Constructors

DesignerDocument(ReportDefinition, ItemRegistry?)

Opens a definition.

Properties

BodyWidth

Gets the body's width in twips: the section's Width.

Definition

Gets the definition.

IsDirty

Gets whether the tree differs from the last load or save.

Namespace

Gets the report-definition namespace of this document, which every element the designer creates uses.

Page

Gets the Page element, created on demand.

Path

Gets or sets the path the document was loaded from or saved to, or null for a new report.

Registry

Gets the item registry.

SchemaVersion

Gets the schema version the file was read in; new reports are 2016 and save as 2016.

Section

Gets the element that owns the body and page: the first ReportSection (2016) or the root (earlier versions).

Selection

Gets the selection.

Undo

Gets the undo stack.

Version

Gets a number that increases with every change, for caches keyed on the tree.

Methods

AbsoluteBoundsOf(RdlElement)

An item's bounds relative to its band, through any rectangles it is nested in.

Align(Alignment)

Aligns the selected items to their common bounding box (A.6); needs two or more.

AllItems(DesignBand)

Every item in a band at any depth, with bounds relative to the band.

Band(BandKind)

Finds a band by kind.

BandOf(RdlElement)

The band an item is in.

Bands()

Gets the bands the report defines, body first.

BoundsOf(RdlElement)

An item's bounds as stored: Left, Top, Width, Height, missing values as zero.

BringToFront()

Moves the selected items to the end of their containers' item order, so they draw last (A.4.5).

ClearSelection()

Clears the selection (Escape, A.2.6).

ContainerOf(RdlElement)

The element whose ReportItems holds an item: a band element or a Rectangle.

Copy()

The selected items as a fragment, or null when nothing is selected.

CreateBlank(ItemRegistry?)

Creates a blank 2016 report: letter page, one-inch margins, a 6.5 in body two inches tall.

CreateItem(ReportItemDescriptor, RdlElement, int, int)

Creates an item from a descriptor at a point in a container and selects it (A.3.5).

Cut()

Copies the selection and deletes it, as one entry.

DataSet(string?)

The DataSet element of a name, or the first dataset when the name is null, or null.

DeleteSelection()

Removes every selected item in one entry (A.4.2) and clears the selection.

DuplicateSelection()

Duplicates the selected items 0.2 in down and right, renamed, and selects the copies (A.4.3).

EnsureChild(RdlElement, string)

An existing child element, or a new empty one inserted in schema order as a command (undoable).

Execute(IDesignCommand)

Executes a command inside the current gesture, or as its own undo entry.

FieldNames(string?)

The field names of a dataset, in order; empty when the dataset is absent.

FieldTypeName(string?, string)

The designer type name of a field (rd:TypeName, for example System.Decimal), or null when the dataset does not say.

Find(string)

Finds a named element anywhere in the report.

FindItem(string)

Finds a report item by name; fields, parameters and groups are not items and do not count.

FirstDataSetName()

The name of the first dataset, or null.

FirstNumericField(string?)

The first numeric field of a dataset, or null.

FirstTextField(string?)

The first field of a dataset that is not numeric, or null.

Gesture(string, Action)

Runs an action as one gesture: one undo entry however many commands it executes (A.3.7).

GrowBandToFit(RdlElement)

Grows the band holding an item so the item fits inside it (Report Builder does the same); a band never shrinks here.

HitTest(DesignBand, int, int)

The topmost, deepest item under a point in a band (A.2.2); z-order is the item order.

IsItem(RdlElement)

Gets whether an element is a report item.

IsNumericField(string?, string)

Whether a field is numeric by its designer type name; a field whose type is unknown is not.

IsNumericTypeName(string?)

Whether a .NET type name names a number.

IsScopeName(string)

Whether a name is taken as a scope: a group, a dataset or a data region (RDL keeps those unique together).

ItemsIntersecting(DesignBand, ItemBounds)

The items in a band whose bounds intersect a rectangle (the rubber band, A.2.5); top-level items only.

ItemsOf(RdlElement)

The items directly inside a container (a band or a rectangle), in z-order (first drawn first).

Load(Stream, ItemRegistry?)

Opens a report from a stream.

MarkSaved()

Marks the document as saved: the dirty flag clears once the host has stored the bytes from ToBytes().

MergeFields(RdlElement, IEnumerable<KeyValuePair<string, string?>>)

Merges discovered fields into a dataset, as one undo entry: a field the dataset lacks is added with its DataField and rd:TypeName, and a field it has without an rd:TypeName gains one. A type the author already declared is never changed. Without a declared type a field is text to the engine (its sample data invents "Total 1", and Sum of it is #Error), so typing existing fields matters as much as adding new ones.

MoveSelection(int, int)

Moves every selected item by an offset, as one entry; a zero offset does nothing (A.3.7).

NameOf(RdlElement)

The item's Name attribute, or empty.

ParentOf(RdlElement)

The parent element of any element in the tree.

Paste(string, RdlElement, ItemBounds?)

Pastes a fragment into a container: offset 0.2 in from the originals, or at a point when the pointer is over the surface; renamed to keep names unique; re-namespaced to this report; selected. Fields the report lacks are kept for validation to flag, never dropped.

RedoLast()

Redoes the last undone entry.

Resize(ItemBounds, ResizeHandle, int, int, int)

The bounds a resize produces: the dragged edges move, the opposite edges stay pinned, and a size below the minimum clamps instead of inverting (A.3.3).

ResizeSelection(ResizeHandle, int, int)

Resizes the single selected item by a handle, as one entry.

Save(Stream)

Writes the report in the version it was read in and clears the dirty flag.

Select(DesignSelection)

Replaces the selection.

SendToBack()

Moves the selected items to the start of their containers' item order (A.4.5).

SetBounds(RdlElement, ItemBounds)

Sets an element's bounds, writing only the values that change.

SetValue(RdlElement, string, string?)

Sets a child value on any element, as one undo entry.

ToBytes()

Writes the report to bytes without clearing the dirty flag (for previews and tests).

UndoLast()

Undoes the last entry.

UniqueName(string)

A name not used by any named element: the kind followed by the smallest free number.

Events

Changed

Raised after the tree changed (execute, undo, redo) or the document was saved.

SelectionChanged

Raised after the selection changed.