zoukankan      html  css  js  c++  java
  • 页面导入word

    今天上面要将考试的试卷可以导入出word,我当时想直接输出成文件,于是就写了
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/msword";
            Response.Charset = "utf-8";
            Response.AppendHeader("Content-Disposition ", "online;filename=File1.doc ");
            Response.ContentEncoding = System.Text.Encoding.Default;
            this.EnableViewState = false;
            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);
            this.div.RenderControl(oHtmlTextWriter);
            Response.Write(oStringWriter.ToString());
            Response.End();
    问题出来了,我输出div的内容到word,可是导出的却是html代码,这点我一直都没想明白为什么?
    因为我将div换成table一点问题都没有,哎,算了,也就先用吧
    记录一下,如果知道为什么div会导出 html的兄弟告知兄弟一下
  • 相关阅读:
    017-新闻表分页增删改查
    016-页面生命周期
    015-用户登录注册
    014-Session服务器状态保持
    013-Cookie状态保持
    012-ViewState状态保持
    011-Server服务器对象属性
    010-判断是否回传IsPostBack属性
    Github使用教程
    获取中文时间
  • 原文地址:https://www.cnblogs.com/JackWang/p/1769892.html
Copyright © 2011-2022 走看看