惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 【当耐特】
月光博客
月光博客
Vercel News
Vercel News
D
Docker
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
有赞技术团队
有赞技术团队
雷峰网
雷峰网
博客园 - 聂微东
小众软件
小众软件
Y
Y Combinator Blog
腾讯CDC
L
LangChain Blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss

博客园 - 代码乱了

MIT 18.06 线性代数 - 23微分方程,exp(At) MIT 18.06 线性代数 - 22. 对角化和矩阵的幂 测试markdown发布 visual webgui theme designer 健身视频 2012元旦遭遇坑爹的12306订票网站付了款不出票 博文阅读密码验证 - 博客园 ReportViewer 2008 打印出现Error loading resource library. (0x8007007E)和(0x80070006) 博文阅读密码验证 - 博客园 VM.xPort.ExcelClient XXX备忘 Parsing html markup text using MSHTML Winform Field interface 转换前台javascript传递过来的时间字符串到.net的DateTime 博文阅读密码验证 - 博客园 SQL:获取正在执行的SQL语句 博文阅读密码验证 - 博客园 VSX vsct file context menu for script editor - 代码乱了 利用XML转换为table实现在SQL参数中传递表结构 MSChart出现为ChartImg.axd 执行子请求时出错 - 代码乱了 - 博客园
Serialize and Deserialize RDL
代码乱了 · 2011-03-23 · via 博客园 - 代码乱了

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: