Silverlight StreamWriter 只能写4k的问题

最近项目中遇到一个问题,保存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);

posted @ 2011-06-14 15:32  mjg  阅读(374)  评论(0编辑  收藏  举报