Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting GraphViz/Dot to Powerpoint Graph

I'm trying to get from a GraphViz graph to a graph in Powerpoint. But, when it's inside of Powerpoint I would like to be able to edit the individual nodes, edges, boundaries. This means exporting the GraphViz as an image file won't work.

Does anyone know any path to get from GraphViz to Powerpoint?

like image 747
greedybuddha Avatar asked Feb 08 '18 17:02

greedybuddha


3 Answers

If you know the XML structure of a .PPTX file, you could export your GraphViz graph as an SVG -- which is in reality a text format -- then parse it and emit the XML needed to create the .PPTX file. A difficult method though, I know.

Like all of the Microsoft "open document" formats, the .PPTX is really just a ZIP file that contains many elements, the XML describing the graph being one of them.

like image 193
TomServo Avatar answered Nov 05 '22 10:11

TomServo


You can generate .emf (Enhanced Metafile) images from .dot files using GraphViz on Windows. You can import the .emf file into your PowerPoint presentation and then ungroup it (several times) to break it down into the individual shapes.

This is good, but unfortunately the edges of your graph do not get turned into connectors. Instead, they are pictures of lines, so they don't reroute when you move any of the nodes of your graph around.

like image 2
Anthony Hayward Avatar answered Nov 05 '22 10:11

Anthony Hayward


You can achieve this by using LibreOffice. I've tested the process with LibreOffice 7.0.4.2.

  1. Export your graph as SVG in Graphviz (-Tsvg).
  2. Create a presentation in LibreOffice: File → New → Presentation
  3. Delete the elements in the slide (title & body boxes).
  4. Import the SVG file: Insert → Image
  5. Once the image is inserted, select it by left-clicking on it.
  6. Open the context menu by right-clicking on the image and choose Break.
  7. Save the presentation as .pptx: File → Save As... → Choose the file type .pptx in the dialog.
  8. Open the .pptx in PowerPoint.
  9. Select all the image components and copy them to your actual presentation.
  10. Edit the image.

(Of course, you can do 9. and 10. in reverse order.)

like image 1
haba713 Avatar answered Nov 05 '22 11:11

haba713