excel-interop

Unable to create the excel file when the application (asp.net) is run from IIS

余生颓废 提交于 2021-01-01 07:59:45
问题 Unable to create the excel file at particular path when the application is run from IIS. But its created when the code is debuged using visual studio 2008.Even i have tried out using absolute path and using server.mappath() function but in vain.Server throws the error : HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

writing data from C# to Excel interrupted by opening Excel Window

吃可爱长大的小学妹 提交于 2020-08-04 02:39:19
问题 While my C# program writes data continuously to an Excel spreadsheet, if the end user clicks on the upper right menu and opens the Excel Options window, this causes a System.Runtime.InteropServices.COMException with HRESULT: 0x800AC472 which interrupts the data from being written to the spreadsheet. Ideally, the user should be allowed to do this without causing an exception. The only solution I found to this error code was to loop and wait until the exception went away: Exception from HRESULT

Microsoft Excel Application entry is missing in DCOM Config

ぃ、小莉子 提交于 2020-04-11 04:34:29
问题 The entry for "Microsoft Excel Application" is not there in DCOM Config (tried in both 32-bit and 64-bit). How can I make it shows up there? I have Microsoft Office installed. 回答1: If you cannot find 'Microsoft Excel Application' in either 32-bit or 64-bit DCOMCNFG, you might go into registry to HKEY_CLASSES_ROOT/AppID and find the CLSID for your version of Excel (Excel 2013 has an AppID of {00020812-0000-0000-C000-000000000046}) Check that the (Default) REG_SZ for this key has a value set

Write to excel file with multiple threads

允我心安 提交于 2020-03-22 08:23:20
问题 I am trying to write to datatable to excel which has large records. I am trying to achieve using divide and conquer strategy where each thread is assigned to write to respective sheets of excelworkbook.but I am getting file is readonly ,click Ok to override the file. class Program { int processorCount = 2; static volatile bool processing = true; DataTable employeeTable = new DataTable("Employee"); ManualResetEvent mre = new ManualResetEvent(false); AutoResetEvent ar = new AutoResetEvent(true)

Adding a Sheet to an Excel Workbook

泄露秘密 提交于 2020-02-25 04:46:02
问题 I'm trying to create a Workbook with multiple sheets in Excel but I can't figure out how to create the multiple sheets. I can create one just fine, but when I try to create a second one to write to I get an error. Dim app As Application = New Application Dim xlApp As New Excel.Application Dim xlWorkBook As Excel.Workbook Dim newXlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application Dim newXlWorkbook As Excel.Workbook Dim newXlSheet As Excel.Worksheet Dim newXlSheet2 As

Adding a Sheet to an Excel Workbook

怎甘沉沦 提交于 2020-02-25 04:44:53
问题 I'm trying to create a Workbook with multiple sheets in Excel but I can't figure out how to create the multiple sheets. I can create one just fine, but when I try to create a second one to write to I get an error. Dim app As Application = New Application Dim xlApp As New Excel.Application Dim xlWorkBook As Excel.Workbook Dim newXlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application Dim newXlWorkbook As Excel.Workbook Dim newXlSheet As Excel.Worksheet Dim newXlSheet2 As

Why ExcelApplication.Workbooks.Count is showing zero even when I have an Excel workbook open

╄→гoц情女王★ 提交于 2020-02-05 08:26:09
问题 ExcelApplication.Workbooks.Count is showing count = 0 even when I have a document open. ExcelApplication.Workbooks.Count shows count = 1 when the document opened is not in protected view. But when the opened document is PROTECTED VIEW the ExcelApplication.Workbooks.Count shows 0. Why the workbook count is 0 in case of protected view excel? 回答1: Because: A workbook displayed in a Protected View window is not a member of the Workbooks collection. If you need to get a handle on a protected

Why ExcelApplication.Workbooks.Count is showing zero even when I have an Excel workbook open

回眸只為那壹抹淺笑 提交于 2020-02-05 08:24:47
问题 ExcelApplication.Workbooks.Count is showing count = 0 even when I have a document open. ExcelApplication.Workbooks.Count shows count = 1 when the document opened is not in protected view. But when the opened document is PROTECTED VIEW the ExcelApplication.Workbooks.Count shows 0. Why the workbook count is 0 in case of protected view excel? 回答1: Because: A workbook displayed in a Protected View window is not a member of the Workbooks collection. If you need to get a handle on a protected

Attach to existing Excel Instance

安稳与你 提交于 2020-02-02 05:47:29
问题 I'm trying to determine whether or not an instance of Excel of running with a particular file open, and if so attach to it so I can control that instance. I've searched around and the majority of what I've got have come from this question. It has a reference to another site, but unfortunately it's dead for me so I cannot read up on it. My code so far is; //Is Excel open? if (Process.GetProcessesByName("EXCEL").Length != 0) { Process[] processes = Process.GetProcesses(); foreach (Process

Changing an Excel cell's backcolor using hex results in Excel displaying completely different color in the spreadsheet

巧了我就是萌 提交于 2020-01-31 04:31:08
问题 So I am setting an Excel cell's Interior Color to a certain value, like below: worksheet.Cells[1, 1].Interior.Color = 0xF1DCDB; However, when I then open up the spreadsheet in Excel, I see that the color that came out is completely different (in the above case, the color in the resulting spreadsheet is 0xDCDCEF). I tried a few different colors and it always changes it, and I don't see a pattern. Is there any reason for this? I even tried setting the color by writing Color.FromArgb(241, 220,