zoukankan      html  css  js  c++  java
  • Serialize and Deserialize RDL


    If you have a ReportViewer class generated from the XSD report definition file using:
    xsd.exe /c /namespace:Rdl ReportDefinition.xsd

    You can serialize and deserialize the class to/from RDLC XML:

    xmldoc contains the XML RDLC code and is an XmlDocument.

    Deserialization, from XML to Class

    Rdl.Report report = new Rdl.Report();
    XmlSerializer serializer = new XmlSerializer(typeof(Report));
    XmlNodeReader xmlr = new XmlNodeReader(xmldoc);
    report = (Rdl.Report)serializer.Deserialize(xmlr);

    Now you can change the report elements using the objects and collections inside the
    Rdl.Report class.

    And Serialization, from Class to XML:

    XmlDocument xmldoc = new XmlDocument();
    StringBuilder sb = new StringBuilder();
    MyStringWriterWithEncoding sw = new MyStringWriterWithEncoding(sb, System.Text.Encoding.UTF8);
    serializer.Serialize(sw, report);
    string sxml = sb.ToString();
    xmldoc.LoadXml(sxml);

    Here is a link to the ReportDefinition.cs class:
  • 相关阅读:
    HTML向Flex传参
    Flex数据推送
    Flex+BlazeDS+Spring整合
    Clone Graph
    Word Break II
    Word Break
    Pascal's Triangle
    N-Queens II
    N-Queens
    Length of Last Word
  • 原文地址:https://www.cnblogs.com/jintan/p/1993286.html
Copyright © 2011-2022 走看看