[]
        
(Showing Draft Content)

C1.WPF.Report.FieldCollection.Add

Add Method

Add(string, string, double, double, double, double)

Adds a Field to the collection. This overload adds a legacy field type and is deprecated.

Declaration
[Obsolete("This method adds a field of the legacy 'do-it-all' Field type, which usually is sub-optimal. In most situations it is better to create a suitable specialized field type (such as TextField) and add it to the Fields collection instead.")]
public Field Add(string name, string text, double left, double top, double width, double height)
Parameters
Type Name Description
string name

Contains the name of the new field. You should use a consistent naming scheme for the fields and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will cause VBScript expressions that use repeated field names to yield unexpected results.

string text

Contains the value for the new field's Text property. This value may be treated as a literal or as a VBScript expression, depending on the setting of the field's Calculated property. By default, Calculated is set to false and the text is rendered as-is.

double left

Left coordinate of the new field, in twips, with respect to its containing section.

double top

Top coordinate of the new field, in twips, with respect to its containing section.

double width

Width of the new field, in twips.

double height

Height of the new field, in twips.

Returns
Type Description
Field

A reference to the newly added field.

Remarks

If you add a field to a section's Fields collection, the new field is automatically assigned to that section.

If you add a field to the control's Fields collection, the new field is not assigned to any sections. In this case, you must set the field's Section property or it will not be rendered in the report.

Add(string, string, Rect)

Adds a Field to the collection.

Declaration
[Obsolete]
public Field Add(string name, string text, Rect rc)
Parameters
Type Name Description
string name

Contains the name of the new field. You should use a consistent naming scheme for the fields and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will cause VBScript expressions that use repeated field names to yield unexpected results.

string text

Contains the value for the new field's Text property. This value may be treated as a literal or as a VBScript expression, depending on the setting of the field's Calculated property. By default, Calculated is set to false and the text is rendered as-is.

Rect rc

Defines the position of the field, in twips, with respect to its containing section.

Returns
Type Description
Field

A reference to the newly added field.

Remarks

If you add a field to a section's Fields collection, the new field is automatically assigned to that section.

If you add a field to the control's Fields collection, the new field is not assigned to any sections. In this case, you must set the field's Section property or it will not be rendered in the report.

Add(FieldBase)

Adds a field or a clone of a field to the collection.

Declaration
public FieldBase Add(FieldBase field)
Parameters
Type Name Description
FieldBase field

A FieldBase object to add to the collection.

Returns
Type Description
FieldBase

A reference to the newly added field.

Remarks

If the field does not belong to any reports, it is added to the collection. If the field already belongs to a report, a clone is created and added to the collection.