Tag: windows server 2008

如何在Windows 2008上做excel互操作?

最近部署我的Web应用程序在Windows Server2008,IIS7(与Office安装)。 在追赶(捉住)各种其他错误之后,我正面临一个我不确定从哪里开始。 在卡西尼(视觉工作室开发服务器)一切工作完美(通过Excel互操作阅读优秀)。 在w2008 IIS上抛出模糊的错误: 值不能为空。 参数名称:o [ArgumentNullException:值不能为空。 参数名:o] System.Runtime.InteropServices.Marshal.FinalReleaseComObject(Object o)+9430474 longnamespace.ExcelReader.Dispose()in c:\ longpath \ ExcelReader.cs:23 longnamespace.ApplicationFormReader.Read(String path)in c: \ longpath \ ApplicationFormReader.cs:32 目前,我将添加空检查,看看事情是否有所好转,但我怀疑它只是在finally阻止它开始读取任何东西之前就被炸毁。 试图设置应用程序池在本地系统下运行,但没有任何改变。 有任何想法吗? 这是如何configuration方法的样子 //http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c/159419#159419 public void Dispose(){ GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); Marshal.FinalReleaseComObject(_ws); //Worksheet, line 23 _wb.Close(); Marshal.FinalReleaseComObject(_wb); //Workbook _ap.Quit(); Marshal.FinalReleaseComObject(_ap); //Application } 我相信这个事件是相关的 机器默认权限设置不授予CLSID {00024500-0000-0000-C000-000000000046}的COM服务器应用程序的本地激活权限给用户NT AUTHORITY \ NETWORK SERVICE SID(S-1-5-20)从地址LocalHost(使用LRPC)。 […]

运行时错误 – 使用C#从IIS导出Excel

当我在本地机器上运行debugging模式时,没有任何问题。 我可以出口到Excel … private void ExportToExcel(string str) { _Excel.Application oXL; _Excel.Workbook oWB; _Excel.Worksheet oSheet; _Excel.Range oRange; // Start Excel and get Application object. oXL = new _Excel.Application(); // Set some properties oXL.Visible = true; oXL.DisplayAlerts = false; // Get a new workbook. oWB = oXL.Workbooks.Add(Missing.Value); // Get the active sheet oSheet = (_Excel.Worksheet)oWB.ActiveSheet; oSheet.Name = […]

如何将Excel OLE DB安装到Windows Server 2008?

我们有一个运行Windows 2008 32位的Web服务器。 当我们部署一个使用OLE DB从Excel读取的网站时,我们得到了这个错误 “Microsoft.ACE.OLEDB.12.0”提供程序未在本地计算机上注册。 我们不想在服务器上安装Microsoft Office。 还有什么我们可以做的解决这个问题? 提前致谢。

在IIS7.5上生成ASP文件的Excel文件

在支持的现有Web应用程序中,有一个页面用于为某些数据生成Excel电子表格。 Web服务器安装了Excel 2002(如此老…),并利用Excel对象的自动化来完成这项工作。 我完全意识到,像这样的自动化Excel不是微软推荐的,但这是目前的工作方式,我从来没有分配任何时间来改变这一点。 这里是一些示例代码 Dim xlApp, xlBook, xlSheet 'create the Application Object and workbook object Set xlApp = Server.CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlBook.Worksheets.Add 'turn off any alerts xlApp.DisplayAlerts = False xlApp.Visible = False xlApp.ScreenUpdating = False xlApp.DisplayFormulaBar = True xlApp.CommandBars("Standard").Visible = True xlApp.CommandBars("Formatting").Visible = True xlApp.CommandBars("Chart").Visible = True xlApp.CommandBars("Control Toolbox").Visible […]

在本地或在服务器上运行Excel自动化

想知道哪种方法是更好的做法。 我们有一个销售报告,必须以非常特定的格式生成(直到行颜色和字体)。 我已经写了一个macros从我们的数据库中拉出,并在大约15秒内填充整个工作簿。 问题是如何填充? 1)进程服务器端:用户在内网页面发起请求。 ASP.NET打开工作簿模板,执行macros并返回最后的工作表。 2)本地进程:用户下载空白模板,从自动连接到数据库的桌面运行。 我喜欢第一个,因为我可以强制执行数据的模板,时间,用户和安全性。 但build议在互联网web服务器上运行Excel自动化? 我喜欢第二种select,但是当模板开始在公司周围浮动时,我害怕失去标准化。

导出到Excel – 在Windows Server 2008 IIS7上的问题

我试图导出到excel中的repeter / Gridview, this is working fine in my local machine and windows server 2003, however when I deployed on Windows server 2008 its not working properly 。 这是我的代码 StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); string attachment = "attachment; filename=myReport.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/vnd.ms-excel"; rpt.RenderControl(htw); Response.Write(sw.ToString()); Response.Flush(); Response.End(); 服务器详细信息: […]

Excel自动化上的VBScript错误1004

我必须将一堆使用Excel自动化的VBScript移动到新的服务器上。 我知道这不是一个Excel自动化的推荐用例,但这仍然是我要求做的。 大多数时候脚本没有任何改变,但其中一些不能正常工作。 旧服务器运行Windows 2003,意大利语为Excel 2010。 新的服务器运行Windows 2008 R2,英文版为Excel 2010。 其中一个脚本在执行与此类似的代码时会产生错误: Option Explicit On Error Resume Next Dim objExcel Set objExcel = CreateObject("Excel.Application") Dim xlBook Set xlBook = objExcel.Workbooks.Open("myTemplateFile.xlsm") WScript.Echo("Error: " & Err.Number & " Description " & Err.Description) objExcel.Application.Quit 要打开的文件是一个“macros启用Excel电子表格”,在原始(或在我的开发)机器正常打开。 我想我已经启用了所有Excel选项来打开电子表格与macros,但代码失败: 1004无法获取Workbooks类的Open属性 如果我尝试在目标服务器上的Excel应用程序中打开myTemplateFile.xlsm ,则表明存在一些不可读的内容,然后将其剥离。 被剥离的内容是macros观来源。 任何人遇到类似的问题 编辑 我可以添加一些其他信息: 在源计算机上安装了Office 2010的32位版本 在目标机器上安装了Office 2010的64位版本 我也注意到,尽pipe在function区中启用了macrosfunction并且可以看到这些function,但在一个空的工作簿上,VBA和macros图标也变灰(禁用)。 另一个编辑 […]

在Microsoft HPC上通过Com-interop C#API打开一个excel文件

我正在Windows hpc上工作,我试图做一个运行在网格上的macros的macros的小程序。 我正在使用Com Interop API 它在我的电脑上工作正常,它运行不同的VBAmacros,但是当我在网格上使用它时,它不再工作。 Open方法无法正常工作。 workBook = excelApp.Workbooks.Open(path, Type.Missing,false, Type.Missing, Type.Missing, Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); 这是从法语翻译的例外: 发现exception:types:System.Runtime.InteropServices.COMException消息:Microsoft Office Excel无法访问该文件 \服务器\path\ TEST.XLS。 有多种可能性: 该文件的名称或path不存在 该文件当前用于另一个程序 您尝试使用的工作簿具有已经打开的另一个工作簿的相同名称 来源:Microsoft Office Excel Stacktrace:在Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename,Object UpdateLinks,Object ReadOnly,Object Format,Object Password,Object WriteResPassword,Object IgnoreReadOnlyRecommended,Object Origin,Object Delimiter,Object Editable,Object Notify,Object Converter ,Object AddToMru,Object Local,Object CorruptLoad)位于E:\ path \ […]

MS Access 2010,Excel 2010,Windows Server 2008 R2 64位:工作簿类的SaveAs方法失败

使用的服务:MS Access 2010,Excel 2010,Windows Server 2008 R2(64位) 在我们的MS Access数据库中,我们编写了一个将查询导出为.xlsx格式并将其保存在networking驱动器上的进程。 它使用这个语法: objxl.ActiveWorkbook.SaveAs filename, FileFormat:=xlOpenXMLWorkbook 和 xlWBk.SaveAs filename, FileFormat:=xlOpenXMLWorkbook 其中objxl被声明为: Private objxl As Object 并通过以下方式打开文件: Dim xlWBk As Object If objxl Is Nothing Then Set objxl = CreateObject("Excel.Application") End If If Dir(sourceFile) = vbNullString Then Set xlWBk = objxl.Workbooks.Add Else Set xlWBk = objxl.Workbooks.Open(sourceFile) blnFileExists = True […]

Excel无法访问IIS7和Windows Server 2008 R2(64位)的文件

我有一个Web项目(.NET 4),需要访问一个Excel文件,但它结束了以下错误信息: Error occurred during file generation.Microsoft Excel cannot access the file 'D:\xx\xx\abc.xls'. There are several possible reasons: • The file name or path does not exist. (Actually it is there) • The file is being used by another program. (It can not happen) • The workbook you are trying to save has the same […]