gguowang

SqlServer 、API编程、Asp.Net,Winform.......

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
View Code
 string file = Server.MapPath("Library/现场服务商评价日报.xls");
            Workbook workbook = new Workbook(file);
            HtmlSaveOptions option = new HtmlSaveOptions(SaveFormat.Html);
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            workbook.Save(stream, SaveFormat.Html);
            string html = System.Text.Encoding.UTF8.GetString(stream.ToArray());
            HttpContext.Current.Response.ContentType = "text/html; charset=utf-8";
            HttpContext.Current.Response.Write(html);
            HttpContext.Current.Response.Flush();
            HttpContext.Current.Response.End();

View Code

string fullpath = Server.MapPath("Document/Template/a.doc");
        Document doc = new Document(fullpath, LoadFormat.Doc, null);
        doc.Save("a.mhtml", SaveFormat.Mhtml, SaveType.OpenInBrowser, HttpContext.Current.Response);

 

posted on 2012-06-18 18:19  gguowang  阅读(894)  评论(0编辑  收藏  举报