Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My goal is to ensure that the C++ code I insert in my presentation compiles correctly. I therefore thought I'd have each example in a separate file (so that I can compile it), and include the text from those files in the Powerpoint slides... I want this 'inclusion' to be dynamic, so that if I change the code in a file, the slides are automatically updated.

Is it possible? Will I have to use LaTeX instead of Powerpoint? Any other suggestion about how to solve this problem?

Thanks.

share|improve this question
    
I answered a similar question for openoffice here: superuser.com/questions/199624/… maybe this will help. BTW still not sure why he never marked it as the answer. – jnewman Dec 20 '10 at 6:30
up vote 1 down vote accepted
+50

See this question. You don't need code to get the slide to update if you insert it as an object

Powerpoint 2007 linking to external content

share|improve this answer

In PowerPoint you will need to write a macro to read the text and update the slide.

An example of a macro to read a text file can be found here:
Read in text from an ascii file.

You will also need to force the slide to refresh:

' assuming a reference to the current slide in oSl
ActiveWindow.View.GotoSlide(oSl.SlideIndex)

This article could also be useful as an example :
Add a random phrase from a text file to a text box on each slide

share|improve this answer

If you rename a Powerpoint 2010 .pptx file into a .zip file, you can open it via Winzip, 7zip etc.

The slide contents are written in XML files named "...\ppt\slides\slide2.xml" in this packed archive structure.

A snippet from a German .pptx file:

-<a:p>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" err="1" dirty="0"/>
<a:t>A text to change ....</a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" dirty="0"/>
<a:t> </a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" err="1" dirty="0"/>
<a:t>another Text to change</a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" dirty="0"/>
<a:t> </a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" err="1" dirty="0"/>
<a:t>Text ...</a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" dirty="0"/>
<a:t> </a:t>
</a:r>
-<a:r>
<a:rPr lang="de-DE" smtClean="0" err="1" dirty="0"/>
<a:t>Text ...</a:t>
</a:r>
<a:endParaRPr lang="de-DE" smtClean="0" dirty="0"/>
</a:p>

So, it should be possible to prepare a .pptx template file and replace placeholder strings like ${Text1234} using a home-grown tool.

share|improve this answer

I don't know if there is an API which will allow you to code in C++ directly, but there is one for Java: poi.apache.org so you could always wrap in it in a script to execute it.

That said, LaTex sound like a better fit IMHO.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .