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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:58:14+00:00 2026-05-24T21:58:14+00:00

I started experimenting with Open XML SDK 2.0 for Microsoft Office . I’m currently

  • 0

I started experimenting with Open XML SDK 2.0 for Microsoft Office.

I’m currently able to do certain things such as retrieve all texts in each slide, and get the size of the presentation. For example, I do the latter this way:

using (var doc = PresentationDocument.Open(pptx_filename, false)) {
     var presentation = doc.PresentationPart.Presentation;

     Debug.Print("width: " + (presentation.SlideSize.Cx / 9525.0).ToString());
     Debug.Print("height: " + (presentation.SlideSize.Cy / 9525.0).ToString());
}

Now I’d like to retrieve embedded images in a given slide. Does anyone know how to do this or can point me to some docs on the subject?

  • 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-24T21:58:15+00:00Added an answer on May 24, 2026 at 9:58 pm

    First you need to grab the SlidePart in which you want to get the images from:

    public static SlidePart GetSlidePart(PresentationDocument presentationDocument, int slideIndex)
    {
        if (presentationDocument == null)
        {
            throw new ArgumentNullException("presentationDocument", "GetSlidePart Method: parameter presentationDocument is null");
        }
    
        // Get the number of slides in the presentation
        int slidesCount = CountSlides(presentationDocument);
    
        if (slideIndex < 0 || slideIndex >= slidesCount)
        {
            throw new ArgumentOutOfRangeException("slideIndex", "GetSlidePart Method: parameter slideIndex is out of range");
        }
    
        PresentationPart presentationPart = presentationDocument.PresentationPart;
    
        // Verify that the presentation part and presentation exist.
        if (presentationPart != null && presentationPart.Presentation != null)
        {
            Presentation presentation = presentationPart.Presentation;
    
            if (presentation.SlideIdList != null)
            {
                // Get the collection of slide IDs from the slide ID list.
                var slideIds = presentation.SlideIdList.ChildElements;
    
                if (slideIndex < slideIds.Count)
                {
                   // Get the relationship ID of the slide.
                   string slidePartRelationshipId = (slideIds[slideIndex] as SlideId).RelationshipId;
    
                    // Get the specified slide part from the relationship ID.
                    SlidePart slidePart = (SlidePart)presentationPart.GetPartById(slidePartRelationshipId);
    
                     return slidePart;
                 }
             }
         }
    
         // No slide found
         return null;
    }
    

    Then you need to search for the Picture object which will contain the image you are looking for based on the file name of the image:

    Picture imageToRemove = slidePart.Slide.Descendants<Picture>().SingleOrDefault(picture => picture.NonVisualPictureProperties.OuterXml.Contains(imageFileName));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I recently started experimenting with python currently reading Think like a computer scientist:
I recently started experimenting with the HtmlAgilityPack. I am not familiar with all of
So started recently experimenting with the Android SDK and eclipse IDE and during this
I've just started experimenting with SDL in C++, and I thought checking for memory
I've started experimenting with Hudson as a build server. I'm using subversion and have
I have recently started experimenting with Django for some web applications in my spare
I just started experimenting with Aptana Jaxer server side javascript engine for my next
I've recently started experimenting with PostSharp and I found a particularly helpful aspect to
I've just started experimenting with WPF templates vs. styles and I'm not sure what
Hi I've just started experimenting with .live and .die and having some great results

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.