Silverlight StreamWriter 只能写4k的问题

首页 | 新闻 | 交流 | 问吧 | 文档 | 手册 | 下载 | 博客

Silverlight StreamWriter 只能写4k的问题

作者:  时间: 2011-06-14

最近项目中遇到一个问题,保存seller report card的时候使用下面的代码

  string html = GetHtml(card, properties, propertyColumns, labels, labelColumns, enforcements, enforcementColumns, listings, listingColumns, products, productColumns, aliases, aliasColumns);
                Stream s = fsd.OpenFile();
                //StreamWriter w = new StreamWriter(s);
                //w.Write(html);

每次只能保存4k,超过的部分都没有保存,使用下面的办法可以解决

 string html = GetHtml(card, properties, propertyColumns, labels, labelColumns, enforcements, enforcementColumns, listings, listingColumns, products, productColumns, aliases, aliasColumns);
                Stream s = fsd.OpenFile();
                //StreamWriter w = new StreamWriter(s);
                //w.Write(html);
                byte[] data = System.Text.Encoding.UTF8.GetBytes(html);
                s.Write(data, 0, data.Length);