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
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: