用的操作系统是win2003,开发环境.net2003 webform
执行m_oExcelApp= new Excel.ApplicationClass();
报错,报错信息:拒绝访问。 谁有webform下导出excel程序能否给份源码?
QQ:87221857
[email protected]
执行m_oExcelApp= new Excel.ApplicationClass();
报错,报错信息:拒绝访问。 谁有webform下导出excel程序能否给份源码?
QQ:87221857
[email protected]
解决方案 »
- 后台往前台输出table 代替gridview
- 请教一个结合gridview的SQL数据库功能
- 请教:做了一个c/s的程序,数据库安装在服务器,程序安装在客户端,想安装时设置服务器的IP地址。
- 如何格式化数字
- private static readonly是什么样的含义,private static const对不对?
- datagrid列显示问题
- 怎样才能知道一条记录是DataView中的第一条记录或最后一条记录??
- 奇怪的UpDate问题,为何直接用字符串赋值就可以,传递TextBox的值给它就不行。哪位C#高手可以解决
- 水晶报表的登陆问题!
- 给已经绑定数据的datagridview更改列的值
- 救命去,来者有分
- 如何得到文件名称?
<identity impersonate="true" />
{
Application exc = new Application();
if (exc == null)
{
Response.Write("ERROR: EXCEL couldn't be started!");
}
Workbooks workbooks = exc.Workbooks;
_Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Sheets sheets = workbook.Worksheets;
_Worksheet worksheet = (_Worksheet) sheets.get_Item(1);
if (worksheet == null)
{
Console.WriteLine ("ERROR: worksheet == null");
}
Range range1 = worksheet.get_Range("C1", Type.Missing);
if (range1 == null)
{
Console.WriteLine ("ERROR: range == null");
}
const int nCells = 1;
Object[] args1 = new Object[1];
args1[0] = nCells;
range1.GetType().InvokeMember("Value", BindingFlags.SetProperty, null,range1, args1);
exc.Visible=true;
FileName = "temp.xls";
string fullFileName = Path.Combine(Environment.CurrentDirectory, FileName);
fullFileName = Path.GetFullPath("WebForm1.");
if(File.Exists(fullFileName).Equals(true))
{
File.SetAttributes(fullFileName, FileAttributes.Normal);
}
exc.DisplayAlerts = false;
workbook.SaveAs(fullFileName,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,Excel.XlSaveAsAccessMode.xlExclusive,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty);
if( File.Exists(fullFileName).Equals(true))
{
File.SetAttributes(fullFileName, FileAttributes.ReadOnly);
} }
catch(Exception e )
{
throw e;
}