Your slide deck is a zip file in disguise

Show me!

I need more proof

Neat. But how is this useful?

Use Case 1: Extracting all images from a slide deck

Use Case 2: Extracting notes from each slide

function extractSlideNotes()
{
local i=0;
local DIR=${1:-.}; # Default is current folder
# XML path to slide notes: <p:txBody> -> <a:p> --> <a:r> --> <a:t> (see notesSlide.xml files)
local XPATH="//*[local-name()='txBody']/*[local-name()='p']/*[local-name()='r']/*[local-name()='t']/text()";
# Loop through each slide
for FILE in ${DIR}/ppt/notesSlides/*.xml;
do
(( i++ ));
# Fetch and output the notes
local NOTES=$(xmllint --xpath ${XPATH} ${FILE});
echo -e ${i} "\t" ${NOTES};
done
}
$ extractSlideNotes ~/Desktop/sample/
1 Notes on slide 1
2 Notes on slide 2
3 Notes on slide 3

What about adding slides?

  • [Content_Types].xml
  • ppt/presentation.xml
  • ppt/_rels/presentation.xml.rels
  • ppt/slides/slide4.xml
  • ppt/slides/_rels/slide4.xml
Sub Test()
Dim pptSlide As Slide, pptLayout As CustomLayout
Set pptLayout = ActivePresentation.Slides(1).CustomLayout

For Index = 1 To 5
slideID = ActivePresentation.Slides.Count + 1

' Create new slide
Set pptSlide = ActivePresentation.Slides.AddSlide(slideID, pptLayout)

' Add a new image to that slide from /Users/robert/Desktop/images/figure*.png
pptSlide.Shapes.AddPicture fileName:="Users:robert:Desktop:images:figure" & Index & ".png", LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=0, Top:=100
Next
End Sub

It’s a wrap

--

--

--

Bioinformatics Software Engineer, Author of Level up with WebAssembly book.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Leetcode Q341. Flatten Nested List Iterator (Q286)

Applied Design Patterns & Software Architecture

Why Amazon EventBridge will change the way you build serverless applications

Setting Up a Server on DigitalOcean — Pt 1

Instacart Machine Learning interview: what to expect

MY JOURNEY AS A GSoC 2021 STUDENT

How can I automatically create Azure DevOps Release Notes and how can I publish them?

Compilation stages of a Process

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Robert Aboukhalil

Robert Aboukhalil

Bioinformatics Software Engineer, Author of Level up with WebAssembly book.

More from Medium

5 Best Books on Astrophysics

Books that I read this year

Top ten books of 2021

5 Internet Hacks for Students