将 Visio 形状转换为 Html

将 visio 形状转换为 html

公开的 ToHTML 方法形状类可用于转换为html。

下面的代码显示了如何:

  1. 加载示例 diagram。
  2. 获取特定页面。
  3. 得到一个特定的形状。
  4. 将形状转换为 html。

形状到 HTML

在您的 Java 应用程序中使用以下代码将 visio 形状转换为 html。

// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(ShapeToHtml.class);
// Call a Diagram class constructor to load the VSDX diagram
Diagram diagram = new Diagram(dataDir + "ShapeToHtml.vsdx");
// Get a particular page
Page page = diagram.getPages().get(0);
// Get a particular shape
Shape shape = page.getShapes().get(0);
// Shape to HTML
HTMLSaveOptions hs = new HTMLSaveOptions();
shape.toHTML("out.htm", hs);