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:
  • 相关阅读:
    29. Divide Two Integers
    leetCode 17. Letter Combinations of a Phone Number
    查找
    快速排序
    希尔排序
    插入排序
    归并排序,还有非递归方式没写
    堆排序--还有递归法没有写
    c++实现字符串全排序
    归并排序
  • 原文地址:https://www.cnblogs.com/jintan/p/1993286.html
Copyright © 2011-2022 走看看