Search Results for

    Show / Hide Table of Contents

    Class FRWriter

    The writer used to serialize object's properties to a report file.

    Inheritance
    System.Object
    FRWriter
    Namespace: FastReport.Utils
    Assembly: FastReport.Base.dll
    Syntax
    public class FRWriter : IDisposable

    Constructors

    FRWriter()

    Initializes a new instance of the FRWriter class with default settings.

    Declaration
    public FRWriter()

    FRWriter(XmlItem)

    Initializes a new instance of the FRWriter class with specified xml item that will receive writer's output.

    Declaration
    public FRWriter(XmlItem root)
    Parameters
    Type Name Description
    XmlItem root

    The xml item that will receive writer's output.

    Properties

    DiffObject

    Gets the ethalon object to compare with.

    Declaration
    public object DiffObject { get; }
    Property Value
    Type Description
    System.Object

    ItemName

    Gets or sets current xml item name.

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

    SaveChildren

    Gets or sets a value that determines whether is necessary to serialize child objects.

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

    SaveExternalPages

    Gets or sets a value that determines whether is necessary to serialize external pages.

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

    SerializeTo

    Gets or sets target of serialization.

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

    WriteHeader

    Gets or sets a value that determines whether is necessary to add xml header.

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

    Methods

    AreEqual(Object, Object)

    Determines if two objects are equal.

    Declaration
    public bool AreEqual(object obj1, object obj2)
    Parameters
    Type Name Description
    System.Object obj1

    The first object.

    System.Object obj2

    The second object.

    Returns
    Type Description
    System.Boolean

    true if objects will be serialized to the same value.

    Dispose()

    Disposes the writer.

    Declaration
    public void Dispose()

    Save(Stream)

    Saves the writer output to a stream.

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

    Stream to save to.

    Write(IFRSerializable)

    Serializes the specified object.

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

    The object to serialize.

    Remarks

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

    Examples

    This example demonstrates the use of writer.

    public void Serialize(FRWriter writer)
    {
      // get the etalon object. It will be used to write changed properties only.
      Base c = writer.DiffObject as Base;
    
      // write the type name
      writer.ItemName = ClassName;
    
      // write properties
      if (Name != "")
        writer.WriteStr("Name", Name);
      if (Restrictions != c.Restrictions)
        writer.WriteValue("Restrictions", Restrictions);
    
      // write child objects if allowed
      if (writer.SaveChildren)
      {
        foreach (Base child in ChildObjects)
        {
          writer.Write(child);
        }
      }
    }

    Write(IFRSerializable, Object)

    Serializes the object using specified etalon.

    Declaration
    public void Write(IFRSerializable obj, object diff)
    Parameters
    Type Name Description
    IFRSerializable obj

    The object to serialize.

    System.Object diff

    The etalon object.

    WriteBool(String, Boolean)

    Writes a boolean property.

    Declaration
    public void WriteBool(string name, bool value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.Boolean value

    Property value.

    WriteDouble(String, Double)

    Writes a double property.

    Declaration
    public void WriteDouble(string name, double value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.Double value

    Property value.

    WriteFloat(String, Single)

    Writes a float property.

    Declaration
    public void WriteFloat(string name, float value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.Single value

    Property value.

    WriteInt(String, Int32)

    Writes an integer property.

    Declaration
    public void WriteInt(string name, int value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.Int32 value

    Property value.

    WritePropertyValue(String, String)

    Writes a standalone property value.

    Declaration
    public void WritePropertyValue(string name, string value)
    Parameters
    Type Name Description
    System.String name

    Name of property.

    System.String value

    Property value.

    Remarks

    This method produces the following output: <PropertyName>PropertyValue</PropertyName>

    WriteRef(String, Base)

    Writes an object reference property.

    Declaration
    public void WriteRef(string name, Base value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    Base value

    Property value.

    WriteStr(String, String)

    Writes a string property.

    Declaration
    public void WriteStr(string name, string value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.String value

    Property value.

    WriteValue(String, Object)

    Writes an enumeration property.

    Declaration
    public void WriteValue(string name, object value)
    Parameters
    Type Name Description
    System.String name

    Property name.

    System.Object value

    Property value.

    Back to top © 1998-2025 Copyright Fast Reports Inc.