aspose 在线展示word、excel文档

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);

 

你可能感兴趣的:(Excel)