Is it possible to embed programming source code to Powerpoint slide, and keep code highlighting/coloring?
How to embed programming source code in Powerpoint slide and keep code highlighting
microsoft-powerpointsource code
Related Solutions
Note: doesn't work for PowerPoint 2003, only for new pptx files (since 2007)
Seems like relative paths are supported, they are just not straightforward to implement. For example if your Powerpoint presentation is in the MyFiles folder, and the MyMovie.avi is in the Media folder inside MyFiles. The trick is to edit the xml files inside the Powerpoint file:
- Make a copy of your presentation as Presentation.pptx (just to keep the original safe).
- Rename your Presentation.pptx file into Presentation.pptx.zip
- Open the resulting zip file by clicking on it.
- It will open as a folder. Inside it, go to ppt, then slides, then _rels
- You will see files called slide1.xml.rels etc.
- Copy (drag and drop) all those to another place, outside the archive.
- Now open the file corresponding to the number of your slide with video with some editor (for example, Notepad).
- Look for the line that says something like: Target="file:///C:\MyFiles\Media\MyMovie.avi"
- If your Powerpoint presentation is in the MyFiles folder, and the MyMovie.avi is in the Media folder inside MyFiles, then change the above line to: Target="Media\MyMovie.avi"
- Save the slide1.xml.rels file (or whatever number it was), then drag it back to that archive (that is actually a Powerpoint file), and then rename the archive back to Presentation.pptx
- This is it. Now you should be able to carry around the folder MyFiles with the presentation and with the Media folder inside it that contains your video.
Works for me on Windows 7.
Good luck!
Based on what you explained:
A.
What you request is not possible in the PowerPoint by simple command somewhere on toolbar because main purpose of the PowerPoint is elsewhere.
B.
It is possible to create macro using VBA programming. Programmatically
- Iterate over all shapes and calculate top, left, bottom and right edge of all (= of entire drawing).
- Move every shape (set its Left and Top properties) so that center of the entire drawing (of group of shapes) will become the center of the slide. Reason: I can see that size change is made in relation to the center of the slide, so center your stuff before slide resizing.
- Set slide size to width and height calculated from values collected in step 1.
Based on your StackOverflow profile, I can see you are a programmer so if you really need this feature, it shouldn't be so difficult for you to put it together and save a lot of time in future on resizing of slides.
Shapes are in collection ActivePresentation.Slides(1).Shapes
(use For Each
... Next
). You can find a ton of examples – keyword is vba, e.g. vba powerpoint resize slide
or vba powerpoint iterate shapes
.
VBA code editor is reachable using Alt+F11. In editor, object model can be studied using F2 – object inspector. Every object is well-documented, press help icon in object inspector. Store your macro in the presentation and save your file as type PowerPoint macro-enabled presentation or as PowerPoint macro-enabled template. If you get stuck, first search and then feel free to ask at the StackOverflow. VBA coding is relatively trivial. It has couple of oddities (do not use parenthesis on procedure call, only in function call; element indexes in collections start at 1), but they are quite bearable.
Also see commands in Debug menu to boost up your development. You can modify the live code when your program waits (yellow line) and you can use Set next statement command to move your current execution point forward or back, wherever you want. A great time saver.
When in PowerPoint, you can open the macro list using Alt+F8 or from View menu.
Best Answer
After pasting, a small "Paste Options" icon appears below the pasted text.
Click this icon and choose "Keep Source Formatting" :