简体   繁体   English

将 GraphViz/Dot 转换为 Powerpoint Graph

[英]Converting GraphViz/Dot to Powerpoint Graph

I'm trying to get from a GraphViz graph to a graph in Powerpoint.我正在尝试从 GraphViz 图到 Powerpoint 中的图。 But, when it's inside of Powerpoint I would like to be able to edit the individual nodes, edges, boundaries.但是,当它在 Powerpoint 中时,我希望能够编辑单个节点、边、边界。 This means exporting the GraphViz as an image file won't work.这意味着将 GraphViz 导出为图像文件将不起作用。

Does anyone know any path to get from GraphViz to Powerpoint?有谁知道从 GraphViz 到 Powerpoint 的任何路径?

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. 如果您知道.PPTX文件的XML结构,则可以将GraphViz图导出为SVG(实际上是文本格式),然后解析它并发出创建.PPTX文件所需的XML。 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. 与所有Microsoft“开放文档”格式一样,.PPTX实际上只是一个包含许多元素的ZIP文件,XML描述的图形就是其中之一。

You can generate .emf (Enhanced Metafile) images from .dot files using GraphViz on Windows. 您可以使用Windows上的GraphViz从.dot文件生成.emf(增强型图元文件)图像。 You can import the .emf file into your PowerPoint presentation and then ungroup it (several times) to break it down into the individual shapes. 您可以将.emf文件导入到PowerPoint演示文稿中,然后将其取消组合(多次)以将其分解为各个形状。

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. 相反,它们是线条的图片,因此当您移动图形的任何节点时,它们不会重新路由。

You can achieve this by using LibreOffice.您可以通过使用 LibreOffice 来实现这一点。 I've tested the process with LibreOffice 7.0.4.2.我已经用 LibreOffice 7.0.4.2 测试了这个过程。

  1. Export your graph as SVG in Graphviz ( -Tsvg ).Graphviz ( -Tsvg ) -Tsvg图形导出为 SVG。
  2. Create a presentation in LibreOffice : File → New → PresentationLibreOffice 中创建演示文稿:文件 → 新建 → 演示文稿
  3. Delete the elements in the slide (title & body boxes).删除幻灯片中的元素(标题和正文框)。
  4. Import the SVG file: Insert → Image导入 SVG 文件:插入→图像
  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.将演示文稿另存为 .pptx:文件 → 另存为... → 在对话框中选择文件类型 .pptx。
  8. Open the .pptx in PowerPoint .PowerPoint 中打开 .pptx。
  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.) (当然,您可以以相反的顺序执行 9. 和 10.。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM