Syntax Highlighting addin for Powerpoint 2010

I’ve been working on a syntax highlighting addin for powerpoint for some time now. I finally feel that it is stable enough to push a first version onto the interwebs.

You can use it on your slides to make code in there more readable and have a consistent styling. I know you can use “paste with keep formatting”, but I find it can be annoying.

I used Alsing.Syntaxbox and  NRtfTree to help with the heavy lifting. I modified them a bit, just by removing code I didn’t need.

What it does, essentially, is add a couple of buttons to a Ribbon. When you click a button, the addin detects which element was selected on a slide and applies syntax coloring of the selected language to it. To do this, a SyntaxDocument is created, it parses and calculates the styles for each word. Then I take the output of the SyntaxDocument and feed it into a RtfDocument. When that is done, i use the clipboard to do a rich paste into the element and apply some styles I like. It is written in C#. The syntax definition files are included as embedded resources.

To install the addin: unzip (using 7zip) the archive, then double click the SyntaxColoring.vsto file. This will install the plugin for you. You can remove it from your machine in “Add or remove programs”. In Powerpoint you can enable and disable the addin, or remove it if you don’t like it. Note that you might need to install the Visual Studio 2010 Tools for Office, before you can execute the vsto file.

Please provide feedback if you like this or if you have suggestions for improvement. Take the source code and make it better. This is released under a GPL licence. You can take it, modify it, but you have to give me credit and publish the source of your modifications. There is no support or warranty of any kind. The components I used are open source, so respect the licence of those.

6 responses to “Syntax Highlighting addin for Powerpoint 2010”

  1. Benjamin Avatar
    Benjamin

    Hi!

    Thanks for this great Plugin!

    Is it possible to add support for more languages like Java, Ruby, etc.? Then it would be the best solution to put source code into a ppt file.

    Best regards

  2. Ittay Avatar
    Ittay

    Please consider using a more standard syntax highlighter, and making it possible to add new syntaxes. For my case, I need Scala highlighting.

  3. […] Syntax Highlighting Addin for Powerpoint 2010. Plugin para Microsoft PowerPoint que permite dar formato y colorear fragmentos de código fuente. Actualmente soporta los lenguajes C#, VB.NET, JavaScript, HTML y XML. NRtfTree se utiliza para generar el código fuente con formato que se insertará finalmente en el slide de PowerPoint. […]

  4. Jeroen Avatar

    Hi, it is certainly possible to add more languages. Just using the syntax files that come with syntaxbox will do the job.

  5. 助平君 Avatar

    I have to drop some notes to say, this tool is amazing! It saved me from pasting code from visual studio.

    However, There are two aspects could be improved.
    1. It would be better that Colour scheme can be customised. (Default scheme in VS is preferable)
    2. Default style (e.g. font, font size, background color) could be configure because pre-defined style is using a relatively large font size.

    Thanks for such a fascinating tool.

  6. […] trovato questo post molto interessante syntax highlighting addin che elenca qualche soluzione. Le soluzioni proposte utilizzano dei plugin oppure la formattazione […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.