保存代码已经写好了 点击保存的时候样式有点乱我页面全用的table,样式也定在页面里面了,就是保存后页面JS动态赋值的保存不上,有什么办法获得JS动态值的值吗?

解决方案 »

  1.   

    页面有一部分文字是根据数据的编号来对应JS中的中文然后显示中文信息,比如:数据0100是数据 JS中0100是北京,那就页面就显示北京,当我点保存word的时候显示的还是0100,也就是说JS赋的值是保存不上的。
      

  2.   

    先替换好了在保存/// <summary>
            /// 将Web控件导出
            /// </summary>
            /// <param name="source">控件实例</param>
            /// <param name="type">类型:Excel或Word</param>
            public void ExpertControl(System.Web.UI.Control source, DocumentType type)
            {
                //设置Http的头信息,编码格式
                if (type == DocumentType.Excel)
                {
                    //Excel
                    Response.AppendHeader("Content-Disposition","attachment;filename=result.xls");
                    Response.ContentType = "application/ms-excel";
                }
                else if (type == DocumentType.Word)
                {
                    //Word
                    Response.AppendHeader("Content-Disposition","attachment;filename=result.doc");
                    Response.ContentType = "application/ms-word";
                }
                Response.Charset = "UTF-8";  
                Response.ContentEncoding = System.Text.Encoding.UTF8;             //关闭控件的视图状态
                source.Page.EnableViewState =false;              //初始化HtmlWriter
                System.IO.StringWriter writer = new System.IO.StringWriter() ;
                System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
                source.RenderControl(htmlWriter);             //输出
                Response.Write(writer.ToString());
                Response.End();
            }        //文档类型
            public enum DocumentType
            {
                Word,
                Excel
            }
      

  3.   

    wxr0323
    我的写法和你上面写法一样,你说的替换我没办法替换,没有根据 重复数据很多。