Solved

Excel COM Chart.Export throws COMException

Posted on 2003-11-04
1
783 Views
Last Modified: 2007-12-19
Hi there,

I am trying to export a chart using the Excel11 object from within C#.  I can
properly open workbooks and read cells, but calling Export() on the Chart
object throws the following COMException

Exception: System.Runtime.InteropServices.COMException (0x800A03EC):
Exception from HRESULT: 0x800A03EC.
at Excel._Chart.Export(String Filename, Object FilterName, Object
Interactive)
at MBCCS.LeParc.Importer.Importer.GetImageInfoFromWorksheet(Worksheet
worksheet) in d:\source\leparc\importer\importer.cs:line 211

The line causing this is:

tempChart.Chart.Export(filename, "JPEG", Missing.Value);

The JPEG filter is registered.

I am trying to export a picture from excel to an external file.  What I am doing is creating a new
chart, copying the picture to the chart, then exporting the chart.  The
Excel process is running under the ASPNET account.

Any help would be greatly appreciated.

Thanks,
0
Comment
Question by:sberkovitz
1 Comment
 

Accepted Solution

by:
sberkovitz earned 0 total points
Comment Utility
OK Figured it out.

The problem was that the ASPNET user account didn't have access to the MSI Installer COM object.  What was happening is that the .Export() method searches the HKCU registry key for available graphic filters.  Because the ASPNET user is not an interactive user, no user profile had been created for it, and calling the .Export() method prompted MSI to create the profile (including the HKCU hive).
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now