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 8529491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:02:44+00:00 2026-06-11T09:02:44+00:00

So I have figured out how to replace pictures with text in word using

  • 0

So I have figured out how to replace pictures with text in word using this link

But now I need to export pictures from word to a folder. And I’m guessing whenever I find a picture which is a object(type s=Microsoft.Office.Interop.Word.WdInlineShapeType.wdInlineShapePicture) I should do something with it… But I can’t find the option: s.saveAsPicture(@”C:\pic.jpg”);

  • 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-06-11T09:02:45+00:00Added an answer on June 11, 2026 at 9:02 am

    Your question might be a possible duplicate of: extract image from word file

    However, based on my previous answer to your question regarding how to programmatically compare an external image with inline shapes in Word ( see Compare picture in Word file and in a folder? ) – you can make a couple of simple adjustments and use almost the exact same sample code to export each inline shape to a folder instead of comparing the shapes with another image.

    To illustrate I have made the necessary adjustments for you and provided the source code below. Again, the application is a C# console application based on .NET 4.5, Microsoft Office Object Library version 15.0, and Microsoft Word Object Library version 15.0.

    And like before, I have included references in the source code such that you can see which sources I have based my solution on ( and such that the sources gets the credit they deserve 😉 )

    using System;
    using System.Drawing;
    using System.Threading;
    using System.Windows.Forms;
    using Application = Microsoft.Office.Interop.Word.Application;
    
    namespace WordDocStats
    {
        class Program
        {
            // General idea is based on: https://stackoverflow.com/a/7937590/700926
            static void Main()
            {
                // Open a doc file
                var wordApplication = new Application();
                var document = wordApplication.Documents.Open(@"C:\Users\Username\Documents\document.docx");
    
                // For each inline shape, export it to a file
                // By inspection you can see that the first inline shape have index 1 ( and not zero as one might expect )
                for (var i = 1; i <= wordApplication.ActiveDocument.InlineShapes.Count; i++)
                {
                    // closure
                    // http://confluence.jetbrains.net/display/ReSharper/Access+to+modified+closure
                    var inlineShapeId = i; 
    
                    // parameterized thread start
                    // https://stackoverflow.com/a/1195915/700926
                    var thread = new Thread(() => SaveInlineShapeToFile(inlineShapeId, wordApplication));
    
                    // STA is needed in order to access the clipboard
                    // https://stackoverflow.com/a/518724/700926
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                    thread.Join();
                }
    
                // Close word
                wordApplication.Quit();
                Console.ReadLine();
            }
    
            // General idea is based on: https://stackoverflow.com/a/7937590/700926
            protected static void SaveInlineShapeToFile(int inlineShapeId, Application wordApplication)
            {
                // Get the shape, select, and copy it to the clipboard
                var inlineShape = wordApplication.ActiveDocument.InlineShapes[inlineShapeId];
                inlineShape.Select();
                wordApplication.Selection.Copy();
    
                // Check data is in the clipboard
                if (Clipboard.GetDataObject() != null)
                {
                    var data = Clipboard.GetDataObject();
    
                    // Check if the data conforms to a bitmap format
                    if (data != null && data.GetDataPresent(DataFormats.Bitmap))
                    {
                        // Fetch the image and convert it to a Bitmap
                        var image = (Image) data.GetData(DataFormats.Bitmap, true);
                        var currentBitmap = new Bitmap(image);
    
                        // Save the bitmap to a file
                        currentBitmap.Save(@"C:\Users\Username\Documents\" + String.Format("img_{0}.png", inlineShapeId));
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have figured out how to replace words in documents as this is fairly
This week I have figured out how to modify form elements in the location
hey guys having this really simple problem but cant seem to figure out have
I need to update the GroupID field to a 0. I have figured out
I thought I had this figured out, but I'm wanting to find all occurances
I have already figured out how to replace a button with jquery and ajax
I have figured out a way to change the style of tabs at run
I have figured out how to add a custom calendar within my iPhone app,
EDIT I have finally figured out the problem i have been having on my
As I have already figured out. I want to create a web service on

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.