各位大虾们,能教我怎么从sql server2000数据库中导出全部的数据表到word文件中吗???不甚感激
解决方案 »
- 页面内嵌代码
- SqlDataSource怎么用UpdateCommand更新
- 关于按钮绑定的问题
- 200分,关于VS2005发布后出现乱码,急急!!!!!!!
- 为什么我做的按钮要双击两次,才能响应事件?
- 消息框Messagebox 在前面定义的类型或命名空间是什么?(在线等!在线等)
- 如何在用户按回车后选择哪个按钮事件响应。
- 关于Cookies的问题!为什么不能提前判断是否为NULL呢?
- 使用了UpdatePanel 怎么改才能正常 弹出声音
- dropdownlist绑定后使新增加行显示在第一列的问题??up就有分哦
- vcastr3 怎么增加缩略图?
- 【挑战】一段Javascript代码转换为ASP代码
/// </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
}把数据取出来放DataSet 或者DataTable里 然后去搜 DataTable导出WORD