Show / Hide Table of Contents

Class FRReader

The reader used to deserialize object's properties from a report file.

Inheritance
System.Object
FRReader
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: FastReport.Utils
Assembly: FastReport.OpenSource.dll
Syntax
public class FRReader : IDisposable

Constructors

FRReader(Report)

Initializes a new instance of the FRReader class with specified report.

Declaration
public FRReader(Report report)
Parameters
Type Name Description
Report report

Reference to a report.

FRReader(Report, XmlItem)

Initializes a new instance of the FRReader class with specified report and xml item with contents to read.

Declaration
public FRReader(Report report, XmlItem root)
Parameters
Type Name Description
Report report

Reference to a report.

XmlItem root

Xml item with contents to read.

Properties

DeserializeFrom

Gets or sets target of serialization.

Declaration
public SerializeTo DeserializeFrom { get; set; }
Property Value
Type Description
SerializeTo

Errors

Gets a string that contains errors occured during the load.

Declaration
public string Errors { get; }
Property Value
Type Description
System.String

ItemName

Gets the current item name.

Declaration
public string ItemName { get; }
Property Value
Type Description
System.String

ReadChildren

Gets or sets a value indicating whther is necessary to read the object's children.

Declaration
public bool ReadChildren { get; set; }
Property Value
Type Description
System.Boolean

Root

Returns Root element for this reader

Declaration
public XmlItem Root { get; }
Property Value
Type Description
XmlItem

Methods

Dispose()

Disposes the reader, fixups the property references.

Declaration
public void Dispose()

HasProperty(String)

Checks if current item has specified property.

Declaration
public bool HasProperty(string name)
Parameters
Type Name Description
System.String name

The property name to check.

Returns
Type Description
System.Boolean

true if current item has specified property.

Load(Stream)

Loads the xml items from a stream.

Declaration
public void Load(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

The stream to load from.

NextItem()

Moves the current xml item.

Declaration
public bool NextItem()
Returns
Type Description
System.Boolean

false if there is no more items to move on; true otherwise.

Remarks

This method is used to read child objects.

Examples

This example demonstrates the use of ReadProperties, ReadChildren, NextItem, Read methods.

public void Deserialize(FRReader reader)
{
  // read simple properties like "Text", complex properties like "Border.Lines"
  reader.ReadProperties(this);

  // moves the current reader item
  while (reader.NextItem())
  {
    // read the "Styles" collection
    if (String.Compare(reader.ItemName, "Styles", true) == 0)
      reader.Read(Styles);
    else if (reader.ReadChildren)
    {
      // if read of children is enabled, read them
      Base obj = reader.Read();
      if (obj != null)
         obj.Parent = this;
    }
  }
}

Read()

Reads an object from current xml node.

Declaration
public IFRSerializable Read()
Returns
Type Description
IFRSerializable

The object.

Remarks

This method creates an instance of object described by the current xml node, then invokes its Deserialize method.

Examples

This example demonstrates the use of ReadProperties, ReadChildren, NextItem, Read methods.

public void Deserialize(FRReader reader)
{
  // read simple properties like "Text", complex properties like "Border.Lines"
  reader.ReadProperties(this);

  // moves the current reader item
  while (reader.NextItem())
  {
    // read the "Styles" collection
    if (String.Compare(reader.ItemName, "Styles", true) == 0)
      reader.Read(Styles);
    else if (reader.ReadChildren)
    {
      // if read of children is enabled, read them
      Base obj = reader.Read();
      if (obj != null)
         obj.Parent = this;
    }
  }
}

Read(IFRSerializable)

Reads the specified object.

Declaration
public void Read(IFRSerializable obj)
Parameters
Type Name Description
IFRSerializable obj

The object to read.

Remarks

The object must implement the IFRSerializable interface. This method invokes the Deserialize method of the object.

Examples

This example demonstrates the use of ReadProperties, ReadChildren, NextItem, Read methods.

public void Deserialize(FRReader reader)
{
  // read simple properties like "Text", complex properties like "Border.Lines"
  reader.ReadProperties(this);

  // moves the current reader item
  while (reader.NextItem())
  {
    // read the "Styles" collection
    if (String.Compare(reader.ItemName, "Styles", true) == 0)
      reader.Read(Styles);
    else if (reader.ReadChildren)
    {
      // if read of children is enabled, read them
      Base obj = reader.Read();
      if (obj != null)
         obj.Parent = this;
    }
  }
}

ReadBool(String)

Reads the boolean property.

Declaration
public bool ReadBool(string name)
Parameters
Type Name Description
System.String name

Name of property.

Returns
Type Description
System.Boolean

Property value.

ReadDouble(String)

Reads the double property.

Declaration
public double ReadDouble(string name)
Parameters
Type Name Description
System.String name

Name of property.

Returns
Type Description
System.Double

Property value.

ReadFloat(String)

Reads the float property.

Declaration
public float ReadFloat(string name)
Parameters
Type Name Description
System.String name

Name of property.

Returns
Type Description
System.Single

Property value.

ReadInt(String)

Reads the integer property.

Declaration
public int ReadInt(string name)
Parameters
Type Name Description
System.String name

Name of property.

Returns
Type Description
System.Int32

Property value.

ReadProperties(Object)

Reads properties of specified object.

Declaration
public void ReadProperties(object obj)
Parameters
Type Name Description
System.Object obj

The object to read.

Remarks

This method reads simple properties like "Text", "Border.Lines" etc. for specified object. To read nested properties like collections, you should override the DeserializeSubItems(FRReader) method of an object.

Examples

This example demonstrates the use of ReadProperties, ReadChildren, NextItem, Read methods.

public void Deserialize(FRReader reader)
{
  // read simple properties like "Text", complex properties like "Border.Lines"
  reader.ReadProperties(this);

  // moves the current reader item
  while (reader.NextItem())
  {
    // read the "Styles" collection
    if (String.Compare(reader.ItemName, "Styles", true) == 0)
      reader.Read(Styles);
    else if (reader.ReadChildren)
    {
      // if read of children is enabled, read them
      Base obj = reader.Read();
      if (obj != null)
         obj.Parent = this;
    }
  }
}

ReadPropertyValue()

Reads the standalone property value.

Declaration
public string ReadPropertyValue()
Returns
Type Description
System.String

Property value.

ReadStr(String)

Reads the string property.

Declaration
public string ReadStr(string name)
Parameters
Type Name Description
System.String name

Name of property.

Returns
Type Description
System.String

Property value.

ReadValue(String, Type)

Reads the enum property.

Declaration
public object ReadValue(string name, Type typ)
Parameters
Type Name Description
System.String name

Name of property.

System.Type typ

Type of property.

Returns
Type Description
System.Object

Property value.

Implements

System.IDisposable
Back to top Generated by DocFX