我只是简单的配置了数据源 和数据库里连接了,在IE里边也能正确预览出来,但是导出到excel就变成乱码了,高手求指点
或者是要在.cs里边加什么东西么?新手 勿笑哦~
我的.CS文件
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;public partial class ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
}
基本没动过,要添加什么么?》
或者是要在.cs里边加什么东西么?新手 勿笑哦~
我的.CS文件
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;public partial class ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
}
基本没动过,要添加什么么?》
解决方案 »
- 鼠标滑过 TextBox 文本框里的内容消失!
- 数据库查询汇总问题```请大家多多支持,谢谢!
- PrintDialog控件中选择打印“当前页”、部分页时如何写代码
- DataGridViewComboBoxColumn应用问题??
- log4net在3层中如何使用比较好?
- 在C#中生成一个Excel文件后,如何设置某一列的单元格为文本格式?
- 请问在WinForm中能不能使用Flash
- 谁下载过test director之内的测试管理工具?
- winform不规则窗体
- FileUpload控件点击浏览按钮没反应
- 求wcf部署 在线等 解决完立马结贴
- 急问windows installer 3.1的主要功能是什么,如果不要有什么影响
1Response.Clear();
2 Response.Buffer = true;
3 Response.Charset = "gb2312";
4 Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
5 Response.AppendHeader("content-disposition","attachment;filename=\"" + System.Web.HttpUtility.UrlEncode("中文名称",System.Text.Encoding.UTF8) + ".xls\"");
6 Response.ContentType = "Application/ms-excel";
7最关健的一句就是:System.Web.HttpUtility.UrlEncode("中文名称",System.Text.Encoding.UTF8) + ".xls\"");
Response.Write(" <html> <head> <meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
Response.Write(" </body> </html>");再在你的web.config上加上
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
大神~ 帮我添加下 新手~、、
这是我的html
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="zhcx.aspx.cs" Inherits="zhcx" %><%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 882px">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="宋体"
Font-Size="8pt" Height="549px" InteractiveDeviceInfos="(集合)"
WaitMessageFont-Names="宋体" WaitMessageFont-Size="14pt" Width="741px">
<LocalReport ReportPath="Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSetxinxi" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<br />
<br />
<br />
<br />
<br />
<br />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetData"
TypeName="rongshanyangDataSetTableAdapters.yxinxiTableAdapter">
</asp:ObjectDataSource>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>下变是cs代码using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;public partial class ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
}