Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:03:42+00:00 2026-05-28T07:03:42+00:00

Excel Interop is removing images from processed files. I’m using the Excel Interop, no

  • 0

Excel Interop is removing images from processed files.

I’m using the Excel Interop, no third-party components are present (that I’m aware of).
The workflow is — create a copy (target) of a file (template), populate cells, change radio-button state

  1. Create copy (target) of a pre-existing .xslm file (template)
  2. Open target via Excel Interop
  3. Populate target cells, change radio-button state
  4. The worksheet with an image is not modified
  5. Close target

On my dev machine, the target file looks great — everything is populated, the image is present. NB: on my dev machine, I’m running the code from the VS2010 IDE.

On the production machine — everything is populated, but the image is not present.
Instead, the following error appears in its place:
NB: on the production machine, it’s running as a service, with the Local Service account.

“The image part with relationship ID rId1 was not found in the file”
the image part with relationship ID rId1 was not found in the file

The entire workbook is opened via the following code:

var workbook = workbooks.Open(targetPath
     0, false, 5, Type.Missing, Type.Missing, false, XlPlatform.xlWindows, "",
     true, false, 0, true, false, false);

Please note that the worksheet with the image is not manipulated in the code.

The worksbooks (and individual worksheets) are protected. However, the protected template is processed correctly in dev, but not in production. I don’t think the protection has anything to do with it (but who knows, right? This is Interop. ugh).

The file was created by another party, and all components (ie, the image) reside within the .xslm structure, not as links to another server.

I have verified that the image is visible on the production machine in the template file, but not in a processed file.

To confirm that this was not an issue in opening the file within the production, I emailed myself a copy, and the image continued to be not present.

I have also confirmed that, on my development machine, processed files do have a visible image.

I unprotected the worksheet, and unzipped the file structure. The .jpg file is indeed not present in the processed target from the production machine.

One more note — Office 2010 is installed on my development machine, but Office 2007 on the production machine. As a result, I’m using the Office 12 Interop. No runtime errors are generated in either environment.

I am using the Interop (instead of an OpenXml library) because there are ActiveX controls present that must be populated. Note however, that none of the ActiveX controls have any issues — they are working fine. It’s just image-files that are vanishing from processed files (they render fine in the template file).

UPDATE NOTE: There are four other image-files, all .emf on a different worksheet; they are all stripped as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:03:43+00:00Added an answer on May 28, 2026 at 7:03 am

    As explained in comments (and eventually in an edit to the question), the code was running in production as a service, with the Local Service account.

    I am now unsure why I picked this account — something I found in passing during my research on getting the Interop to run correctly as a service?

    However, once I switched from the Local Service account to the Local System account (and checked “Allow service to interact with desktop”) it worked. Automagically.

    1. services.msc
    2. select the service
    3. right-click, select “Properties”
    4. select the “Log On” tab
    5. select “Local System account” and check “Allow service to interact with desktop”

    “Allow service to interact with desktop” might not be required; Other notes on automating the Interop suggest that other desktop settings are required, however I did an install where those pre-requisites were set but THIS value unchecked; app still worked…

    http://i.imgur.com/k6Qwy.png

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Excel COM interop to insert images (specifically EPS) into a spreadsheet.
I am creating an Excel Worksheet from C# using Microsoft.Office.Interop.Excel, and I have not
When using Excel Interop libraries from .NET, I can find a Range object representing
I have a program that is using the excel interop routines to generate a
I have started using the Excel interop assemblies that are provided by Microsoft for
I am using Microsoft.Office.Interop.Excel to read a spreadsheet that is open in memory. gXlWs
I am using Excel interop in my VB.NET program. My problem is that I
I am currently exporting data from an excel import using excel interop. I've been
I'm using the Excel interop in C# ( ApplicationClass ) and have placed the
I'm wondering if there is a simple property in the Excel interop that returns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.