获取WPF资源,生成文件

 

            using (Stream stream = Application.GetContentStream(new Uri(reportName + ".rdlc", UriKind.RelativeOrAbsolute)).Stream)
            {
                byte[] bytes = new byte[stream.Length];
                stream.Read(bytes, 0, bytes.Length);

                // 设置当前流的位置为流的开始
                stream.Seek(0, SeekOrigin.Begin);

                FileStream fs = new FileStream(reportPath, FileMode.Create);
                BinaryWriter bw = new BinaryWriter(fs);
                bw.Write(bytes);
                bw.Close();
                fs.Close();
            }

 

posted @ 2009-06-28 17:57  nfyz  阅读(670)  评论(0编辑  收藏  举报