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

  • SEARCH
  • Home
  • 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 3842470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:47:54+00:00 2026-05-19T15:47:54+00:00

Ok, this has had me stumped for a while – One of our clients

  • 0

Ok, this has had me stumped for a while – One of our clients would like to have all of their images replaced in a list of a word document. Finding images themselves is fine, with example code as follows:

    Microsoft.Office.Interop.Word.Application wordDoc;
    wordDoc = new Microsoft.Office.Interop.Word.Application();
    object docName = @"c:\temp\Client.doc";


    object objBool = false;
    object objBoolTrue = true;
    object objNull = System.Reflection.Missing.Value;

    Document openDoc = null;

    openDoc = wordDoc.Documents.Open(ref docName, ref objBool, ref objBool, ref objBool, ref objNull,ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull);

    List<Microsoft.Office.Interop.Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();
    foreach (Microsoft.Office.Interop.Word.Shape s in openDoc.Shapes)
    {
      // do stuff here with comparing and replacing images
    }

However I noticed that it wasn’t recognising some images (irrespective of where they were, this is not a header or footer issue). On further research it appears that the image itself is not a normal imbedded image, but rather an Autoshape.

My code must therefore also be able to inspect the autoshapes in the document and change them if required as well. However for the life of me, I cannot determine how to inspect the image in an autoshape.

Finding the autoshapes themselves is fairly straightforward, as follows:

ranges = new List<Microsoft.Office.Interop.Word.Range>();
foreach (Microsoft.Office.Interop.Word.Shape s in openDoc.Shapes)
{
...
}

However once I identify the autoshape, I cannot determine how I find information about the enclosed image.

Does anyone know how I would go about doing this?

  • 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-19T15:47:54+00:00Added an answer on May 19, 2026 at 3:47 pm

    You either have a grouped image, in which case you should recursively crawl through GroupItems, or an inline image inside a textbox, in which case you should look inside the TextFrame.TextRange.ShapeRange.

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

Sidebar

Related Questions

Has anyone had this problem? My projects tend to have some long XML files
This question has two parts. Part 1. Yesterday I had some code which would
I have a question that has had me stumped for a bit, I thought
I'm sure this is easy but it has had me stumped for ages. I
This question has been asked and answered numerous times, but I'm still stumped. All
This has had me stumped for a bit and I can't seem to figure
This probably has a simple answer, but I must not have had enough coffee
This has had me stumped for days. I am trying to get an mp4
Alright, this has had me stumped on and off for a couple of months
Okay people, I'm sure someone has had this issue and can help me out.

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.