System.Runtime.InteropServices.COMException (0x800A03EC)

后端 未结 7 1205
梦谈多话
梦谈多话 2020-11-29 02:07

Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs() method is working fine on Windows server 2003 and also on XP but not on Windows server 2008. I copied it a

相关标签:
7条回答
  • 2020-11-29 02:23

    It 'a permission problem when IIS is running I had this problem and I solved it in this way

    I went on folders

    C:\Windows\ System32\config\SystemProfile

    and

    C:\Windows\SysWOW64\config\SystemProfile

    are protected system folders, they usually have the lock.

    Right-click-> Card security-> Click on Edit-> Add untente "Autenticadet User" and assign permissions.

    At this point everything is solved, if you still have problems try to give all permissions to "Everyone"

    0 讨论(0)
  • 2020-11-29 02:23

    For all of those, who still experiencing this problem, I just spent 2 days tracking down the bloody thing. I was getting the same error when there was no rows in dataset. Seems obvious, but error message is very obscure, hence 2 days.

    0 讨论(0)
  • 2020-11-29 02:24

    Some googling reveals that potentially you've got a corrupt file:

    http://bitterolives.blogspot.com/2009/03/excel-interop-comexception-hresult.html

    and that you can tell excel to open it anyway with the CorruptLoad parameter, with something like...

    Workbook workbook = excelApplicationObject.Workbooks.Open(path, CorruptLoad: true);
    
    0 讨论(0)
  • 2020-11-29 02:27

    In my case, the problem was styling header as "Header 1" but that style was not exist in the Word that I get the error because it was not an Office in English Language.

    0 讨论(0)
  • 2020-11-29 02:29

    Try this as it worked for me...

    1. Go to "Start" -> "Run" and enter "dcomcnfg"
    2. This will bring up the component services window, expand out "Console Root" -> "Computers" -> "DCOM Config"
    3. Find "Microsoft Excel Application" in the list of components.
    4. Right click on the entry and select "Properties"
    5. Go to the "Identity" tab on the properties dialog.
    6. Select "The interactive user."

    courtesy of Last paragraph mentioned in here

    0 讨论(0)
  • 2020-11-29 02:38

    I was seeing this same error when trying to save an excel file. The code worked fine when I was using MS Office 2003, but after upgrading to MS Office 2007 I started seeing this. It would happen anytime I tried to save an Excel file to a server or remote fie share.

    My solution, though rudimentary, worked well. I just had the program save the file locally, like to the user's C:\ drive. Then use the "System.IO.File.Copy(File, Destination, Overwrite)" method to move the file to the server. Then you can delete the file on the C:\ drive.

    Works great, and simple. But admittedly not the most elegant approach.

    Hope this helps! I was having a ton of trouble finding any solutions on the web till this idea popped into my head.

    0 讨论(0)
提交回复
热议问题