公共 API Aspose.Diagram 17.01 的变化

转换具有选择形状的绘图 Visio

开发人员可以选择特定的形状将 Visio 绘图转换为任何其他受支持的格式。为此,我们在 RenderingSaveOptions 类中添加了 Shapes 成员。每个保存选项类都是 RenderingSaveOptions 类的扩展形式。请检查代码示例:

Java

 // The path to the documents directory.

String dataDir = Utils.getSharedDataDir(ConvertVisioWithSelectiveShapes.class) + "LoadSaveConvert\\";

// call the diagram constructor to load diagram from a VSD file

Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");

// create an instance SVG save options class

SVGSaveOptions options = new SVGSaveOptions();

ShapeCollection shapes = options.getShapes();

// get shapes by page index and shape ID, and then add in the shape collection object

shapes.add(diagram.getPages().get(0).getShapes().getShape(1));

shapes.add(diagram.getPages().get(0).getShapes().getShape(2));

// save Visio drawing

diagram.save(dataDir + "SelectiveShapes_out.svg", options);